1 | // MESSAGE SCALED_IMU PACKING |
---|
2 | |
---|
3 | #define MAVLINK_MSG_ID_SCALED_IMU 26 |
---|
4 | |
---|
5 | MAVPACKED( |
---|
6 | typedef struct __mavlink_scaled_imu_t { |
---|
7 | uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/ |
---|
8 | int16_t xacc; /*< X acceleration (mg)*/ |
---|
9 | int16_t yacc; /*< Y acceleration (mg)*/ |
---|
10 | int16_t zacc; /*< Z acceleration (mg)*/ |
---|
11 | int16_t xgyro; /*< Angular speed around X axis (millirad /sec)*/ |
---|
12 | int16_t ygyro; /*< Angular speed around Y axis (millirad /sec)*/ |
---|
13 | int16_t zgyro; /*< Angular speed around Z axis (millirad /sec)*/ |
---|
14 | int16_t xmag; /*< X Magnetic field (milli tesla)*/ |
---|
15 | int16_t ymag; /*< Y Magnetic field (milli tesla)*/ |
---|
16 | int16_t zmag; /*< Z Magnetic field (milli tesla)*/ |
---|
17 | }) mavlink_scaled_imu_t; |
---|
18 | |
---|
19 | #define MAVLINK_MSG_ID_SCALED_IMU_LEN 22 |
---|
20 | #define MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN 22 |
---|
21 | #define MAVLINK_MSG_ID_26_LEN 22 |
---|
22 | #define MAVLINK_MSG_ID_26_MIN_LEN 22 |
---|
23 | |
---|
24 | #define MAVLINK_MSG_ID_SCALED_IMU_CRC 170 |
---|
25 | #define MAVLINK_MSG_ID_26_CRC 170 |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | #if MAVLINK_COMMAND_24BIT |
---|
30 | #define MAVLINK_MESSAGE_INFO_SCALED_IMU { \ |
---|
31 | 26, \ |
---|
32 | "SCALED_IMU", \ |
---|
33 | 10, \ |
---|
34 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu_t, time_boot_ms) }, \ |
---|
35 | { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu_t, xacc) }, \ |
---|
36 | { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu_t, yacc) }, \ |
---|
37 | { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu_t, zacc) }, \ |
---|
38 | { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu_t, xgyro) }, \ |
---|
39 | { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu_t, ygyro) }, \ |
---|
40 | { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu_t, zgyro) }, \ |
---|
41 | { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu_t, xmag) }, \ |
---|
42 | { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu_t, ymag) }, \ |
---|
43 | { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu_t, zmag) }, \ |
---|
44 | } \ |
---|
45 | } |
---|
46 | #else |
---|
47 | #define MAVLINK_MESSAGE_INFO_SCALED_IMU { \ |
---|
48 | "SCALED_IMU", \ |
---|
49 | 10, \ |
---|
50 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu_t, time_boot_ms) }, \ |
---|
51 | { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu_t, xacc) }, \ |
---|
52 | { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu_t, yacc) }, \ |
---|
53 | { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu_t, zacc) }, \ |
---|
54 | { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu_t, xgyro) }, \ |
---|
55 | { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu_t, ygyro) }, \ |
---|
56 | { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu_t, zgyro) }, \ |
---|
57 | { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu_t, xmag) }, \ |
---|
58 | { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu_t, ymag) }, \ |
---|
59 | { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu_t, zmag) }, \ |
---|
60 | } \ |
---|
61 | } |
---|
62 | #endif |
---|
63 | |
---|
64 | /** |
---|
65 | * @brief Pack a scaled_imu message |
---|
66 | * @param system_id ID of this system |
---|
67 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
68 | * @param msg The MAVLink message to compress the data into |
---|
69 | * |
---|
70 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
---|
71 | * @param xacc X acceleration (mg) |
---|
72 | * @param yacc Y acceleration (mg) |
---|
73 | * @param zacc Z acceleration (mg) |
---|
74 | * @param xgyro Angular speed around X axis (millirad /sec) |
---|
75 | * @param ygyro Angular speed around Y axis (millirad /sec) |
---|
76 | * @param zgyro Angular speed around Z axis (millirad /sec) |
---|
77 | * @param xmag X Magnetic field (milli tesla) |
---|
78 | * @param ymag Y Magnetic field (milli tesla) |
---|
79 | * @param zmag Z Magnetic field (milli tesla) |
---|
80 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
81 | */ |
---|
82 | static inline uint16_t mavlink_msg_scaled_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
---|
83 | 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) |
---|
84 | { |
---|
85 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
86 | char buf[MAVLINK_MSG_ID_SCALED_IMU_LEN]; |
---|
87 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
---|
88 | _mav_put_int16_t(buf, 4, xacc); |
---|
89 | _mav_put_int16_t(buf, 6, yacc); |
---|
90 | _mav_put_int16_t(buf, 8, zacc); |
---|
91 | _mav_put_int16_t(buf, 10, xgyro); |
---|
92 | _mav_put_int16_t(buf, 12, ygyro); |
---|
93 | _mav_put_int16_t(buf, 14, zgyro); |
---|
94 | _mav_put_int16_t(buf, 16, xmag); |
---|
95 | _mav_put_int16_t(buf, 18, ymag); |
---|
96 | _mav_put_int16_t(buf, 20, zmag); |
---|
97 | |
---|
98 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU_LEN); |
---|
99 | #else |
---|
100 | mavlink_scaled_imu_t packet; |
---|
101 | packet.time_boot_ms = time_boot_ms; |
---|
102 | packet.xacc = xacc; |
---|
103 | packet.yacc = yacc; |
---|
104 | packet.zacc = zacc; |
---|
105 | packet.xgyro = xgyro; |
---|
106 | packet.ygyro = ygyro; |
---|
107 | packet.zgyro = zgyro; |
---|
108 | packet.xmag = xmag; |
---|
109 | packet.ymag = ymag; |
---|
110 | packet.zmag = zmag; |
---|
111 | |
---|
112 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU_LEN); |
---|
113 | #endif |
---|
114 | |
---|
115 | msg->msgid = MAVLINK_MSG_ID_SCALED_IMU; |
---|
116 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
117 | } |
---|
118 | |
---|
119 | /** |
---|
120 | * @brief Pack a scaled_imu message on a channel |
---|
121 | * @param system_id ID of this system |
---|
122 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
123 | * @param chan The MAVLink channel this message will be sent over |
---|
124 | * @param msg The MAVLink message to compress the data into |
---|
125 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
---|
126 | * @param xacc X acceleration (mg) |
---|
127 | * @param yacc Y acceleration (mg) |
---|
128 | * @param zacc Z acceleration (mg) |
---|
129 | * @param xgyro Angular speed around X axis (millirad /sec) |
---|
130 | * @param ygyro Angular speed around Y axis (millirad /sec) |
---|
131 | * @param zgyro Angular speed around Z axis (millirad /sec) |
---|
132 | * @param xmag X Magnetic field (milli tesla) |
---|
133 | * @param ymag Y Magnetic field (milli tesla) |
---|
134 | * @param zmag Z Magnetic field (milli tesla) |
---|
135 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
136 | */ |
---|
137 | static inline uint16_t mavlink_msg_scaled_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
---|
138 | mavlink_message_t* msg, |
---|
139 | 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) |
---|
140 | { |
---|
141 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
142 | char buf[MAVLINK_MSG_ID_SCALED_IMU_LEN]; |
---|
143 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
---|
144 | _mav_put_int16_t(buf, 4, xacc); |
---|
145 | _mav_put_int16_t(buf, 6, yacc); |
---|
146 | _mav_put_int16_t(buf, 8, zacc); |
---|
147 | _mav_put_int16_t(buf, 10, xgyro); |
---|
148 | _mav_put_int16_t(buf, 12, ygyro); |
---|
149 | _mav_put_int16_t(buf, 14, zgyro); |
---|
150 | _mav_put_int16_t(buf, 16, xmag); |
---|
151 | _mav_put_int16_t(buf, 18, ymag); |
---|
152 | _mav_put_int16_t(buf, 20, zmag); |
---|
153 | |
---|
154 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU_LEN); |
---|
155 | #else |
---|
156 | mavlink_scaled_imu_t packet; |
---|
157 | packet.time_boot_ms = time_boot_ms; |
---|
158 | packet.xacc = xacc; |
---|
159 | packet.yacc = yacc; |
---|
160 | packet.zacc = zacc; |
---|
161 | packet.xgyro = xgyro; |
---|
162 | packet.ygyro = ygyro; |
---|
163 | packet.zgyro = zgyro; |
---|
164 | packet.xmag = xmag; |
---|
165 | packet.ymag = ymag; |
---|
166 | packet.zmag = zmag; |
---|
167 | |
---|
168 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU_LEN); |
---|
169 | #endif |
---|
170 | |
---|
171 | msg->msgid = MAVLINK_MSG_ID_SCALED_IMU; |
---|
172 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
173 | } |
---|
174 | |
---|
175 | /** |
---|
176 | * @brief Encode a scaled_imu struct |
---|
177 | * |
---|
178 | * @param system_id ID of this system |
---|
179 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
180 | * @param msg The MAVLink message to compress the data into |
---|
181 | * @param scaled_imu C-struct to read the message contents from |
---|
182 | */ |
---|
183 | static inline uint16_t mavlink_msg_scaled_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_imu_t* scaled_imu) |
---|
184 | { |
---|
185 | return mavlink_msg_scaled_imu_pack(system_id, component_id, msg, scaled_imu->time_boot_ms, scaled_imu->xacc, scaled_imu->yacc, scaled_imu->zacc, scaled_imu->xgyro, scaled_imu->ygyro, scaled_imu->zgyro, scaled_imu->xmag, scaled_imu->ymag, scaled_imu->zmag); |
---|
186 | } |
---|
187 | |
---|
188 | /** |
---|
189 | * @brief Encode a scaled_imu struct on a channel |
---|
190 | * |
---|
191 | * @param system_id ID of this system |
---|
192 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
193 | * @param chan The MAVLink channel this message will be sent over |
---|
194 | * @param msg The MAVLink message to compress the data into |
---|
195 | * @param scaled_imu C-struct to read the message contents from |
---|
196 | */ |
---|
197 | static inline uint16_t mavlink_msg_scaled_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_imu_t* scaled_imu) |
---|
198 | { |
---|
199 | return mavlink_msg_scaled_imu_pack_chan(system_id, component_id, chan, msg, scaled_imu->time_boot_ms, scaled_imu->xacc, scaled_imu->yacc, scaled_imu->zacc, scaled_imu->xgyro, scaled_imu->ygyro, scaled_imu->zgyro, scaled_imu->xmag, scaled_imu->ymag, scaled_imu->zmag); |
---|
200 | } |
---|
201 | |
---|
202 | /** |
---|
203 | * @brief Send a scaled_imu message |
---|
204 | * @param chan MAVLink channel to send the message |
---|
205 | * |
---|
206 | * @param time_boot_ms Timestamp (milliseconds since system boot) |
---|
207 | * @param xacc X acceleration (mg) |
---|
208 | * @param yacc Y acceleration (mg) |
---|
209 | * @param zacc Z acceleration (mg) |
---|
210 | * @param xgyro Angular speed around X axis (millirad /sec) |
---|
211 | * @param ygyro Angular speed around Y axis (millirad /sec) |
---|
212 | * @param zgyro Angular speed around Z axis (millirad /sec) |
---|
213 | * @param xmag X Magnetic field (milli tesla) |
---|
214 | * @param ymag Y Magnetic field (milli tesla) |
---|
215 | * @param zmag Z Magnetic field (milli tesla) |
---|
216 | */ |
---|
217 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
---|
218 | |
---|
219 | static inline void mavlink_msg_scaled_imu_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) |
---|
220 | { |
---|
221 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
222 | char buf[MAVLINK_MSG_ID_SCALED_IMU_LEN]; |
---|
223 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
---|
224 | _mav_put_int16_t(buf, 4, xacc); |
---|
225 | _mav_put_int16_t(buf, 6, yacc); |
---|
226 | _mav_put_int16_t(buf, 8, zacc); |
---|
227 | _mav_put_int16_t(buf, 10, xgyro); |
---|
228 | _mav_put_int16_t(buf, 12, ygyro); |
---|
229 | _mav_put_int16_t(buf, 14, zgyro); |
---|
230 | _mav_put_int16_t(buf, 16, xmag); |
---|
231 | _mav_put_int16_t(buf, 18, ymag); |
---|
232 | _mav_put_int16_t(buf, 20, zmag); |
---|
233 | |
---|
234 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU, buf, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
235 | #else |
---|
236 | mavlink_scaled_imu_t packet; |
---|
237 | packet.time_boot_ms = time_boot_ms; |
---|
238 | packet.xacc = xacc; |
---|
239 | packet.yacc = yacc; |
---|
240 | packet.zacc = zacc; |
---|
241 | packet.xgyro = xgyro; |
---|
242 | packet.ygyro = ygyro; |
---|
243 | packet.zgyro = zgyro; |
---|
244 | packet.xmag = xmag; |
---|
245 | packet.ymag = ymag; |
---|
246 | packet.zmag = zmag; |
---|
247 | |
---|
248 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU, (const char *)&packet, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
249 | #endif |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * @brief Send a scaled_imu message |
---|
254 | * @param chan MAVLink channel to send the message |
---|
255 | * @param struct The MAVLink struct to serialize |
---|
256 | */ |
---|
257 | static inline void mavlink_msg_scaled_imu_send_struct(mavlink_channel_t chan, const mavlink_scaled_imu_t* scaled_imu) |
---|
258 | { |
---|
259 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
260 | mavlink_msg_scaled_imu_send(chan, scaled_imu->time_boot_ms, scaled_imu->xacc, scaled_imu->yacc, scaled_imu->zacc, scaled_imu->xgyro, scaled_imu->ygyro, scaled_imu->zgyro, scaled_imu->xmag, scaled_imu->ymag, scaled_imu->zmag); |
---|
261 | #else |
---|
262 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU, (const char *)scaled_imu, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
263 | #endif |
---|
264 | } |
---|
265 | |
---|
266 | #if MAVLINK_MSG_ID_SCALED_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN |
---|
267 | /* |
---|
268 | This varient of _send() can be used to save stack space by re-using |
---|
269 | memory from the receive buffer. The caller provides a |
---|
270 | mavlink_message_t which is the size of a full mavlink message. This |
---|
271 | is usually the receive buffer for the channel, and allows a reply to an |
---|
272 | incoming message with minimum stack space usage. |
---|
273 | */ |
---|
274 | static inline void mavlink_msg_scaled_imu_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) |
---|
275 | { |
---|
276 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
277 | char *buf = (char *)msgbuf; |
---|
278 | _mav_put_uint32_t(buf, 0, time_boot_ms); |
---|
279 | _mav_put_int16_t(buf, 4, xacc); |
---|
280 | _mav_put_int16_t(buf, 6, yacc); |
---|
281 | _mav_put_int16_t(buf, 8, zacc); |
---|
282 | _mav_put_int16_t(buf, 10, xgyro); |
---|
283 | _mav_put_int16_t(buf, 12, ygyro); |
---|
284 | _mav_put_int16_t(buf, 14, zgyro); |
---|
285 | _mav_put_int16_t(buf, 16, xmag); |
---|
286 | _mav_put_int16_t(buf, 18, ymag); |
---|
287 | _mav_put_int16_t(buf, 20, zmag); |
---|
288 | |
---|
289 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU, buf, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
290 | #else |
---|
291 | mavlink_scaled_imu_t *packet = (mavlink_scaled_imu_t *)msgbuf; |
---|
292 | packet->time_boot_ms = time_boot_ms; |
---|
293 | packet->xacc = xacc; |
---|
294 | packet->yacc = yacc; |
---|
295 | packet->zacc = zacc; |
---|
296 | packet->xgyro = xgyro; |
---|
297 | packet->ygyro = ygyro; |
---|
298 | packet->zgyro = zgyro; |
---|
299 | packet->xmag = xmag; |
---|
300 | packet->ymag = ymag; |
---|
301 | packet->zmag = zmag; |
---|
302 | |
---|
303 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU, (const char *)packet, MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN, MAVLINK_MSG_ID_SCALED_IMU_LEN, MAVLINK_MSG_ID_SCALED_IMU_CRC); |
---|
304 | #endif |
---|
305 | } |
---|
306 | #endif |
---|
307 | |
---|
308 | #endif |
---|
309 | |
---|
310 | // MESSAGE SCALED_IMU UNPACKING |
---|
311 | |
---|
312 | |
---|
313 | /** |
---|
314 | * @brief Get field time_boot_ms from scaled_imu message |
---|
315 | * |
---|
316 | * @return Timestamp (milliseconds since system boot) |
---|
317 | */ |
---|
318 | static inline uint32_t mavlink_msg_scaled_imu_get_time_boot_ms(const mavlink_message_t* msg) |
---|
319 | { |
---|
320 | return _MAV_RETURN_uint32_t(msg, 0); |
---|
321 | } |
---|
322 | |
---|
323 | /** |
---|
324 | * @brief Get field xacc from scaled_imu message |
---|
325 | * |
---|
326 | * @return X acceleration (mg) |
---|
327 | */ |
---|
328 | static inline int16_t mavlink_msg_scaled_imu_get_xacc(const mavlink_message_t* msg) |
---|
329 | { |
---|
330 | return _MAV_RETURN_int16_t(msg, 4); |
---|
331 | } |
---|
332 | |
---|
333 | /** |
---|
334 | * @brief Get field yacc from scaled_imu message |
---|
335 | * |
---|
336 | * @return Y acceleration (mg) |
---|
337 | */ |
---|
338 | static inline int16_t mavlink_msg_scaled_imu_get_yacc(const mavlink_message_t* msg) |
---|
339 | { |
---|
340 | return _MAV_RETURN_int16_t(msg, 6); |
---|
341 | } |
---|
342 | |
---|
343 | /** |
---|
344 | * @brief Get field zacc from scaled_imu message |
---|
345 | * |
---|
346 | * @return Z acceleration (mg) |
---|
347 | */ |
---|
348 | static inline int16_t mavlink_msg_scaled_imu_get_zacc(const mavlink_message_t* msg) |
---|
349 | { |
---|
350 | return _MAV_RETURN_int16_t(msg, 8); |
---|
351 | } |
---|
352 | |
---|
353 | /** |
---|
354 | * @brief Get field xgyro from scaled_imu message |
---|
355 | * |
---|
356 | * @return Angular speed around X axis (millirad /sec) |
---|
357 | */ |
---|
358 | static inline int16_t mavlink_msg_scaled_imu_get_xgyro(const mavlink_message_t* msg) |
---|
359 | { |
---|
360 | return _MAV_RETURN_int16_t(msg, 10); |
---|
361 | } |
---|
362 | |
---|
363 | /** |
---|
364 | * @brief Get field ygyro from scaled_imu message |
---|
365 | * |
---|
366 | * @return Angular speed around Y axis (millirad /sec) |
---|
367 | */ |
---|
368 | static inline int16_t mavlink_msg_scaled_imu_get_ygyro(const mavlink_message_t* msg) |
---|
369 | { |
---|
370 | return _MAV_RETURN_int16_t(msg, 12); |
---|
371 | } |
---|
372 | |
---|
373 | /** |
---|
374 | * @brief Get field zgyro from scaled_imu message |
---|
375 | * |
---|
376 | * @return Angular speed around Z axis (millirad /sec) |
---|
377 | */ |
---|
378 | static inline int16_t mavlink_msg_scaled_imu_get_zgyro(const mavlink_message_t* msg) |
---|
379 | { |
---|
380 | return _MAV_RETURN_int16_t(msg, 14); |
---|
381 | } |
---|
382 | |
---|
383 | /** |
---|
384 | * @brief Get field xmag from scaled_imu message |
---|
385 | * |
---|
386 | * @return X Magnetic field (milli tesla) |
---|
387 | */ |
---|
388 | static inline int16_t mavlink_msg_scaled_imu_get_xmag(const mavlink_message_t* msg) |
---|
389 | { |
---|
390 | return _MAV_RETURN_int16_t(msg, 16); |
---|
391 | } |
---|
392 | |
---|
393 | /** |
---|
394 | * @brief Get field ymag from scaled_imu message |
---|
395 | * |
---|
396 | * @return Y Magnetic field (milli tesla) |
---|
397 | */ |
---|
398 | static inline int16_t mavlink_msg_scaled_imu_get_ymag(const mavlink_message_t* msg) |
---|
399 | { |
---|
400 | return _MAV_RETURN_int16_t(msg, 18); |
---|
401 | } |
---|
402 | |
---|
403 | /** |
---|
404 | * @brief Get field zmag from scaled_imu message |
---|
405 | * |
---|
406 | * @return Z Magnetic field (milli tesla) |
---|
407 | */ |
---|
408 | static inline int16_t mavlink_msg_scaled_imu_get_zmag(const mavlink_message_t* msg) |
---|
409 | { |
---|
410 | return _MAV_RETURN_int16_t(msg, 20); |
---|
411 | } |
---|
412 | |
---|
413 | /** |
---|
414 | * @brief Decode a scaled_imu message into a struct |
---|
415 | * |
---|
416 | * @param msg The message to decode |
---|
417 | * @param scaled_imu C-struct to decode the message contents into |
---|
418 | */ |
---|
419 | static inline void mavlink_msg_scaled_imu_decode(const mavlink_message_t* msg, mavlink_scaled_imu_t* scaled_imu) |
---|
420 | { |
---|
421 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
422 | scaled_imu->time_boot_ms = mavlink_msg_scaled_imu_get_time_boot_ms(msg); |
---|
423 | scaled_imu->xacc = mavlink_msg_scaled_imu_get_xacc(msg); |
---|
424 | scaled_imu->yacc = mavlink_msg_scaled_imu_get_yacc(msg); |
---|
425 | scaled_imu->zacc = mavlink_msg_scaled_imu_get_zacc(msg); |
---|
426 | scaled_imu->xgyro = mavlink_msg_scaled_imu_get_xgyro(msg); |
---|
427 | scaled_imu->ygyro = mavlink_msg_scaled_imu_get_ygyro(msg); |
---|
428 | scaled_imu->zgyro = mavlink_msg_scaled_imu_get_zgyro(msg); |
---|
429 | scaled_imu->xmag = mavlink_msg_scaled_imu_get_xmag(msg); |
---|
430 | scaled_imu->ymag = mavlink_msg_scaled_imu_get_ymag(msg); |
---|
431 | scaled_imu->zmag = mavlink_msg_scaled_imu_get_zmag(msg); |
---|
432 | #else |
---|
433 | uint8_t len = msg->len < MAVLINK_MSG_ID_SCALED_IMU_LEN? msg->len : MAVLINK_MSG_ID_SCALED_IMU_LEN; |
---|
434 | memset(scaled_imu, 0, MAVLINK_MSG_ID_SCALED_IMU_LEN); |
---|
435 | memcpy(scaled_imu, _MAV_PAYLOAD(msg), len); |
---|
436 | #endif |
---|
437 | } |
---|