Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_winch_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE WINCH_STATUS PACKING
3
4#define MAVLINK_MSG_ID_WINCH_STATUS 9005
5
6
8 uint64_t time_usec; /*< [us] Timestamp (synced to UNIX time or since system boot).*/
9 float line_length; /*< [m] Length of line released. NaN if unknown*/
10 float speed; /*< [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown*/
11 float tension; /*< [kg] Tension on the line. NaN if unknown*/
12 float voltage; /*< [V] Voltage of the battery supplying the winch. NaN if unknown*/
13 float current; /*< [A] Current draw from the winch. NaN if unknown*/
14 uint32_t status; /*< Status flags*/
15 int16_t temperature; /*< [degC] Temperature of the motor. INT16_MAX if unknown*/
16} mavlink_winch_status_t;
17
18#define MAVLINK_MSG_ID_WINCH_STATUS_LEN 34
19#define MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN 34
20#define MAVLINK_MSG_ID_9005_LEN 34
21#define MAVLINK_MSG_ID_9005_MIN_LEN 34
22
23#define MAVLINK_MSG_ID_WINCH_STATUS_CRC 117
24#define MAVLINK_MSG_ID_9005_CRC 117
25
26
27
28#if MAVLINK_COMMAND_24BIT
29#define MAVLINK_MESSAGE_INFO_WINCH_STATUS {
30 9005,
31 "WINCH_STATUS",
32 8,
33 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_winch_status_t, time_usec) },
34 { "line_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_winch_status_t, line_length) },
35 { "speed", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_winch_status_t, speed) },
36 { "tension", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_winch_status_t, tension) },
37 { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_winch_status_t, voltage) },
38 { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_winch_status_t, current) },
39 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_winch_status_t, temperature) },
40 { "status", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_winch_status_t, status) },
41 } \
42}
43#else
44#define MAVLINK_MESSAGE_INFO_WINCH_STATUS {
45 "WINCH_STATUS",
46 8,
47 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_winch_status_t, time_usec) },
48 { "line_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_winch_status_t, line_length) },
49 { "speed", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_winch_status_t, speed) },
50 { "tension", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_winch_status_t, tension) },
51 { "voltage", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_winch_status_t, voltage) },
52 { "current", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_winch_status_t, current) },
53 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 32, offsetof(mavlink_winch_status_t, temperature) },
54 { "status", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_winch_status_t, status) },
55 } \
56}
57#endif
58
59/**
60 * @brief Pack a winch_status message
61 * @param system_id ID of this system
62 * @param component_id ID of this component (e.g. 200 for IMU)
63 * @param msg The MAVLink message to compress the data into
64 *
65 * @param time_usec [us] Timestamp (synced to UNIX time or since system boot).
66 * @param line_length [m] Length of line released. NaN if unknown
67 * @param speed [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown
68 * @param tension [kg] Tension on the line. NaN if unknown
69 * @param voltage [V] Voltage of the battery supplying the winch. NaN if unknown
70 * @param current [A] Current draw from the winch. NaN if unknown
71 * @param temperature [degC] Temperature of the motor. INT16_MAX if unknown
72 * @param status Status flags
73 * @return length of the message in bytes (excluding serial stream start sign)
74 */
75static inline uint16_t mavlink_msg_winch_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
76 uint64_t time_usec, float line_length, float speed, float tension, float voltage, float current, int16_t temperature, uint32_t status)
77{
78#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
80 _mav_put_uint64_t(buf, 0, time_usec);
81 _mav_put_float(buf, 8, line_length);
82 _mav_put_float(buf, 12, speed);
83 _mav_put_float(buf, 16, tension);
84 _mav_put_float(buf, 20, voltage);
85 _mav_put_float(buf, 24, current);
86 _mav_put_uint32_t(buf, 28, status);
87 _mav_put_int16_t(buf, 32, temperature);
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
90#else
91 mavlink_winch_status_t packet;
92 packet.time_usec = time_usec;
93 packet.line_length = line_length;
94 packet.speed = speed;
95 packet.tension = tension;
96 packet.voltage = voltage;
97 packet.current = current;
98 packet.status = status;
99 packet.temperature = temperature;
100
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
102#endif
103
104 msg->msgid = MAVLINK_MSG_ID_WINCH_STATUS;
105 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
106}
107
108/**
109 * @brief Pack a winch_status message
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param status MAVLink status structure
113 * @param msg The MAVLink message to compress the data into
114 *
115 * @param time_usec [us] Timestamp (synced to UNIX time or since system boot).
116 * @param line_length [m] Length of line released. NaN if unknown
117 * @param speed [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown
118 * @param tension [kg] Tension on the line. NaN if unknown
119 * @param voltage [V] Voltage of the battery supplying the winch. NaN if unknown
120 * @param current [A] Current draw from the winch. NaN if unknown
121 * @param temperature [degC] Temperature of the motor. INT16_MAX if unknown
122 * @param status Status flags
123 * @return length of the message in bytes (excluding serial stream start sign)
124 */
125static inline uint16_t mavlink_msg_winch_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
126 uint64_t time_usec, float line_length, float speed, float tension, float voltage, float current, int16_t temperature, uint32_t status)
127{
128#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
130 _mav_put_uint64_t(buf, 0, time_usec);
131 _mav_put_float(buf, 8, line_length);
132 _mav_put_float(buf, 12, speed);
133 _mav_put_float(buf, 16, tension);
134 _mav_put_float(buf, 20, voltage);
135 _mav_put_float(buf, 24, current);
136 _mav_put_uint32_t(buf, 28, status);
137 _mav_put_int16_t(buf, 32, temperature);
138
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
140#else
141 mavlink_winch_status_t packet;
142 packet.time_usec = time_usec;
143 packet.line_length = line_length;
144 packet.speed = speed;
145 packet.tension = tension;
146 packet.voltage = voltage;
147 packet.current = current;
148 packet.status = status;
149 packet.temperature = temperature;
150
151 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
152#endif
153
154 msg->msgid = MAVLINK_MSG_ID_WINCH_STATUS;
155#if MAVLINK_CRC_EXTRA
156 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
157#else
158 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
159#endif
160}
161
162/**
163 * @brief Pack a winch_status message on a channel
164 * @param system_id ID of this system
165 * @param component_id ID of this component (e.g. 200 for IMU)
166 * @param chan The MAVLink channel this message will be sent over
167 * @param msg The MAVLink message to compress the data into
168 * @param time_usec [us] Timestamp (synced to UNIX time or since system boot).
169 * @param line_length [m] Length of line released. NaN if unknown
170 * @param speed [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown
171 * @param tension [kg] Tension on the line. NaN if unknown
172 * @param voltage [V] Voltage of the battery supplying the winch. NaN if unknown
173 * @param current [A] Current draw from the winch. NaN if unknown
174 * @param temperature [degC] Temperature of the motor. INT16_MAX if unknown
175 * @param status Status flags
176 * @return length of the message in bytes (excluding serial stream start sign)
177 */
178static inline uint16_t mavlink_msg_winch_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
179 mavlink_message_t* msg,
180 uint64_t time_usec,float line_length,float speed,float tension,float voltage,float current,int16_t temperature,uint32_t status)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 _mav_put_uint64_t(buf, 0, time_usec);
185 _mav_put_float(buf, 8, line_length);
186 _mav_put_float(buf, 12, speed);
187 _mav_put_float(buf, 16, tension);
188 _mav_put_float(buf, 20, voltage);
189 _mav_put_float(buf, 24, current);
190 _mav_put_uint32_t(buf, 28, status);
191 _mav_put_int16_t(buf, 32, temperature);
192
193 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
194#else
195 mavlink_winch_status_t packet;
196 packet.time_usec = time_usec;
197 packet.line_length = line_length;
198 packet.speed = speed;
199 packet.tension = tension;
200 packet.voltage = voltage;
201 packet.current = current;
202 packet.status = status;
203 packet.temperature = temperature;
204
205 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
206#endif
207
208 msg->msgid = MAVLINK_MSG_ID_WINCH_STATUS;
209 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
210}
211
212/**
213 * @brief Encode a winch_status struct
214 *
215 * @param system_id ID of this system
216 * @param component_id ID of this component (e.g. 200 for IMU)
217 * @param msg The MAVLink message to compress the data into
218 * @param winch_status C-struct to read the message contents from
219 */
220static inline uint16_t mavlink_msg_winch_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_winch_status_t* winch_status)
221{
222 return mavlink_msg_winch_status_pack(system_id, component_id, msg, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status);
223}
224
225/**
226 * @brief Encode a winch_status struct on a channel
227 *
228 * @param system_id ID of this system
229 * @param component_id ID of this component (e.g. 200 for IMU)
230 * @param chan The MAVLink channel this message will be sent over
231 * @param msg The MAVLink message to compress the data into
232 * @param winch_status C-struct to read the message contents from
233 */
234static inline uint16_t mavlink_msg_winch_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_winch_status_t* winch_status)
235{
236 return mavlink_msg_winch_status_pack_chan(system_id, component_id, chan, msg, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status);
237}
238
239/**
240 * @brief Encode a winch_status struct with provided status structure
241 *
242 * @param system_id ID of this system
243 * @param component_id ID of this component (e.g. 200 for IMU)
244 * @param status MAVLink status structure
245 * @param msg The MAVLink message to compress the data into
246 * @param winch_status C-struct to read the message contents from
247 */
248static inline uint16_t mavlink_msg_winch_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_winch_status_t* winch_status)
249{
250 return mavlink_msg_winch_status_pack_status(system_id, component_id, _status, msg, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status);
251}
252
253/**
254 * @brief Send a winch_status message
255 * @param chan MAVLink channel to send the message
256 *
257 * @param time_usec [us] Timestamp (synced to UNIX time or since system boot).
258 * @param line_length [m] Length of line released. NaN if unknown
259 * @param speed [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown
260 * @param tension [kg] Tension on the line. NaN if unknown
261 * @param voltage [V] Voltage of the battery supplying the winch. NaN if unknown
262 * @param current [A] Current draw from the winch. NaN if unknown
263 * @param temperature [degC] Temperature of the motor. INT16_MAX if unknown
264 * @param status Status flags
265 */
266#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
267
268static inline void mavlink_msg_winch_status_send(mavlink_channel_t chan, uint64_t time_usec, float line_length, float speed, float tension, float voltage, float current, int16_t temperature, uint32_t status)
269{
270#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
271 char buf[MAVLINK_MSG_ID_WINCH_STATUS_LEN];
272 _mav_put_uint64_t(buf, 0, time_usec);
273 _mav_put_float(buf, 8, line_length);
274 _mav_put_float(buf, 12, speed);
275 _mav_put_float(buf, 16, tension);
276 _mav_put_float(buf, 20, voltage);
277 _mav_put_float(buf, 24, current);
278 _mav_put_uint32_t(buf, 28, status);
279 _mav_put_int16_t(buf, 32, temperature);
280
281 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WINCH_STATUS, buf, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
282#else
283 mavlink_winch_status_t packet;
284 packet.time_usec = time_usec;
285 packet.line_length = line_length;
286 packet.speed = speed;
287 packet.tension = tension;
288 packet.voltage = voltage;
289 packet.current = current;
290 packet.status = status;
291 packet.temperature = temperature;
292
293 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WINCH_STATUS, (const char *)&packet, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
294#endif
295}
296
297/**
298 * @brief Send a winch_status message
299 * @param chan MAVLink channel to send the message
300 * @param struct The MAVLink struct to serialize
301 */
302static inline void mavlink_msg_winch_status_send_struct(mavlink_channel_t chan, const mavlink_winch_status_t* winch_status)
303{
304#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
305 mavlink_msg_winch_status_send(chan, winch_status->time_usec, winch_status->line_length, winch_status->speed, winch_status->tension, winch_status->voltage, winch_status->current, winch_status->temperature, winch_status->status);
306#else
307 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WINCH_STATUS, (const char *)winch_status, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
308#endif
309}
310
311#if MAVLINK_MSG_ID_WINCH_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
312/*
313 This variant of _send() can be used to save stack space by reusing
314 memory from the receive buffer. The caller provides a
315 mavlink_message_t which is the size of a full mavlink message. This
316 is usually the receive buffer for the channel, and allows a reply to an
317 incoming message with minimum stack space usage.
318 */
319static inline void mavlink_msg_winch_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float line_length, float speed, float tension, float voltage, float current, int16_t temperature, uint32_t status)
320{
321#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
322 char *buf = (char *)msgbuf;
323 _mav_put_uint64_t(buf, 0, time_usec);
324 _mav_put_float(buf, 8, line_length);
325 _mav_put_float(buf, 12, speed);
326 _mav_put_float(buf, 16, tension);
327 _mav_put_float(buf, 20, voltage);
328 _mav_put_float(buf, 24, current);
329 _mav_put_uint32_t(buf, 28, status);
330 _mav_put_int16_t(buf, 32, temperature);
331
332 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WINCH_STATUS, buf, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
333#else
334 mavlink_winch_status_t *packet = (mavlink_winch_status_t *)msgbuf;
335 packet->time_usec = time_usec;
336 packet->line_length = line_length;
337 packet->speed = speed;
338 packet->tension = tension;
339 packet->voltage = voltage;
340 packet->current = current;
341 packet->status = status;
342 packet->temperature = temperature;
343
344 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_WINCH_STATUS, (const char *)packet, MAVLINK_MSG_ID_WINCH_STATUS_MIN_LEN, MAVLINK_MSG_ID_WINCH_STATUS_LEN, MAVLINK_MSG_ID_WINCH_STATUS_CRC);
345#endif
346}
347#endif
348
349#endif
350
351// MESSAGE WINCH_STATUS UNPACKING
352
353
354/**
355 * @brief Get field time_usec from winch_status message
356 *
357 * @return [us] Timestamp (synced to UNIX time or since system boot).
358 */
359static inline uint64_t mavlink_msg_winch_status_get_time_usec(const mavlink_message_t* msg)
360{
361 return _MAV_RETURN_uint64_t(msg, 0);
362}
363
364/**
365 * @brief Get field line_length from winch_status message
366 *
367 * @return [m] Length of line released. NaN if unknown
368 */
369static inline float mavlink_msg_winch_status_get_line_length(const mavlink_message_t* msg)
370{
371 return _MAV_RETURN_float(msg, 8);
372}
373
374/**
375 * @brief Get field speed from winch_status message
376 *
377 * @return [m/s] Speed line is being released or retracted. Positive values if being released, negative values if being retracted, NaN if unknown
378 */
379static inline float mavlink_msg_winch_status_get_speed(const mavlink_message_t* msg)
380{
381 return _MAV_RETURN_float(msg, 12);
382}
383
384/**
385 * @brief Get field tension from winch_status message
386 *
387 * @return [kg] Tension on the line. NaN if unknown
388 */
389static inline float mavlink_msg_winch_status_get_tension(const mavlink_message_t* msg)
390{
391 return _MAV_RETURN_float(msg, 16);
392}
393
394/**
395 * @brief Get field voltage from winch_status message
396 *
397 * @return [V] Voltage of the battery supplying the winch. NaN if unknown
398 */
399static inline float mavlink_msg_winch_status_get_voltage(const mavlink_message_t* msg)
400{
401 return _MAV_RETURN_float(msg, 20);
402}
403
404/**
405 * @brief Get field current from winch_status message
406 *
407 * @return [A] Current draw from the winch. NaN if unknown
408 */
409static inline float mavlink_msg_winch_status_get_current(const mavlink_message_t* msg)
410{
411 return _MAV_RETURN_float(msg, 24);
412}
413
414/**
415 * @brief Get field temperature from winch_status message
416 *
417 * @return [degC] Temperature of the motor. INT16_MAX if unknown
418 */
419static inline int16_t mavlink_msg_winch_status_get_temperature(const mavlink_message_t* msg)
420{
421 return _MAV_RETURN_int16_t(msg, 32);
422}
423
424/**
425 * @brief Get field status from winch_status message
426 *
427 * @return Status flags
428 */
429static inline uint32_t mavlink_msg_winch_status_get_status(const mavlink_message_t* msg)
430{
431 return _MAV_RETURN_uint32_t(msg, 28);
432}
433
434/**
435 * @brief Decode a winch_status message into a struct
436 *
437 * @param msg The message to decode
438 * @param winch_status C-struct to decode the message contents into
439 */
440static inline void mavlink_msg_winch_status_decode(const mavlink_message_t* msg, mavlink_winch_status_t* winch_status)
441{
442#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
443 winch_status->time_usec = mavlink_msg_winch_status_get_time_usec(msg);
444 winch_status->line_length = mavlink_msg_winch_status_get_line_length(msg);
445 winch_status->speed = mavlink_msg_winch_status_get_speed(msg);
446 winch_status->tension = mavlink_msg_winch_status_get_tension(msg);
447 winch_status->voltage = mavlink_msg_winch_status_get_voltage(msg);
448 winch_status->current = mavlink_msg_winch_status_get_current(msg);
449 winch_status->status = mavlink_msg_winch_status_get_status(msg);
450 winch_status->temperature = mavlink_msg_winch_status_get_temperature(msg);
451#else
452 uint8_t len = msg->len < MAVLINK_MSG_ID_WINCH_STATUS_LEN? msg->len : MAVLINK_MSG_ID_WINCH_STATUS_LEN;
453 memset(winch_status, 0, MAVLINK_MSG_ID_WINCH_STATUS_LEN);
454 memcpy(winch_status, _MAV_PAYLOAD(msg), len);
455#endif
456}