2 // MESSAGE HIL_SENSOR PACKING
4 #define MAVLINK_MSG_ID_HIL_SENSOR 107
7 typedef struct __mavlink_hil_sensor_t
{
8 uint64_t time_usec
; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
9 float xacc
; /*< X acceleration (m/s^2)*/
10 float yacc
; /*< Y acceleration (m/s^2)*/
11 float zacc
; /*< Z acceleration (m/s^2)*/
12 float xgyro
; /*< Angular speed around X axis in body frame (rad / sec)*/
13 float ygyro
; /*< Angular speed around Y axis in body frame (rad / sec)*/
14 float zgyro
; /*< Angular speed around Z axis in body frame (rad / sec)*/
15 float xmag
; /*< X Magnetic field (Gauss)*/
16 float ymag
; /*< Y Magnetic field (Gauss)*/
17 float zmag
; /*< Z Magnetic field (Gauss)*/
18 float abs_pressure
; /*< Absolute pressure in millibar*/
19 float diff_pressure
; /*< Differential pressure (airspeed) in millibar*/
20 float pressure_alt
; /*< Altitude calculated from pressure*/
21 float temperature
; /*< Temperature in degrees celsius*/
22 uint32_t fields_updated
; /*< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.*/
23 }) mavlink_hil_sensor_t
;
25 #define MAVLINK_MSG_ID_HIL_SENSOR_LEN 64
26 #define MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN 64
27 #define MAVLINK_MSG_ID_107_LEN 64
28 #define MAVLINK_MSG_ID_107_MIN_LEN 64
30 #define MAVLINK_MSG_ID_HIL_SENSOR_CRC 108
31 #define MAVLINK_MSG_ID_107_CRC 108
35 #if MAVLINK_COMMAND_24BIT
36 #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \
40 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \
41 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \
42 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \
43 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \
44 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \
45 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \
46 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \
47 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \
48 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \
49 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \
50 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \
51 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \
52 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \
53 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \
54 { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \
58 #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \
61 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \
62 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \
63 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \
64 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \
65 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \
66 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \
67 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \
68 { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \
69 { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \
70 { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \
71 { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \
72 { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \
73 { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \
74 { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \
75 { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \
81 * @brief Pack a hil_sensor message
82 * @param system_id ID of this system
83 * @param component_id ID of this component (e.g. 200 for IMU)
84 * @param msg The MAVLink message to compress the data into
86 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
87 * @param xacc X acceleration (m/s^2)
88 * @param yacc Y acceleration (m/s^2)
89 * @param zacc Z acceleration (m/s^2)
90 * @param xgyro Angular speed around X axis in body frame (rad / sec)
91 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
92 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
93 * @param xmag X Magnetic field (Gauss)
94 * @param ymag Y Magnetic field (Gauss)
95 * @param zmag Z Magnetic field (Gauss)
96 * @param abs_pressure Absolute pressure in millibar
97 * @param diff_pressure Differential pressure (airspeed) in millibar
98 * @param pressure_alt Altitude calculated from pressure
99 * @param temperature Temperature in degrees celsius
100 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
104 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
, uint32_t fields_updated
)
106 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107 char buf
[MAVLINK_MSG_ID_HIL_SENSOR_LEN
];
108 _mav_put_uint64_t(buf
, 0, time_usec
);
109 _mav_put_float(buf
, 8, xacc
);
110 _mav_put_float(buf
, 12, yacc
);
111 _mav_put_float(buf
, 16, zacc
);
112 _mav_put_float(buf
, 20, xgyro
);
113 _mav_put_float(buf
, 24, ygyro
);
114 _mav_put_float(buf
, 28, zgyro
);
115 _mav_put_float(buf
, 32, xmag
);
116 _mav_put_float(buf
, 36, ymag
);
117 _mav_put_float(buf
, 40, zmag
);
118 _mav_put_float(buf
, 44, abs_pressure
);
119 _mav_put_float(buf
, 48, diff_pressure
);
120 _mav_put_float(buf
, 52, pressure_alt
);
121 _mav_put_float(buf
, 56, temperature
);
122 _mav_put_uint32_t(buf
, 60, fields_updated
);
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
);
126 mavlink_hil_sensor_t packet
;
127 packet
.time_usec
= time_usec
;
131 packet
.xgyro
= xgyro
;
132 packet
.ygyro
= ygyro
;
133 packet
.zgyro
= zgyro
;
137 packet
.abs_pressure
= abs_pressure
;
138 packet
.diff_pressure
= diff_pressure
;
139 packet
.pressure_alt
= pressure_alt
;
140 packet
.temperature
= temperature
;
141 packet
.fields_updated
= fields_updated
;
143 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
);
146 msg
->msgid
= MAVLINK_MSG_ID_HIL_SENSOR
;
147 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
151 * @brief Pack a hil_sensor message on a channel
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param chan The MAVLink channel this message will be sent over
155 * @param msg The MAVLink message to compress the data into
156 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
157 * @param xacc X acceleration (m/s^2)
158 * @param yacc Y acceleration (m/s^2)
159 * @param zacc Z acceleration (m/s^2)
160 * @param xgyro Angular speed around X axis in body frame (rad / sec)
161 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
162 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
163 * @param xmag X Magnetic field (Gauss)
164 * @param ymag Y Magnetic field (Gauss)
165 * @param zmag Z Magnetic field (Gauss)
166 * @param abs_pressure Absolute pressure in millibar
167 * @param diff_pressure Differential pressure (airspeed) in millibar
168 * @param pressure_alt Altitude calculated from pressure
169 * @param temperature Temperature in degrees celsius
170 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.
171 * @return length of the message in bytes (excluding serial stream start sign)
173 static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
174 mavlink_message_t
* msg
,
175 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
,uint32_t fields_updated
)
177 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
178 char buf
[MAVLINK_MSG_ID_HIL_SENSOR_LEN
];
179 _mav_put_uint64_t(buf
, 0, time_usec
);
180 _mav_put_float(buf
, 8, xacc
);
181 _mav_put_float(buf
, 12, yacc
);
182 _mav_put_float(buf
, 16, zacc
);
183 _mav_put_float(buf
, 20, xgyro
);
184 _mav_put_float(buf
, 24, ygyro
);
185 _mav_put_float(buf
, 28, zgyro
);
186 _mav_put_float(buf
, 32, xmag
);
187 _mav_put_float(buf
, 36, ymag
);
188 _mav_put_float(buf
, 40, zmag
);
189 _mav_put_float(buf
, 44, abs_pressure
);
190 _mav_put_float(buf
, 48, diff_pressure
);
191 _mav_put_float(buf
, 52, pressure_alt
);
192 _mav_put_float(buf
, 56, temperature
);
193 _mav_put_uint32_t(buf
, 60, fields_updated
);
195 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
);
197 mavlink_hil_sensor_t packet
;
198 packet
.time_usec
= time_usec
;
202 packet
.xgyro
= xgyro
;
203 packet
.ygyro
= ygyro
;
204 packet
.zgyro
= zgyro
;
208 packet
.abs_pressure
= abs_pressure
;
209 packet
.diff_pressure
= diff_pressure
;
210 packet
.pressure_alt
= pressure_alt
;
211 packet
.temperature
= temperature
;
212 packet
.fields_updated
= fields_updated
;
214 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
);
217 msg
->msgid
= MAVLINK_MSG_ID_HIL_SENSOR
;
218 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
222 * @brief Encode a hil_sensor struct
224 * @param system_id ID of this system
225 * @param component_id ID of this component (e.g. 200 for IMU)
226 * @param msg The MAVLink message to compress the data into
227 * @param hil_sensor C-struct to read the message contents from
229 static inline uint16_t mavlink_msg_hil_sensor_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_hil_sensor_t
* hil_sensor
)
231 return mavlink_msg_hil_sensor_pack(system_id
, component_id
, msg
, hil_sensor
->time_usec
, hil_sensor
->xacc
, hil_sensor
->yacc
, hil_sensor
->zacc
, hil_sensor
->xgyro
, hil_sensor
->ygyro
, hil_sensor
->zgyro
, hil_sensor
->xmag
, hil_sensor
->ymag
, hil_sensor
->zmag
, hil_sensor
->abs_pressure
, hil_sensor
->diff_pressure
, hil_sensor
->pressure_alt
, hil_sensor
->temperature
, hil_sensor
->fields_updated
);
235 * @brief Encode a hil_sensor struct on a channel
237 * @param system_id ID of this system
238 * @param component_id ID of this component (e.g. 200 for IMU)
239 * @param chan The MAVLink channel this message will be sent over
240 * @param msg The MAVLink message to compress the data into
241 * @param hil_sensor C-struct to read the message contents from
243 static inline uint16_t mavlink_msg_hil_sensor_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_hil_sensor_t
* hil_sensor
)
245 return mavlink_msg_hil_sensor_pack_chan(system_id
, component_id
, chan
, msg
, hil_sensor
->time_usec
, hil_sensor
->xacc
, hil_sensor
->yacc
, hil_sensor
->zacc
, hil_sensor
->xgyro
, hil_sensor
->ygyro
, hil_sensor
->zgyro
, hil_sensor
->xmag
, hil_sensor
->ymag
, hil_sensor
->zmag
, hil_sensor
->abs_pressure
, hil_sensor
->diff_pressure
, hil_sensor
->pressure_alt
, hil_sensor
->temperature
, hil_sensor
->fields_updated
);
249 * @brief Send a hil_sensor message
250 * @param chan MAVLink channel to send the message
252 * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
253 * @param xacc X acceleration (m/s^2)
254 * @param yacc Y acceleration (m/s^2)
255 * @param zacc Z acceleration (m/s^2)
256 * @param xgyro Angular speed around X axis in body frame (rad / sec)
257 * @param ygyro Angular speed around Y axis in body frame (rad / sec)
258 * @param zgyro Angular speed around Z axis in body frame (rad / sec)
259 * @param xmag X Magnetic field (Gauss)
260 * @param ymag Y Magnetic field (Gauss)
261 * @param zmag Z Magnetic field (Gauss)
262 * @param abs_pressure Absolute pressure in millibar
263 * @param diff_pressure Differential pressure (airspeed) in millibar
264 * @param pressure_alt Altitude calculated from pressure
265 * @param temperature Temperature in degrees celsius
266 * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.
268 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
270 static inline void mavlink_msg_hil_sensor_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
, uint32_t fields_updated
)
272 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
273 char buf
[MAVLINK_MSG_ID_HIL_SENSOR_LEN
];
274 _mav_put_uint64_t(buf
, 0, time_usec
);
275 _mav_put_float(buf
, 8, xacc
);
276 _mav_put_float(buf
, 12, yacc
);
277 _mav_put_float(buf
, 16, zacc
);
278 _mav_put_float(buf
, 20, xgyro
);
279 _mav_put_float(buf
, 24, ygyro
);
280 _mav_put_float(buf
, 28, zgyro
);
281 _mav_put_float(buf
, 32, xmag
);
282 _mav_put_float(buf
, 36, ymag
);
283 _mav_put_float(buf
, 40, zmag
);
284 _mav_put_float(buf
, 44, abs_pressure
);
285 _mav_put_float(buf
, 48, diff_pressure
);
286 _mav_put_float(buf
, 52, pressure_alt
);
287 _mav_put_float(buf
, 56, temperature
);
288 _mav_put_uint32_t(buf
, 60, fields_updated
);
290 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_SENSOR
, buf
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
292 mavlink_hil_sensor_t packet
;
293 packet
.time_usec
= time_usec
;
297 packet
.xgyro
= xgyro
;
298 packet
.ygyro
= ygyro
;
299 packet
.zgyro
= zgyro
;
303 packet
.abs_pressure
= abs_pressure
;
304 packet
.diff_pressure
= diff_pressure
;
305 packet
.pressure_alt
= pressure_alt
;
306 packet
.temperature
= temperature
;
307 packet
.fields_updated
= fields_updated
;
309 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_SENSOR
, (const char *)&packet
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
314 * @brief Send a hil_sensor message
315 * @param chan MAVLink channel to send the message
316 * @param struct The MAVLink struct to serialize
318 static inline void mavlink_msg_hil_sensor_send_struct(mavlink_channel_t chan
, const mavlink_hil_sensor_t
* hil_sensor
)
320 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
321 mavlink_msg_hil_sensor_send(chan
, hil_sensor
->time_usec
, hil_sensor
->xacc
, hil_sensor
->yacc
, hil_sensor
->zacc
, hil_sensor
->xgyro
, hil_sensor
->ygyro
, hil_sensor
->zgyro
, hil_sensor
->xmag
, hil_sensor
->ymag
, hil_sensor
->zmag
, hil_sensor
->abs_pressure
, hil_sensor
->diff_pressure
, hil_sensor
->pressure_alt
, hil_sensor
->temperature
, hil_sensor
->fields_updated
);
323 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_SENSOR
, (const char *)hil_sensor
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
327 #if MAVLINK_MSG_ID_HIL_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
329 This varient of _send() can be used to save stack space by re-using
330 memory from the receive buffer. The caller provides a
331 mavlink_message_t which is the size of a full mavlink message. This
332 is usually the receive buffer for the channel, and allows a reply to an
333 incoming message with minimum stack space usage.
335 static inline void mavlink_msg_hil_sensor_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
, uint32_t fields_updated
)
337 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
338 char *buf
= (char *)msgbuf
;
339 _mav_put_uint64_t(buf
, 0, time_usec
);
340 _mav_put_float(buf
, 8, xacc
);
341 _mav_put_float(buf
, 12, yacc
);
342 _mav_put_float(buf
, 16, zacc
);
343 _mav_put_float(buf
, 20, xgyro
);
344 _mav_put_float(buf
, 24, ygyro
);
345 _mav_put_float(buf
, 28, zgyro
);
346 _mav_put_float(buf
, 32, xmag
);
347 _mav_put_float(buf
, 36, ymag
);
348 _mav_put_float(buf
, 40, zmag
);
349 _mav_put_float(buf
, 44, abs_pressure
);
350 _mav_put_float(buf
, 48, diff_pressure
);
351 _mav_put_float(buf
, 52, pressure_alt
);
352 _mav_put_float(buf
, 56, temperature
);
353 _mav_put_uint32_t(buf
, 60, fields_updated
);
355 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_SENSOR
, buf
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
357 mavlink_hil_sensor_t
*packet
= (mavlink_hil_sensor_t
*)msgbuf
;
358 packet
->time_usec
= time_usec
;
362 packet
->xgyro
= xgyro
;
363 packet
->ygyro
= ygyro
;
364 packet
->zgyro
= zgyro
;
368 packet
->abs_pressure
= abs_pressure
;
369 packet
->diff_pressure
= diff_pressure
;
370 packet
->pressure_alt
= pressure_alt
;
371 packet
->temperature
= temperature
;
372 packet
->fields_updated
= fields_updated
;
374 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_HIL_SENSOR
, (const char *)packet
, MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_LEN
, MAVLINK_MSG_ID_HIL_SENSOR_CRC
);
381 // MESSAGE HIL_SENSOR UNPACKING
385 * @brief Get field time_usec from hil_sensor message
387 * @return Timestamp (microseconds, synced to UNIX time or since system boot)
389 static inline uint64_t mavlink_msg_hil_sensor_get_time_usec(const mavlink_message_t
* msg
)
391 return _MAV_RETURN_uint64_t(msg
, 0);
395 * @brief Get field xacc from hil_sensor message
397 * @return X acceleration (m/s^2)
399 static inline float mavlink_msg_hil_sensor_get_xacc(const mavlink_message_t
* msg
)
401 return _MAV_RETURN_float(msg
, 8);
405 * @brief Get field yacc from hil_sensor message
407 * @return Y acceleration (m/s^2)
409 static inline float mavlink_msg_hil_sensor_get_yacc(const mavlink_message_t
* msg
)
411 return _MAV_RETURN_float(msg
, 12);
415 * @brief Get field zacc from hil_sensor message
417 * @return Z acceleration (m/s^2)
419 static inline float mavlink_msg_hil_sensor_get_zacc(const mavlink_message_t
* msg
)
421 return _MAV_RETURN_float(msg
, 16);
425 * @brief Get field xgyro from hil_sensor message
427 * @return Angular speed around X axis in body frame (rad / sec)
429 static inline float mavlink_msg_hil_sensor_get_xgyro(const mavlink_message_t
* msg
)
431 return _MAV_RETURN_float(msg
, 20);
435 * @brief Get field ygyro from hil_sensor message
437 * @return Angular speed around Y axis in body frame (rad / sec)
439 static inline float mavlink_msg_hil_sensor_get_ygyro(const mavlink_message_t
* msg
)
441 return _MAV_RETURN_float(msg
, 24);
445 * @brief Get field zgyro from hil_sensor message
447 * @return Angular speed around Z axis in body frame (rad / sec)
449 static inline float mavlink_msg_hil_sensor_get_zgyro(const mavlink_message_t
* msg
)
451 return _MAV_RETURN_float(msg
, 28);
455 * @brief Get field xmag from hil_sensor message
457 * @return X Magnetic field (Gauss)
459 static inline float mavlink_msg_hil_sensor_get_xmag(const mavlink_message_t
* msg
)
461 return _MAV_RETURN_float(msg
, 32);
465 * @brief Get field ymag from hil_sensor message
467 * @return Y Magnetic field (Gauss)
469 static inline float mavlink_msg_hil_sensor_get_ymag(const mavlink_message_t
* msg
)
471 return _MAV_RETURN_float(msg
, 36);
475 * @brief Get field zmag from hil_sensor message
477 * @return Z Magnetic field (Gauss)
479 static inline float mavlink_msg_hil_sensor_get_zmag(const mavlink_message_t
* msg
)
481 return _MAV_RETURN_float(msg
, 40);
485 * @brief Get field abs_pressure from hil_sensor message
487 * @return Absolute pressure in millibar
489 static inline float mavlink_msg_hil_sensor_get_abs_pressure(const mavlink_message_t
* msg
)
491 return _MAV_RETURN_float(msg
, 44);
495 * @brief Get field diff_pressure from hil_sensor message
497 * @return Differential pressure (airspeed) in millibar
499 static inline float mavlink_msg_hil_sensor_get_diff_pressure(const mavlink_message_t
* msg
)
501 return _MAV_RETURN_float(msg
, 48);
505 * @brief Get field pressure_alt from hil_sensor message
507 * @return Altitude calculated from pressure
509 static inline float mavlink_msg_hil_sensor_get_pressure_alt(const mavlink_message_t
* msg
)
511 return _MAV_RETURN_float(msg
, 52);
515 * @brief Get field temperature from hil_sensor message
517 * @return Temperature in degrees celsius
519 static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message_t
* msg
)
521 return _MAV_RETURN_float(msg
, 56);
525 * @brief Get field fields_updated from hil_sensor message
527 * @return Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature, bit 31: full reset of attitude/position/velocities/etc was performed in sim.
529 static inline uint32_t mavlink_msg_hil_sensor_get_fields_updated(const mavlink_message_t
* msg
)
531 return _MAV_RETURN_uint32_t(msg
, 60);
535 * @brief Decode a hil_sensor message into a struct
537 * @param msg The message to decode
538 * @param hil_sensor C-struct to decode the message contents into
540 static inline void mavlink_msg_hil_sensor_decode(const mavlink_message_t
* msg
, mavlink_hil_sensor_t
* hil_sensor
)
542 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
543 hil_sensor
->time_usec
= mavlink_msg_hil_sensor_get_time_usec(msg
);
544 hil_sensor
->xacc
= mavlink_msg_hil_sensor_get_xacc(msg
);
545 hil_sensor
->yacc
= mavlink_msg_hil_sensor_get_yacc(msg
);
546 hil_sensor
->zacc
= mavlink_msg_hil_sensor_get_zacc(msg
);
547 hil_sensor
->xgyro
= mavlink_msg_hil_sensor_get_xgyro(msg
);
548 hil_sensor
->ygyro
= mavlink_msg_hil_sensor_get_ygyro(msg
);
549 hil_sensor
->zgyro
= mavlink_msg_hil_sensor_get_zgyro(msg
);
550 hil_sensor
->xmag
= mavlink_msg_hil_sensor_get_xmag(msg
);
551 hil_sensor
->ymag
= mavlink_msg_hil_sensor_get_ymag(msg
);
552 hil_sensor
->zmag
= mavlink_msg_hil_sensor_get_zmag(msg
);
553 hil_sensor
->abs_pressure
= mavlink_msg_hil_sensor_get_abs_pressure(msg
);
554 hil_sensor
->diff_pressure
= mavlink_msg_hil_sensor_get_diff_pressure(msg
);
555 hil_sensor
->pressure_alt
= mavlink_msg_hil_sensor_get_pressure_alt(msg
);
556 hil_sensor
->temperature
= mavlink_msg_hil_sensor_get_temperature(msg
);
557 hil_sensor
->fields_updated
= mavlink_msg_hil_sensor_get_fields_updated(msg
);
559 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_HIL_SENSOR_LEN
? msg
->len
: MAVLINK_MSG_ID_HIL_SENSOR_LEN
;
560 memset(hil_sensor
, 0, MAVLINK_MSG_ID_HIL_SENSOR_LEN
);
561 memcpy(hil_sensor
, _MAV_PAYLOAD(msg
), len
);