2 // MESSAGE SCALED_IMU3 PACKING
4 #define MAVLINK_MSG_ID_SCALED_IMU3 129
7 typedef struct __mavlink_scaled_imu3_t
{
8 uint32_t time_boot_ms
; /*< Timestamp (milliseconds since system boot)*/
9 int16_t xacc
; /*< X acceleration (mg)*/
10 int16_t yacc
; /*< Y acceleration (mg)*/
11 int16_t zacc
; /*< Z acceleration (mg)*/
12 int16_t xgyro
; /*< Angular speed around X axis (millirad /sec)*/
13 int16_t ygyro
; /*< Angular speed around Y axis (millirad /sec)*/
14 int16_t zgyro
; /*< Angular speed around Z axis (millirad /sec)*/
15 int16_t xmag
; /*< X Magnetic field (milli tesla)*/
16 int16_t ymag
; /*< Y Magnetic field (milli tesla)*/
17 int16_t zmag
; /*< Z Magnetic field (milli tesla)*/
18 }) mavlink_scaled_imu3_t
;
20 #define MAVLINK_MSG_ID_SCALED_IMU3_LEN 22
21 #define MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN 22
22 #define MAVLINK_MSG_ID_129_LEN 22
23 #define MAVLINK_MSG_ID_129_MIN_LEN 22
25 #define MAVLINK_MSG_ID_SCALED_IMU3_CRC 46
26 #define MAVLINK_MSG_ID_129_CRC 46
30 #if MAVLINK_COMMAND_24BIT
31 #define MAVLINK_MESSAGE_INFO_SCALED_IMU3 { \
35 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu3_t, time_boot_ms) }, \
36 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu3_t, xacc) }, \
37 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu3_t, yacc) }, \
38 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu3_t, zacc) }, \
39 { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu3_t, xgyro) }, \
40 { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu3_t, ygyro) }, \
41 { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu3_t, zgyro) }, \
42 { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu3_t, xmag) }, \
43 { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu3_t, ymag) }, \
44 { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu3_t, zmag) }, \
48 #define MAVLINK_MESSAGE_INFO_SCALED_IMU3 { \
51 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu3_t, time_boot_ms) }, \
52 { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu3_t, xacc) }, \
53 { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu3_t, yacc) }, \
54 { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu3_t, zacc) }, \
55 { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu3_t, xgyro) }, \
56 { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu3_t, ygyro) }, \
57 { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu3_t, zgyro) }, \
58 { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu3_t, xmag) }, \
59 { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu3_t, ymag) }, \
60 { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu3_t, zmag) }, \
66 * @brief Pack a scaled_imu3 message
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param msg The MAVLink message to compress the data into
71 * @param time_boot_ms Timestamp (milliseconds since system boot)
72 * @param xacc X acceleration (mg)
73 * @param yacc Y acceleration (mg)
74 * @param zacc Z acceleration (mg)
75 * @param xgyro Angular speed around X axis (millirad /sec)
76 * @param ygyro Angular speed around Y axis (millirad /sec)
77 * @param zgyro Angular speed around Z axis (millirad /sec)
78 * @param xmag X Magnetic field (milli tesla)
79 * @param ymag Y Magnetic field (milli tesla)
80 * @param zmag Z Magnetic field (milli tesla)
81 * @return length of the message in bytes (excluding serial stream start sign)
83 static inline uint16_t mavlink_msg_scaled_imu3_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
84 uint32_t time_boot_ms
, int16_t xacc
, int16_t yacc
, int16_t zacc
, int16_t xgyro
, int16_t ygyro
, int16_t zgyro
, int16_t xmag
, int16_t ymag
, int16_t zmag
)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf
[MAVLINK_MSG_ID_SCALED_IMU3_LEN
];
88 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
89 _mav_put_int16_t(buf
, 4, xacc
);
90 _mav_put_int16_t(buf
, 6, yacc
);
91 _mav_put_int16_t(buf
, 8, zacc
);
92 _mav_put_int16_t(buf
, 10, xgyro
);
93 _mav_put_int16_t(buf
, 12, ygyro
);
94 _mav_put_int16_t(buf
, 14, zgyro
);
95 _mav_put_int16_t(buf
, 16, xmag
);
96 _mav_put_int16_t(buf
, 18, ymag
);
97 _mav_put_int16_t(buf
, 20, zmag
);
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
);
101 mavlink_scaled_imu3_t packet
;
102 packet
.time_boot_ms
= time_boot_ms
;
106 packet
.xgyro
= xgyro
;
107 packet
.ygyro
= ygyro
;
108 packet
.zgyro
= zgyro
;
113 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
);
116 msg
->msgid
= MAVLINK_MSG_ID_SCALED_IMU3
;
117 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
121 * @brief Pack a scaled_imu3 message on a channel
122 * @param system_id ID of this system
123 * @param component_id ID of this component (e.g. 200 for IMU)
124 * @param chan The MAVLink channel this message will be sent over
125 * @param msg The MAVLink message to compress the data into
126 * @param time_boot_ms Timestamp (milliseconds since system boot)
127 * @param xacc X acceleration (mg)
128 * @param yacc Y acceleration (mg)
129 * @param zacc Z acceleration (mg)
130 * @param xgyro Angular speed around X axis (millirad /sec)
131 * @param ygyro Angular speed around Y axis (millirad /sec)
132 * @param zgyro Angular speed around Z axis (millirad /sec)
133 * @param xmag X Magnetic field (milli tesla)
134 * @param ymag Y Magnetic field (milli tesla)
135 * @param zmag Z Magnetic field (milli tesla)
136 * @return length of the message in bytes (excluding serial stream start sign)
138 static inline uint16_t mavlink_msg_scaled_imu3_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
139 mavlink_message_t
* msg
,
140 uint32_t time_boot_ms
,int16_t xacc
,int16_t yacc
,int16_t zacc
,int16_t xgyro
,int16_t ygyro
,int16_t zgyro
,int16_t xmag
,int16_t ymag
,int16_t zmag
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf
[MAVLINK_MSG_ID_SCALED_IMU3_LEN
];
144 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
145 _mav_put_int16_t(buf
, 4, xacc
);
146 _mav_put_int16_t(buf
, 6, yacc
);
147 _mav_put_int16_t(buf
, 8, zacc
);
148 _mav_put_int16_t(buf
, 10, xgyro
);
149 _mav_put_int16_t(buf
, 12, ygyro
);
150 _mav_put_int16_t(buf
, 14, zgyro
);
151 _mav_put_int16_t(buf
, 16, xmag
);
152 _mav_put_int16_t(buf
, 18, ymag
);
153 _mav_put_int16_t(buf
, 20, zmag
);
155 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
);
157 mavlink_scaled_imu3_t packet
;
158 packet
.time_boot_ms
= time_boot_ms
;
162 packet
.xgyro
= xgyro
;
163 packet
.ygyro
= ygyro
;
164 packet
.zgyro
= zgyro
;
169 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
);
172 msg
->msgid
= MAVLINK_MSG_ID_SCALED_IMU3
;
173 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
177 * @brief Encode a scaled_imu3 struct
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param msg The MAVLink message to compress the data into
182 * @param scaled_imu3 C-struct to read the message contents from
184 static inline uint16_t mavlink_msg_scaled_imu3_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_scaled_imu3_t
* scaled_imu3
)
186 return mavlink_msg_scaled_imu3_pack(system_id
, component_id
, msg
, scaled_imu3
->time_boot_ms
, scaled_imu3
->xacc
, scaled_imu3
->yacc
, scaled_imu3
->zacc
, scaled_imu3
->xgyro
, scaled_imu3
->ygyro
, scaled_imu3
->zgyro
, scaled_imu3
->xmag
, scaled_imu3
->ymag
, scaled_imu3
->zmag
);
190 * @brief Encode a scaled_imu3 struct on a channel
192 * @param system_id ID of this system
193 * @param component_id ID of this component (e.g. 200 for IMU)
194 * @param chan The MAVLink channel this message will be sent over
195 * @param msg The MAVLink message to compress the data into
196 * @param scaled_imu3 C-struct to read the message contents from
198 static inline uint16_t mavlink_msg_scaled_imu3_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_scaled_imu3_t
* scaled_imu3
)
200 return mavlink_msg_scaled_imu3_pack_chan(system_id
, component_id
, chan
, msg
, scaled_imu3
->time_boot_ms
, scaled_imu3
->xacc
, scaled_imu3
->yacc
, scaled_imu3
->zacc
, scaled_imu3
->xgyro
, scaled_imu3
->ygyro
, scaled_imu3
->zgyro
, scaled_imu3
->xmag
, scaled_imu3
->ymag
, scaled_imu3
->zmag
);
204 * @brief Send a scaled_imu3 message
205 * @param chan MAVLink channel to send the message
207 * @param time_boot_ms Timestamp (milliseconds since system boot)
208 * @param xacc X acceleration (mg)
209 * @param yacc Y acceleration (mg)
210 * @param zacc Z acceleration (mg)
211 * @param xgyro Angular speed around X axis (millirad /sec)
212 * @param ygyro Angular speed around Y axis (millirad /sec)
213 * @param zgyro Angular speed around Z axis (millirad /sec)
214 * @param xmag X Magnetic field (milli tesla)
215 * @param ymag Y Magnetic field (milli tesla)
216 * @param zmag Z Magnetic field (milli tesla)
218 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
220 static inline void mavlink_msg_scaled_imu3_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, int16_t xacc
, int16_t yacc
, int16_t zacc
, int16_t xgyro
, int16_t ygyro
, int16_t zgyro
, int16_t xmag
, int16_t ymag
, int16_t zmag
)
222 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
223 char buf
[MAVLINK_MSG_ID_SCALED_IMU3_LEN
];
224 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
225 _mav_put_int16_t(buf
, 4, xacc
);
226 _mav_put_int16_t(buf
, 6, yacc
);
227 _mav_put_int16_t(buf
, 8, zacc
);
228 _mav_put_int16_t(buf
, 10, xgyro
);
229 _mav_put_int16_t(buf
, 12, ygyro
);
230 _mav_put_int16_t(buf
, 14, zgyro
);
231 _mav_put_int16_t(buf
, 16, xmag
);
232 _mav_put_int16_t(buf
, 18, ymag
);
233 _mav_put_int16_t(buf
, 20, zmag
);
235 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_IMU3
, buf
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
237 mavlink_scaled_imu3_t packet
;
238 packet
.time_boot_ms
= time_boot_ms
;
242 packet
.xgyro
= xgyro
;
243 packet
.ygyro
= ygyro
;
244 packet
.zgyro
= zgyro
;
249 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_IMU3
, (const char *)&packet
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
254 * @brief Send a scaled_imu3 message
255 * @param chan MAVLink channel to send the message
256 * @param struct The MAVLink struct to serialize
258 static inline void mavlink_msg_scaled_imu3_send_struct(mavlink_channel_t chan
, const mavlink_scaled_imu3_t
* scaled_imu3
)
260 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
261 mavlink_msg_scaled_imu3_send(chan
, scaled_imu3
->time_boot_ms
, scaled_imu3
->xacc
, scaled_imu3
->yacc
, scaled_imu3
->zacc
, scaled_imu3
->xgyro
, scaled_imu3
->ygyro
, scaled_imu3
->zgyro
, scaled_imu3
->xmag
, scaled_imu3
->ymag
, scaled_imu3
->zmag
);
263 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_IMU3
, (const char *)scaled_imu3
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
267 #if MAVLINK_MSG_ID_SCALED_IMU3_LEN <= MAVLINK_MAX_PAYLOAD_LEN
269 This varient of _send() can be used to save stack space by re-using
270 memory from the receive buffer. The caller provides a
271 mavlink_message_t which is the size of a full mavlink message. This
272 is usually the receive buffer for the channel, and allows a reply to an
273 incoming message with minimum stack space usage.
275 static inline void mavlink_msg_scaled_imu3_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint32_t time_boot_ms
, int16_t xacc
, int16_t yacc
, int16_t zacc
, int16_t xgyro
, int16_t ygyro
, int16_t zgyro
, int16_t xmag
, int16_t ymag
, int16_t zmag
)
277 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 char *buf
= (char *)msgbuf
;
279 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
280 _mav_put_int16_t(buf
, 4, xacc
);
281 _mav_put_int16_t(buf
, 6, yacc
);
282 _mav_put_int16_t(buf
, 8, zacc
);
283 _mav_put_int16_t(buf
, 10, xgyro
);
284 _mav_put_int16_t(buf
, 12, ygyro
);
285 _mav_put_int16_t(buf
, 14, zgyro
);
286 _mav_put_int16_t(buf
, 16, xmag
);
287 _mav_put_int16_t(buf
, 18, ymag
);
288 _mav_put_int16_t(buf
, 20, zmag
);
290 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_IMU3
, buf
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
292 mavlink_scaled_imu3_t
*packet
= (mavlink_scaled_imu3_t
*)msgbuf
;
293 packet
->time_boot_ms
= time_boot_ms
;
297 packet
->xgyro
= xgyro
;
298 packet
->ygyro
= ygyro
;
299 packet
->zgyro
= zgyro
;
304 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_SCALED_IMU3
, (const char *)packet
, MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_LEN
, MAVLINK_MSG_ID_SCALED_IMU3_CRC
);
311 // MESSAGE SCALED_IMU3 UNPACKING
315 * @brief Get field time_boot_ms from scaled_imu3 message
317 * @return Timestamp (milliseconds since system boot)
319 static inline uint32_t mavlink_msg_scaled_imu3_get_time_boot_ms(const mavlink_message_t
* msg
)
321 return _MAV_RETURN_uint32_t(msg
, 0);
325 * @brief Get field xacc from scaled_imu3 message
327 * @return X acceleration (mg)
329 static inline int16_t mavlink_msg_scaled_imu3_get_xacc(const mavlink_message_t
* msg
)
331 return _MAV_RETURN_int16_t(msg
, 4);
335 * @brief Get field yacc from scaled_imu3 message
337 * @return Y acceleration (mg)
339 static inline int16_t mavlink_msg_scaled_imu3_get_yacc(const mavlink_message_t
* msg
)
341 return _MAV_RETURN_int16_t(msg
, 6);
345 * @brief Get field zacc from scaled_imu3 message
347 * @return Z acceleration (mg)
349 static inline int16_t mavlink_msg_scaled_imu3_get_zacc(const mavlink_message_t
* msg
)
351 return _MAV_RETURN_int16_t(msg
, 8);
355 * @brief Get field xgyro from scaled_imu3 message
357 * @return Angular speed around X axis (millirad /sec)
359 static inline int16_t mavlink_msg_scaled_imu3_get_xgyro(const mavlink_message_t
* msg
)
361 return _MAV_RETURN_int16_t(msg
, 10);
365 * @brief Get field ygyro from scaled_imu3 message
367 * @return Angular speed around Y axis (millirad /sec)
369 static inline int16_t mavlink_msg_scaled_imu3_get_ygyro(const mavlink_message_t
* msg
)
371 return _MAV_RETURN_int16_t(msg
, 12);
375 * @brief Get field zgyro from scaled_imu3 message
377 * @return Angular speed around Z axis (millirad /sec)
379 static inline int16_t mavlink_msg_scaled_imu3_get_zgyro(const mavlink_message_t
* msg
)
381 return _MAV_RETURN_int16_t(msg
, 14);
385 * @brief Get field xmag from scaled_imu3 message
387 * @return X Magnetic field (milli tesla)
389 static inline int16_t mavlink_msg_scaled_imu3_get_xmag(const mavlink_message_t
* msg
)
391 return _MAV_RETURN_int16_t(msg
, 16);
395 * @brief Get field ymag from scaled_imu3 message
397 * @return Y Magnetic field (milli tesla)
399 static inline int16_t mavlink_msg_scaled_imu3_get_ymag(const mavlink_message_t
* msg
)
401 return _MAV_RETURN_int16_t(msg
, 18);
405 * @brief Get field zmag from scaled_imu3 message
407 * @return Z Magnetic field (milli tesla)
409 static inline int16_t mavlink_msg_scaled_imu3_get_zmag(const mavlink_message_t
* msg
)
411 return _MAV_RETURN_int16_t(msg
, 20);
415 * @brief Decode a scaled_imu3 message into a struct
417 * @param msg The message to decode
418 * @param scaled_imu3 C-struct to decode the message contents into
420 static inline void mavlink_msg_scaled_imu3_decode(const mavlink_message_t
* msg
, mavlink_scaled_imu3_t
* scaled_imu3
)
422 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
423 scaled_imu3
->time_boot_ms
= mavlink_msg_scaled_imu3_get_time_boot_ms(msg
);
424 scaled_imu3
->xacc
= mavlink_msg_scaled_imu3_get_xacc(msg
);
425 scaled_imu3
->yacc
= mavlink_msg_scaled_imu3_get_yacc(msg
);
426 scaled_imu3
->zacc
= mavlink_msg_scaled_imu3_get_zacc(msg
);
427 scaled_imu3
->xgyro
= mavlink_msg_scaled_imu3_get_xgyro(msg
);
428 scaled_imu3
->ygyro
= mavlink_msg_scaled_imu3_get_ygyro(msg
);
429 scaled_imu3
->zgyro
= mavlink_msg_scaled_imu3_get_zgyro(msg
);
430 scaled_imu3
->xmag
= mavlink_msg_scaled_imu3_get_xmag(msg
);
431 scaled_imu3
->ymag
= mavlink_msg_scaled_imu3_get_ymag(msg
);
432 scaled_imu3
->zmag
= mavlink_msg_scaled_imu3_get_zmag(msg
);
434 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_SCALED_IMU3_LEN
? msg
->len
: MAVLINK_MSG_ID_SCALED_IMU3_LEN
;
435 memset(scaled_imu3
, 0, MAVLINK_MSG_ID_SCALED_IMU3_LEN
);
436 memcpy(scaled_imu3
, _MAV_PAYLOAD(msg
), len
);