Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_highres_imu.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE HIGHRES_IMU PACKING
3
4#define MAVLINK_MSG_ID_HIGHRES_IMU 105
5
6
7typedef struct __mavlink_highres_imu_t {
8 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 float xacc; /*< [m/s/s] X acceleration*/
10 float yacc; /*< [m/s/s] Y acceleration*/
11 float zacc; /*< [m/s/s] Z acceleration*/
12 float xgyro; /*< [rad/s] Angular speed around X axis*/
13 float ygyro; /*< [rad/s] Angular speed around Y axis*/
14 float zgyro; /*< [rad/s] Angular speed around Z axis*/
15 float xmag; /*< [gauss] X Magnetic field*/
16 float ymag; /*< [gauss] Y Magnetic field*/
17 float zmag; /*< [gauss] Z Magnetic field*/
18 float abs_pressure; /*< [hPa] Absolute pressure*/
19 float diff_pressure; /*< [hPa] Differential pressure*/
20 float pressure_alt; /*< Altitude calculated from pressure*/
21 float temperature; /*< [degC] Temperature*/
22 uint16_t fields_updated; /*< Bitmap for fields that have updated since last message*/
23 uint8_t id; /*< Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)*/
24} mavlink_highres_imu_t;
25
26#define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 63
27#define MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN 62
28#define MAVLINK_MSG_ID_105_LEN 63
29#define MAVLINK_MSG_ID_105_MIN_LEN 62
30
31#define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
32#define MAVLINK_MSG_ID_105_CRC 93
33
34
35
36#if MAVLINK_COMMAND_24BIT
37#define MAVLINK_MESSAGE_INFO_HIGHRES_IMU {
38 105,
39 "HIGHRES_IMU",
40 16,
41 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) },
42 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) },
43 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) },
44 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) },
45 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) },
46 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) },
47 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) },
48 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) },
49 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) },
50 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) },
51 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) },
52 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) },
53 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) },
54 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) },
55 { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) },
56 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_highres_imu_t, id) },
57 } \
58}
59#else
60#define MAVLINK_MESSAGE_INFO_HIGHRES_IMU {
61 "HIGHRES_IMU",
62 16,
63 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) },
64 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) },
65 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) },
66 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) },
67 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) },
68 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) },
69 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) },
70 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) },
71 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) },
72 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) },
73 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) },
74 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) },
75 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) },
76 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) },
77 { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) },
78 { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_highres_imu_t, id) },
79 } \
80}
81#endif
82
83/**
84 * @brief Pack a highres_imu message
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param msg The MAVLink message to compress the data into
88 *
89 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
90 * @param xacc [m/s/s] X acceleration
91 * @param yacc [m/s/s] Y acceleration
92 * @param zacc [m/s/s] Z acceleration
93 * @param xgyro [rad/s] Angular speed around X axis
94 * @param ygyro [rad/s] Angular speed around Y axis
95 * @param zgyro [rad/s] Angular speed around Z axis
96 * @param xmag [gauss] X Magnetic field
97 * @param ymag [gauss] Y Magnetic field
98 * @param zmag [gauss] Z Magnetic field
99 * @param abs_pressure [hPa] Absolute pressure
100 * @param diff_pressure [hPa] Differential pressure
101 * @param pressure_alt Altitude calculated from pressure
102 * @param temperature [degC] Temperature
103 * @param fields_updated Bitmap for fields that have updated since last message
104 * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
105 * @return length of the message in bytes (excluding serial stream start sign)
106 */
107static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
108 uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
109{
110#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
112 _mav_put_uint64_t(buf, 0, time_usec);
113 _mav_put_float(buf, 8, xacc);
114 _mav_put_float(buf, 12, yacc);
115 _mav_put_float(buf, 16, zacc);
116 _mav_put_float(buf, 20, xgyro);
117 _mav_put_float(buf, 24, ygyro);
118 _mav_put_float(buf, 28, zgyro);
119 _mav_put_float(buf, 32, xmag);
120 _mav_put_float(buf, 36, ymag);
121 _mav_put_float(buf, 40, zmag);
122 _mav_put_float(buf, 44, abs_pressure);
123 _mav_put_float(buf, 48, diff_pressure);
124 _mav_put_float(buf, 52, pressure_alt);
125 _mav_put_float(buf, 56, temperature);
126 _mav_put_uint16_t(buf, 60, fields_updated);
127 _mav_put_uint8_t(buf, 62, id);
128
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
130#else
131 mavlink_highres_imu_t packet;
132 packet.time_usec = time_usec;
133 packet.xacc = xacc;
134 packet.yacc = yacc;
135 packet.zacc = zacc;
136 packet.xgyro = xgyro;
137 packet.ygyro = ygyro;
138 packet.zgyro = zgyro;
139 packet.xmag = xmag;
140 packet.ymag = ymag;
141 packet.zmag = zmag;
142 packet.abs_pressure = abs_pressure;
143 packet.diff_pressure = diff_pressure;
144 packet.pressure_alt = pressure_alt;
145 packet.temperature = temperature;
146 packet.fields_updated = fields_updated;
147 packet.id = id;
148
149 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
150#endif
151
152 msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
153 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
154}
155
156/**
157 * @brief Pack a highres_imu message
158 * @param system_id ID of this system
159 * @param component_id ID of this component (e.g. 200 for IMU)
160 * @param status MAVLink status structure
161 * @param msg The MAVLink message to compress the data into
162 *
163 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
164 * @param xacc [m/s/s] X acceleration
165 * @param yacc [m/s/s] Y acceleration
166 * @param zacc [m/s/s] Z acceleration
167 * @param xgyro [rad/s] Angular speed around X axis
168 * @param ygyro [rad/s] Angular speed around Y axis
169 * @param zgyro [rad/s] Angular speed around Z axis
170 * @param xmag [gauss] X Magnetic field
171 * @param ymag [gauss] Y Magnetic field
172 * @param zmag [gauss] Z Magnetic field
173 * @param abs_pressure [hPa] Absolute pressure
174 * @param diff_pressure [hPa] Differential pressure
175 * @param pressure_alt Altitude calculated from pressure
176 * @param temperature [degC] Temperature
177 * @param fields_updated Bitmap for fields that have updated since last message
178 * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
179 * @return length of the message in bytes (excluding serial stream start sign)
180 */
181static inline uint16_t mavlink_msg_highres_imu_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
182 uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
183{
184#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
186 _mav_put_uint64_t(buf, 0, time_usec);
187 _mav_put_float(buf, 8, xacc);
188 _mav_put_float(buf, 12, yacc);
189 _mav_put_float(buf, 16, zacc);
190 _mav_put_float(buf, 20, xgyro);
191 _mav_put_float(buf, 24, ygyro);
192 _mav_put_float(buf, 28, zgyro);
193 _mav_put_float(buf, 32, xmag);
194 _mav_put_float(buf, 36, ymag);
195 _mav_put_float(buf, 40, zmag);
196 _mav_put_float(buf, 44, abs_pressure);
197 _mav_put_float(buf, 48, diff_pressure);
198 _mav_put_float(buf, 52, pressure_alt);
199 _mav_put_float(buf, 56, temperature);
200 _mav_put_uint16_t(buf, 60, fields_updated);
201 _mav_put_uint8_t(buf, 62, id);
202
203 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
204#else
205 mavlink_highres_imu_t packet;
206 packet.time_usec = time_usec;
207 packet.xacc = xacc;
208 packet.yacc = yacc;
209 packet.zacc = zacc;
210 packet.xgyro = xgyro;
211 packet.ygyro = ygyro;
212 packet.zgyro = zgyro;
213 packet.xmag = xmag;
214 packet.ymag = ymag;
215 packet.zmag = zmag;
216 packet.abs_pressure = abs_pressure;
217 packet.diff_pressure = diff_pressure;
218 packet.pressure_alt = pressure_alt;
219 packet.temperature = temperature;
220 packet.fields_updated = fields_updated;
221 packet.id = id;
222
223 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
224#endif
225
226 msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
227#if MAVLINK_CRC_EXTRA
228 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
229#else
230 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
231#endif
232}
233
234/**
235 * @brief Pack a highres_imu message on a channel
236 * @param system_id ID of this system
237 * @param component_id ID of this component (e.g. 200 for IMU)
238 * @param chan The MAVLink channel this message will be sent over
239 * @param msg The MAVLink message to compress the data into
240 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
241 * @param xacc [m/s/s] X acceleration
242 * @param yacc [m/s/s] Y acceleration
243 * @param zacc [m/s/s] Z acceleration
244 * @param xgyro [rad/s] Angular speed around X axis
245 * @param ygyro [rad/s] Angular speed around Y axis
246 * @param zgyro [rad/s] Angular speed around Z axis
247 * @param xmag [gauss] X Magnetic field
248 * @param ymag [gauss] Y Magnetic field
249 * @param zmag [gauss] Z Magnetic field
250 * @param abs_pressure [hPa] Absolute pressure
251 * @param diff_pressure [hPa] Differential pressure
252 * @param pressure_alt Altitude calculated from pressure
253 * @param temperature [degC] Temperature
254 * @param fields_updated Bitmap for fields that have updated since last message
255 * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
256 * @return length of the message in bytes (excluding serial stream start sign)
257 */
258static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
259 mavlink_message_t* msg,
260 uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint16_t fields_updated,uint8_t id)
261{
262#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
264 _mav_put_uint64_t(buf, 0, time_usec);
265 _mav_put_float(buf, 8, xacc);
266 _mav_put_float(buf, 12, yacc);
267 _mav_put_float(buf, 16, zacc);
268 _mav_put_float(buf, 20, xgyro);
269 _mav_put_float(buf, 24, ygyro);
270 _mav_put_float(buf, 28, zgyro);
271 _mav_put_float(buf, 32, xmag);
272 _mav_put_float(buf, 36, ymag);
273 _mav_put_float(buf, 40, zmag);
274 _mav_put_float(buf, 44, abs_pressure);
275 _mav_put_float(buf, 48, diff_pressure);
276 _mav_put_float(buf, 52, pressure_alt);
277 _mav_put_float(buf, 56, temperature);
278 _mav_put_uint16_t(buf, 60, fields_updated);
279 _mav_put_uint8_t(buf, 62, id);
280
281 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
282#else
283 mavlink_highres_imu_t packet;
284 packet.time_usec = time_usec;
285 packet.xacc = xacc;
286 packet.yacc = yacc;
287 packet.zacc = zacc;
288 packet.xgyro = xgyro;
289 packet.ygyro = ygyro;
290 packet.zgyro = zgyro;
291 packet.xmag = xmag;
292 packet.ymag = ymag;
293 packet.zmag = zmag;
294 packet.abs_pressure = abs_pressure;
295 packet.diff_pressure = diff_pressure;
296 packet.pressure_alt = pressure_alt;
297 packet.temperature = temperature;
298 packet.fields_updated = fields_updated;
299 packet.id = id;
300
301 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
302#endif
303
304 msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
305 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
306}
307
308/**
309 * @brief Encode a highres_imu struct
310 *
311 * @param system_id ID of this system
312 * @param component_id ID of this component (e.g. 200 for IMU)
313 * @param msg The MAVLink message to compress the data into
314 * @param highres_imu C-struct to read the message contents from
315 */
316static inline uint16_t mavlink_msg_highres_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
317{
318 return mavlink_msg_highres_imu_pack(system_id, component_id, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
319}
320
321/**
322 * @brief Encode a highres_imu struct on a channel
323 *
324 * @param system_id ID of this system
325 * @param component_id ID of this component (e.g. 200 for IMU)
326 * @param chan The MAVLink channel this message will be sent over
327 * @param msg The MAVLink message to compress the data into
328 * @param highres_imu C-struct to read the message contents from
329 */
330static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
331{
332 return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
333}
334
335/**
336 * @brief Encode a highres_imu struct with provided status structure
337 *
338 * @param system_id ID of this system
339 * @param component_id ID of this component (e.g. 200 for IMU)
340 * @param status MAVLink status structure
341 * @param msg The MAVLink message to compress the data into
342 * @param highres_imu C-struct to read the message contents from
343 */
344static inline uint16_t mavlink_msg_highres_imu_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
345{
346 return mavlink_msg_highres_imu_pack_status(system_id, component_id, _status, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
347}
348
349/**
350 * @brief Send a highres_imu message
351 * @param chan MAVLink channel to send the message
352 *
353 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
354 * @param xacc [m/s/s] X acceleration
355 * @param yacc [m/s/s] Y acceleration
356 * @param zacc [m/s/s] Z acceleration
357 * @param xgyro [rad/s] Angular speed around X axis
358 * @param ygyro [rad/s] Angular speed around Y axis
359 * @param zgyro [rad/s] Angular speed around Z axis
360 * @param xmag [gauss] X Magnetic field
361 * @param ymag [gauss] Y Magnetic field
362 * @param zmag [gauss] Z Magnetic field
363 * @param abs_pressure [hPa] Absolute pressure
364 * @param diff_pressure [hPa] Differential pressure
365 * @param pressure_alt Altitude calculated from pressure
366 * @param temperature [degC] Temperature
367 * @param fields_updated Bitmap for fields that have updated since last message
368 * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
369 */
370#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
371
372static inline void mavlink_msg_highres_imu_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
373{
374#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
376 _mav_put_uint64_t(buf, 0, time_usec);
377 _mav_put_float(buf, 8, xacc);
378 _mav_put_float(buf, 12, yacc);
379 _mav_put_float(buf, 16, zacc);
380 _mav_put_float(buf, 20, xgyro);
381 _mav_put_float(buf, 24, ygyro);
382 _mav_put_float(buf, 28, zgyro);
383 _mav_put_float(buf, 32, xmag);
384 _mav_put_float(buf, 36, ymag);
385 _mav_put_float(buf, 40, zmag);
386 _mav_put_float(buf, 44, abs_pressure);
387 _mav_put_float(buf, 48, diff_pressure);
388 _mav_put_float(buf, 52, pressure_alt);
389 _mav_put_float(buf, 56, temperature);
390 _mav_put_uint16_t(buf, 60, fields_updated);
391 _mav_put_uint8_t(buf, 62, id);
392
393 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
394#else
395 mavlink_highres_imu_t packet;
396 packet.time_usec = time_usec;
397 packet.xacc = xacc;
398 packet.yacc = yacc;
399 packet.zacc = zacc;
400 packet.xgyro = xgyro;
401 packet.ygyro = ygyro;
402 packet.zgyro = zgyro;
403 packet.xmag = xmag;
404 packet.ymag = ymag;
405 packet.zmag = zmag;
406 packet.abs_pressure = abs_pressure;
407 packet.diff_pressure = diff_pressure;
408 packet.pressure_alt = pressure_alt;
409 packet.temperature = temperature;
410 packet.fields_updated = fields_updated;
411 packet.id = id;
412
413 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
414#endif
415}
416
417/**
418 * @brief Send a highres_imu message
419 * @param chan MAVLink channel to send the message
420 * @param struct The MAVLink struct to serialize
421 */
422static inline void mavlink_msg_highres_imu_send_struct(mavlink_channel_t chan, const mavlink_highres_imu_t* highres_imu)
423{
424#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
425 mavlink_msg_highres_imu_send(chan, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
426#else
427 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)highres_imu, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
428#endif
429}
430
431#if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
432/*
433 This variant of _send() can be used to save stack space by reusing
434 memory from the receive buffer. The caller provides a
435 mavlink_message_t which is the size of a full mavlink message. This
436 is usually the receive buffer for the channel, and allows a reply to an
437 incoming message with minimum stack space usage.
438 */
439static inline void mavlink_msg_highres_imu_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
440{
441#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
442 char *buf = (char *)msgbuf;
443 _mav_put_uint64_t(buf, 0, time_usec);
444 _mav_put_float(buf, 8, xacc);
445 _mav_put_float(buf, 12, yacc);
446 _mav_put_float(buf, 16, zacc);
447 _mav_put_float(buf, 20, xgyro);
448 _mav_put_float(buf, 24, ygyro);
449 _mav_put_float(buf, 28, zgyro);
450 _mav_put_float(buf, 32, xmag);
451 _mav_put_float(buf, 36, ymag);
452 _mav_put_float(buf, 40, zmag);
453 _mav_put_float(buf, 44, abs_pressure);
454 _mav_put_float(buf, 48, diff_pressure);
455 _mav_put_float(buf, 52, pressure_alt);
456 _mav_put_float(buf, 56, temperature);
457 _mav_put_uint16_t(buf, 60, fields_updated);
458 _mav_put_uint8_t(buf, 62, id);
459
460 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
461#else
462 mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
463 packet->time_usec = time_usec;
464 packet->xacc = xacc;
465 packet->yacc = yacc;
466 packet->zacc = zacc;
467 packet->xgyro = xgyro;
468 packet->ygyro = ygyro;
469 packet->zgyro = zgyro;
470 packet->xmag = xmag;
471 packet->ymag = ymag;
472 packet->zmag = zmag;
473 packet->abs_pressure = abs_pressure;
474 packet->diff_pressure = diff_pressure;
475 packet->pressure_alt = pressure_alt;
476 packet->temperature = temperature;
477 packet->fields_updated = fields_updated;
478 packet->id = id;
479
480 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
481#endif
482}
483#endif
484
485#endif
486
487// MESSAGE HIGHRES_IMU UNPACKING
488
489
490/**
491 * @brief Get field time_usec from highres_imu message
492 *
493 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
494 */
495static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
496{
497 return _MAV_RETURN_uint64_t(msg, 0);
498}
499
500/**
501 * @brief Get field xacc from highres_imu message
502 *
503 * @return [m/s/s] X acceleration
504 */
505static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
506{
507 return _MAV_RETURN_float(msg, 8);
508}
509
510/**
511 * @brief Get field yacc from highres_imu message
512 *
513 * @return [m/s/s] Y acceleration
514 */
515static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
516{
517 return _MAV_RETURN_float(msg, 12);
518}
519
520/**
521 * @brief Get field zacc from highres_imu message
522 *
523 * @return [m/s/s] Z acceleration
524 */
525static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
526{
527 return _MAV_RETURN_float(msg, 16);
528}
529
530/**
531 * @brief Get field xgyro from highres_imu message
532 *
533 * @return [rad/s] Angular speed around X axis
534 */
535static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
536{
537 return _MAV_RETURN_float(msg, 20);
538}
539
540/**
541 * @brief Get field ygyro from highres_imu message
542 *
543 * @return [rad/s] Angular speed around Y axis
544 */
545static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_float(msg, 24);
548}
549
550/**
551 * @brief Get field zgyro from highres_imu message
552 *
553 * @return [rad/s] Angular speed around Z axis
554 */
555static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
556{
557 return _MAV_RETURN_float(msg, 28);
558}
559
560/**
561 * @brief Get field xmag from highres_imu message
562 *
563 * @return [gauss] X Magnetic field
564 */
565static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
566{
567 return _MAV_RETURN_float(msg, 32);
568}
569
570/**
571 * @brief Get field ymag from highres_imu message
572 *
573 * @return [gauss] Y Magnetic field
574 */
575static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
576{
577 return _MAV_RETURN_float(msg, 36);
578}
579
580/**
581 * @brief Get field zmag from highres_imu message
582 *
583 * @return [gauss] Z Magnetic field
584 */
585static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
586{
587 return _MAV_RETURN_float(msg, 40);
588}
589
590/**
591 * @brief Get field abs_pressure from highres_imu message
592 *
593 * @return [hPa] Absolute pressure
594 */
595static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
596{
597 return _MAV_RETURN_float(msg, 44);
598}
599
600/**
601 * @brief Get field diff_pressure from highres_imu message
602 *
603 * @return [hPa] Differential pressure
604 */
605static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
606{
607 return _MAV_RETURN_float(msg, 48);
608}
609
610/**
611 * @brief Get field pressure_alt from highres_imu message
612 *
613 * @return Altitude calculated from pressure
614 */
615static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
616{
617 return _MAV_RETURN_float(msg, 52);
618}
619
620/**
621 * @brief Get field temperature from highres_imu message
622 *
623 * @return [degC] Temperature
624 */
625static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
626{
627 return _MAV_RETURN_float(msg, 56);
628}
629
630/**
631 * @brief Get field fields_updated from highres_imu message
632 *
633 * @return Bitmap for fields that have updated since last message
634 */
635static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
636{
637 return _MAV_RETURN_uint16_t(msg, 60);
638}
639
640/**
641 * @brief Get field id from highres_imu message
642 *
643 * @return Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
644 */
645static inline uint8_t mavlink_msg_highres_imu_get_id(const mavlink_message_t* msg)
646{
647 return _MAV_RETURN_uint8_t(msg, 62);
648}
649
650/**
651 * @brief Decode a highres_imu message into a struct
652 *
653 * @param msg The message to decode
654 * @param highres_imu C-struct to decode the message contents into
655 */
656static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
657{
658#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
659 highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
660 highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
661 highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
662 highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
663 highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
664 highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
665 highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
666 highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
667 highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
668 highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
669 highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
670 highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
671 highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
672 highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
673 highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
674 highres_imu->id = mavlink_msg_highres_imu_get_id(msg);
675#else
676 uint8_t len = msg->len < MAVLINK_MSG_ID_HIGHRES_IMU_LEN? msg->len : MAVLINK_MSG_ID_HIGHRES_IMU_LEN;
677 memset(highres_imu, 0, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
678 memcpy(highres_imu, _MAV_PAYLOAD(msg), len);
679#endif
680}