1 | // MESSAGE HIL_SENSOR PACKING
|
---|
2 |
|
---|
3 | #define MAVLINK_MSG_ID_HIL_SENSOR 107
|
---|
4 |
|
---|
5 | typedef struct MAVLINK_PACKED __mavlink_hil_sensor_t
|
---|
6 | {
|
---|
7 | uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
|
---|
8 | float xacc; /*< X acceleration (m/s^2)*/
|
---|
9 | float yacc; /*< Y acceleration (m/s^2)*/
|
---|
10 | float zacc; /*< Z acceleration (m/s^2)*/
|
---|
11 | float xgyro; /*< Angular speed around X axis in body frame (rad / sec)*/
|
---|
12 | float ygyro; /*< Angular speed around Y axis in body frame (rad / sec)*/
|
---|
13 | float zgyro; /*< Angular speed around Z axis in body frame (rad / sec)*/
|
---|
14 | float xmag; /*< X Magnetic field (Gauss)*/
|
---|
15 | float ymag; /*< Y Magnetic field (Gauss)*/
|
---|
16 | float zmag; /*< Z Magnetic field (Gauss)*/
|
---|
17 | float abs_pressure; /*< Absolute pressure in millibar*/
|
---|
18 | float diff_pressure; /*< Differential pressure (airspeed) in millibar*/
|
---|
19 | float pressure_alt; /*< Altitude calculated from pressure*/
|
---|
20 | float temperature; /*< Temperature in degrees celsius*/
|
---|
21 | 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.*/
|
---|
22 | } mavlink_hil_sensor_t;
|
---|
23 |
|
---|
24 | #define MAVLINK_MSG_ID_HIL_SENSOR_LEN 64
|
---|
25 | #define MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN 64
|
---|
26 | #define MAVLINK_MSG_ID_107_LEN 64
|
---|
27 | #define MAVLINK_MSG_ID_107_MIN_LEN 64
|
---|
28 |
|
---|
29 | #define MAVLINK_MSG_ID_HIL_SENSOR_CRC 108
|
---|
30 | #define MAVLINK_MSG_ID_107_CRC 108
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | #if MAVLINK_COMMAND_24BIT
|
---|
35 | #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \
|
---|
36 | 107, \
|
---|
37 | "HIL_SENSOR", \
|
---|
38 | 15, \
|
---|
39 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \
|
---|
40 | { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \
|
---|
41 | { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \
|
---|
42 | { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \
|
---|
43 | { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \
|
---|
44 | { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \
|
---|
45 | { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \
|
---|
46 | { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \
|
---|
47 | { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \
|
---|
48 | { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \
|
---|
49 | { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \
|
---|
50 | { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \
|
---|
51 | { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \
|
---|
52 | { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \
|
---|
53 | { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \
|
---|
54 | } \
|
---|
55 | }
|
---|
56 | #else
|
---|
57 | #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \
|
---|
58 | "HIL_SENSOR", \
|
---|
59 | 15, \
|
---|
60 | { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \
|
---|
61 | { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \
|
---|
62 | { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \
|
---|
63 | { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \
|
---|
64 | { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \
|
---|
65 | { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \
|
---|
66 | { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \
|
---|
67 | { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \
|
---|
68 | { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \
|
---|
69 | { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \
|
---|
70 | { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \
|
---|
71 | { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \
|
---|
72 | { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \
|
---|
73 | { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \
|
---|
74 | { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \
|
---|
75 | } \
|
---|
76 | }
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * @brief Pack a hil_sensor message
|
---|
81 | * @param system_id ID of this system
|
---|
82 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
83 | * @param msg The MAVLink message to compress the data into
|
---|
84 | *
|
---|
85 | * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
|
---|
86 | * @param xacc X acceleration (m/s^2)
|
---|
87 | * @param yacc Y acceleration (m/s^2)
|
---|
88 | * @param zacc Z acceleration (m/s^2)
|
---|
89 | * @param xgyro Angular speed around X axis in body frame (rad / sec)
|
---|
90 | * @param ygyro Angular speed around Y axis in body frame (rad / sec)
|
---|
91 | * @param zgyro Angular speed around Z axis in body frame (rad / sec)
|
---|
92 | * @param xmag X Magnetic field (Gauss)
|
---|
93 | * @param ymag Y Magnetic field (Gauss)
|
---|
94 | * @param zmag Z Magnetic field (Gauss)
|
---|
95 | * @param abs_pressure Absolute pressure in millibar
|
---|
96 | * @param diff_pressure Differential pressure (airspeed) in millibar
|
---|
97 | * @param pressure_alt Altitude calculated from pressure
|
---|
98 | * @param temperature Temperature in degrees celsius
|
---|
99 | * @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.
|
---|
100 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
101 | */
|
---|
102 | static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
103 | 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)
|
---|
104 | {
|
---|
105 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
106 | char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
|
---|
107 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
108 | _mav_put_float(buf, 8, xacc);
|
---|
109 | _mav_put_float(buf, 12, yacc);
|
---|
110 | _mav_put_float(buf, 16, zacc);
|
---|
111 | _mav_put_float(buf, 20, xgyro);
|
---|
112 | _mav_put_float(buf, 24, ygyro);
|
---|
113 | _mav_put_float(buf, 28, zgyro);
|
---|
114 | _mav_put_float(buf, 32, xmag);
|
---|
115 | _mav_put_float(buf, 36, ymag);
|
---|
116 | _mav_put_float(buf, 40, zmag);
|
---|
117 | _mav_put_float(buf, 44, abs_pressure);
|
---|
118 | _mav_put_float(buf, 48, diff_pressure);
|
---|
119 | _mav_put_float(buf, 52, pressure_alt);
|
---|
120 | _mav_put_float(buf, 56, temperature);
|
---|
121 | _mav_put_uint32_t(buf, 60, fields_updated);
|
---|
122 |
|
---|
123 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
|
---|
124 | #else
|
---|
125 | mavlink_hil_sensor_t packet;
|
---|
126 | packet.time_usec = time_usec;
|
---|
127 | packet.xacc = xacc;
|
---|
128 | packet.yacc = yacc;
|
---|
129 | packet.zacc = zacc;
|
---|
130 | packet.xgyro = xgyro;
|
---|
131 | packet.ygyro = ygyro;
|
---|
132 | packet.zgyro = zgyro;
|
---|
133 | packet.xmag = xmag;
|
---|
134 | packet.ymag = ymag;
|
---|
135 | packet.zmag = zmag;
|
---|
136 | packet.abs_pressure = abs_pressure;
|
---|
137 | packet.diff_pressure = diff_pressure;
|
---|
138 | packet.pressure_alt = pressure_alt;
|
---|
139 | packet.temperature = temperature;
|
---|
140 | packet.fields_updated = fields_updated;
|
---|
141 |
|
---|
142 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | msg->msgid = MAVLINK_MSG_ID_HIL_SENSOR;
|
---|
146 | 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);
|
---|
147 | }
|
---|
148 |
|
---|
149 | /**
|
---|
150 | * @brief Pack a hil_sensor message on a channel
|
---|
151 | * @param system_id ID of this system
|
---|
152 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
153 | * @param chan The MAVLink channel this message will be sent over
|
---|
154 | * @param msg The MAVLink message to compress the data into
|
---|
155 | * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
|
---|
156 | * @param xacc X acceleration (m/s^2)
|
---|
157 | * @param yacc Y acceleration (m/s^2)
|
---|
158 | * @param zacc Z acceleration (m/s^2)
|
---|
159 | * @param xgyro Angular speed around X axis in body frame (rad / sec)
|
---|
160 | * @param ygyro Angular speed around Y axis in body frame (rad / sec)
|
---|
161 | * @param zgyro Angular speed around Z axis in body frame (rad / sec)
|
---|
162 | * @param xmag X Magnetic field (Gauss)
|
---|
163 | * @param ymag Y Magnetic field (Gauss)
|
---|
164 | * @param zmag Z Magnetic field (Gauss)
|
---|
165 | * @param abs_pressure Absolute pressure in millibar
|
---|
166 | * @param diff_pressure Differential pressure (airspeed) in millibar
|
---|
167 | * @param pressure_alt Altitude calculated from pressure
|
---|
168 | * @param temperature Temperature in degrees celsius
|
---|
169 | * @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.
|
---|
170 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
171 | */
|
---|
172 | static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
173 | mavlink_message_t* msg,
|
---|
174 | 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)
|
---|
175 | {
|
---|
176 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
177 | char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
|
---|
178 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
179 | _mav_put_float(buf, 8, xacc);
|
---|
180 | _mav_put_float(buf, 12, yacc);
|
---|
181 | _mav_put_float(buf, 16, zacc);
|
---|
182 | _mav_put_float(buf, 20, xgyro);
|
---|
183 | _mav_put_float(buf, 24, ygyro);
|
---|
184 | _mav_put_float(buf, 28, zgyro);
|
---|
185 | _mav_put_float(buf, 32, xmag);
|
---|
186 | _mav_put_float(buf, 36, ymag);
|
---|
187 | _mav_put_float(buf, 40, zmag);
|
---|
188 | _mav_put_float(buf, 44, abs_pressure);
|
---|
189 | _mav_put_float(buf, 48, diff_pressure);
|
---|
190 | _mav_put_float(buf, 52, pressure_alt);
|
---|
191 | _mav_put_float(buf, 56, temperature);
|
---|
192 | _mav_put_uint32_t(buf, 60, fields_updated);
|
---|
193 |
|
---|
194 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
|
---|
195 | #else
|
---|
196 | mavlink_hil_sensor_t packet;
|
---|
197 | packet.time_usec = time_usec;
|
---|
198 | packet.xacc = xacc;
|
---|
199 | packet.yacc = yacc;
|
---|
200 | packet.zacc = zacc;
|
---|
201 | packet.xgyro = xgyro;
|
---|
202 | packet.ygyro = ygyro;
|
---|
203 | packet.zgyro = zgyro;
|
---|
204 | packet.xmag = xmag;
|
---|
205 | packet.ymag = ymag;
|
---|
206 | packet.zmag = zmag;
|
---|
207 | packet.abs_pressure = abs_pressure;
|
---|
208 | packet.diff_pressure = diff_pressure;
|
---|
209 | packet.pressure_alt = pressure_alt;
|
---|
210 | packet.temperature = temperature;
|
---|
211 | packet.fields_updated = fields_updated;
|
---|
212 |
|
---|
213 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
|
---|
214 | #endif
|
---|
215 |
|
---|
216 | msg->msgid = MAVLINK_MSG_ID_HIL_SENSOR;
|
---|
217 | 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);
|
---|
218 | }
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * @brief Encode a hil_sensor struct
|
---|
222 | *
|
---|
223 | * @param system_id ID of this system
|
---|
224 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
225 | * @param msg The MAVLink message to compress the data into
|
---|
226 | * @param hil_sensor C-struct to read the message contents from
|
---|
227 | */
|
---|
228 | 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)
|
---|
229 | {
|
---|
230 | 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);
|
---|
231 | }
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * @brief Encode a hil_sensor struct on a channel
|
---|
235 | *
|
---|
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 hil_sensor C-struct to read the message contents from
|
---|
241 | */
|
---|
242 | 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)
|
---|
243 | {
|
---|
244 | 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);
|
---|
245 | }
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * @brief Send a hil_sensor message
|
---|
249 | * @param chan MAVLink channel to send the message
|
---|
250 | *
|
---|
251 | * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot)
|
---|
252 | * @param xacc X acceleration (m/s^2)
|
---|
253 | * @param yacc Y acceleration (m/s^2)
|
---|
254 | * @param zacc Z acceleration (m/s^2)
|
---|
255 | * @param xgyro Angular speed around X axis in body frame (rad / sec)
|
---|
256 | * @param ygyro Angular speed around Y axis in body frame (rad / sec)
|
---|
257 | * @param zgyro Angular speed around Z axis in body frame (rad / sec)
|
---|
258 | * @param xmag X Magnetic field (Gauss)
|
---|
259 | * @param ymag Y Magnetic field (Gauss)
|
---|
260 | * @param zmag Z Magnetic field (Gauss)
|
---|
261 | * @param abs_pressure Absolute pressure in millibar
|
---|
262 | * @param diff_pressure Differential pressure (airspeed) in millibar
|
---|
263 | * @param pressure_alt Altitude calculated from pressure
|
---|
264 | * @param temperature Temperature in degrees celsius
|
---|
265 | * @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.
|
---|
266 | */
|
---|
267 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
268 |
|
---|
269 | 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)
|
---|
270 | {
|
---|
271 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
272 | char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN];
|
---|
273 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
274 | _mav_put_float(buf, 8, xacc);
|
---|
275 | _mav_put_float(buf, 12, yacc);
|
---|
276 | _mav_put_float(buf, 16, zacc);
|
---|
277 | _mav_put_float(buf, 20, xgyro);
|
---|
278 | _mav_put_float(buf, 24, ygyro);
|
---|
279 | _mav_put_float(buf, 28, zgyro);
|
---|
280 | _mav_put_float(buf, 32, xmag);
|
---|
281 | _mav_put_float(buf, 36, ymag);
|
---|
282 | _mav_put_float(buf, 40, zmag);
|
---|
283 | _mav_put_float(buf, 44, abs_pressure);
|
---|
284 | _mav_put_float(buf, 48, diff_pressure);
|
---|
285 | _mav_put_float(buf, 52, pressure_alt);
|
---|
286 | _mav_put_float(buf, 56, temperature);
|
---|
287 | _mav_put_uint32_t(buf, 60, fields_updated);
|
---|
288 |
|
---|
289 | _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);
|
---|
290 | #else
|
---|
291 | mavlink_hil_sensor_t packet;
|
---|
292 | packet.time_usec = time_usec;
|
---|
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 | packet.abs_pressure = abs_pressure;
|
---|
303 | packet.diff_pressure = diff_pressure;
|
---|
304 | packet.pressure_alt = pressure_alt;
|
---|
305 | packet.temperature = temperature;
|
---|
306 | packet.fields_updated = fields_updated;
|
---|
307 |
|
---|
308 | _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);
|
---|
309 | #endif
|
---|
310 | }
|
---|
311 |
|
---|
312 | /**
|
---|
313 | * @brief Send a hil_sensor message
|
---|
314 | * @param chan MAVLink channel to send the message
|
---|
315 | * @param struct The MAVLink struct to serialize
|
---|
316 | */
|
---|
317 | static inline void mavlink_msg_hil_sensor_send_struct(mavlink_channel_t chan, const mavlink_hil_sensor_t* hil_sensor)
|
---|
318 | {
|
---|
319 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
320 | 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);
|
---|
321 | #else
|
---|
322 | _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);
|
---|
323 | #endif
|
---|
324 | }
|
---|
325 |
|
---|
326 | #if MAVLINK_MSG_ID_HIL_SENSOR_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
327 | /*
|
---|
328 | This varient of _send() can be used to save stack space by re-using
|
---|
329 | memory from the receive buffer. The caller provides a
|
---|
330 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
331 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
332 | incoming message with minimum stack space usage.
|
---|
333 | */
|
---|
334 | 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)
|
---|
335 | {
|
---|
336 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
337 | char *buf = (char *)msgbuf;
|
---|
338 | _mav_put_uint64_t(buf, 0, time_usec);
|
---|
339 | _mav_put_float(buf, 8, xacc);
|
---|
340 | _mav_put_float(buf, 12, yacc);
|
---|
341 | _mav_put_float(buf, 16, zacc);
|
---|
342 | _mav_put_float(buf, 20, xgyro);
|
---|
343 | _mav_put_float(buf, 24, ygyro);
|
---|
344 | _mav_put_float(buf, 28, zgyro);
|
---|
345 | _mav_put_float(buf, 32, xmag);
|
---|
346 | _mav_put_float(buf, 36, ymag);
|
---|
347 | _mav_put_float(buf, 40, zmag);
|
---|
348 | _mav_put_float(buf, 44, abs_pressure);
|
---|
349 | _mav_put_float(buf, 48, diff_pressure);
|
---|
350 | _mav_put_float(buf, 52, pressure_alt);
|
---|
351 | _mav_put_float(buf, 56, temperature);
|
---|
352 | _mav_put_uint32_t(buf, 60, fields_updated);
|
---|
353 |
|
---|
354 | _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);
|
---|
355 | #else
|
---|
356 | mavlink_hil_sensor_t *packet = (mavlink_hil_sensor_t *)msgbuf;
|
---|
357 | packet->time_usec = time_usec;
|
---|
358 | packet->xacc = xacc;
|
---|
359 | packet->yacc = yacc;
|
---|
360 | packet->zacc = zacc;
|
---|
361 | packet->xgyro = xgyro;
|
---|
362 | packet->ygyro = ygyro;
|
---|
363 | packet->zgyro = zgyro;
|
---|
364 | packet->xmag = xmag;
|
---|
365 | packet->ymag = ymag;
|
---|
366 | packet->zmag = zmag;
|
---|
367 | packet->abs_pressure = abs_pressure;
|
---|
368 | packet->diff_pressure = diff_pressure;
|
---|
369 | packet->pressure_alt = pressure_alt;
|
---|
370 | packet->temperature = temperature;
|
---|
371 | packet->fields_updated = fields_updated;
|
---|
372 |
|
---|
373 | _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);
|
---|
374 | #endif
|
---|
375 | }
|
---|
376 | #endif
|
---|
377 |
|
---|
378 | #endif
|
---|
379 |
|
---|
380 | // MESSAGE HIL_SENSOR UNPACKING
|
---|
381 |
|
---|
382 |
|
---|
383 | /**
|
---|
384 | * @brief Get field time_usec from hil_sensor message
|
---|
385 | *
|
---|
386 | * @return Timestamp (microseconds, synced to UNIX time or since system boot)
|
---|
387 | */
|
---|
388 | static inline uint64_t mavlink_msg_hil_sensor_get_time_usec(const mavlink_message_t* msg)
|
---|
389 | {
|
---|
390 | return _MAV_RETURN_uint64_t(msg, 0);
|
---|
391 | }
|
---|
392 |
|
---|
393 | /**
|
---|
394 | * @brief Get field xacc from hil_sensor message
|
---|
395 | *
|
---|
396 | * @return X acceleration (m/s^2)
|
---|
397 | */
|
---|
398 | static inline float mavlink_msg_hil_sensor_get_xacc(const mavlink_message_t* msg)
|
---|
399 | {
|
---|
400 | return _MAV_RETURN_float(msg, 8);
|
---|
401 | }
|
---|
402 |
|
---|
403 | /**
|
---|
404 | * @brief Get field yacc from hil_sensor message
|
---|
405 | *
|
---|
406 | * @return Y acceleration (m/s^2)
|
---|
407 | */
|
---|
408 | static inline float mavlink_msg_hil_sensor_get_yacc(const mavlink_message_t* msg)
|
---|
409 | {
|
---|
410 | return _MAV_RETURN_float(msg, 12);
|
---|
411 | }
|
---|
412 |
|
---|
413 | /**
|
---|
414 | * @brief Get field zacc from hil_sensor message
|
---|
415 | *
|
---|
416 | * @return Z acceleration (m/s^2)
|
---|
417 | */
|
---|
418 | static inline float mavlink_msg_hil_sensor_get_zacc(const mavlink_message_t* msg)
|
---|
419 | {
|
---|
420 | return _MAV_RETURN_float(msg, 16);
|
---|
421 | }
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * @brief Get field xgyro from hil_sensor message
|
---|
425 | *
|
---|
426 | * @return Angular speed around X axis in body frame (rad / sec)
|
---|
427 | */
|
---|
428 | static inline float mavlink_msg_hil_sensor_get_xgyro(const mavlink_message_t* msg)
|
---|
429 | {
|
---|
430 | return _MAV_RETURN_float(msg, 20);
|
---|
431 | }
|
---|
432 |
|
---|
433 | /**
|
---|
434 | * @brief Get field ygyro from hil_sensor message
|
---|
435 | *
|
---|
436 | * @return Angular speed around Y axis in body frame (rad / sec)
|
---|
437 | */
|
---|
438 | static inline float mavlink_msg_hil_sensor_get_ygyro(const mavlink_message_t* msg)
|
---|
439 | {
|
---|
440 | return _MAV_RETURN_float(msg, 24);
|
---|
441 | }
|
---|
442 |
|
---|
443 | /**
|
---|
444 | * @brief Get field zgyro from hil_sensor message
|
---|
445 | *
|
---|
446 | * @return Angular speed around Z axis in body frame (rad / sec)
|
---|
447 | */
|
---|
448 | static inline float mavlink_msg_hil_sensor_get_zgyro(const mavlink_message_t* msg)
|
---|
449 | {
|
---|
450 | return _MAV_RETURN_float(msg, 28);
|
---|
451 | }
|
---|
452 |
|
---|
453 | /**
|
---|
454 | * @brief Get field xmag from hil_sensor message
|
---|
455 | *
|
---|
456 | * @return X Magnetic field (Gauss)
|
---|
457 | */
|
---|
458 | static inline float mavlink_msg_hil_sensor_get_xmag(const mavlink_message_t* msg)
|
---|
459 | {
|
---|
460 | return _MAV_RETURN_float(msg, 32);
|
---|
461 | }
|
---|
462 |
|
---|
463 | /**
|
---|
464 | * @brief Get field ymag from hil_sensor message
|
---|
465 | *
|
---|
466 | * @return Y Magnetic field (Gauss)
|
---|
467 | */
|
---|
468 | static inline float mavlink_msg_hil_sensor_get_ymag(const mavlink_message_t* msg)
|
---|
469 | {
|
---|
470 | return _MAV_RETURN_float(msg, 36);
|
---|
471 | }
|
---|
472 |
|
---|
473 | /**
|
---|
474 | * @brief Get field zmag from hil_sensor message
|
---|
475 | *
|
---|
476 | * @return Z Magnetic field (Gauss)
|
---|
477 | */
|
---|
478 | static inline float mavlink_msg_hil_sensor_get_zmag(const mavlink_message_t* msg)
|
---|
479 | {
|
---|
480 | return _MAV_RETURN_float(msg, 40);
|
---|
481 | }
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * @brief Get field abs_pressure from hil_sensor message
|
---|
485 | *
|
---|
486 | * @return Absolute pressure in millibar
|
---|
487 | */
|
---|
488 | static inline float mavlink_msg_hil_sensor_get_abs_pressure(const mavlink_message_t* msg)
|
---|
489 | {
|
---|
490 | return _MAV_RETURN_float(msg, 44);
|
---|
491 | }
|
---|
492 |
|
---|
493 | /**
|
---|
494 | * @brief Get field diff_pressure from hil_sensor message
|
---|
495 | *
|
---|
496 | * @return Differential pressure (airspeed) in millibar
|
---|
497 | */
|
---|
498 | static inline float mavlink_msg_hil_sensor_get_diff_pressure(const mavlink_message_t* msg)
|
---|
499 | {
|
---|
500 | return _MAV_RETURN_float(msg, 48);
|
---|
501 | }
|
---|
502 |
|
---|
503 | /**
|
---|
504 | * @brief Get field pressure_alt from hil_sensor message
|
---|
505 | *
|
---|
506 | * @return Altitude calculated from pressure
|
---|
507 | */
|
---|
508 | static inline float mavlink_msg_hil_sensor_get_pressure_alt(const mavlink_message_t* msg)
|
---|
509 | {
|
---|
510 | return _MAV_RETURN_float(msg, 52);
|
---|
511 | }
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * @brief Get field temperature from hil_sensor message
|
---|
515 | *
|
---|
516 | * @return Temperature in degrees celsius
|
---|
517 | */
|
---|
518 | static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message_t* msg)
|
---|
519 | {
|
---|
520 | return _MAV_RETURN_float(msg, 56);
|
---|
521 | }
|
---|
522 |
|
---|
523 | /**
|
---|
524 | * @brief Get field fields_updated from hil_sensor message
|
---|
525 | *
|
---|
526 | * @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.
|
---|
527 | */
|
---|
528 | static inline uint32_t mavlink_msg_hil_sensor_get_fields_updated(const mavlink_message_t* msg)
|
---|
529 | {
|
---|
530 | return _MAV_RETURN_uint32_t(msg, 60);
|
---|
531 | }
|
---|
532 |
|
---|
533 | /**
|
---|
534 | * @brief Decode a hil_sensor message into a struct
|
---|
535 | *
|
---|
536 | * @param msg The message to decode
|
---|
537 | * @param hil_sensor C-struct to decode the message contents into
|
---|
538 | */
|
---|
539 | static inline void mavlink_msg_hil_sensor_decode(const mavlink_message_t* msg, mavlink_hil_sensor_t* hil_sensor)
|
---|
540 | {
|
---|
541 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
542 | hil_sensor->time_usec = mavlink_msg_hil_sensor_get_time_usec(msg);
|
---|
543 | hil_sensor->xacc = mavlink_msg_hil_sensor_get_xacc(msg);
|
---|
544 | hil_sensor->yacc = mavlink_msg_hil_sensor_get_yacc(msg);
|
---|
545 | hil_sensor->zacc = mavlink_msg_hil_sensor_get_zacc(msg);
|
---|
546 | hil_sensor->xgyro = mavlink_msg_hil_sensor_get_xgyro(msg);
|
---|
547 | hil_sensor->ygyro = mavlink_msg_hil_sensor_get_ygyro(msg);
|
---|
548 | hil_sensor->zgyro = mavlink_msg_hil_sensor_get_zgyro(msg);
|
---|
549 | hil_sensor->xmag = mavlink_msg_hil_sensor_get_xmag(msg);
|
---|
550 | hil_sensor->ymag = mavlink_msg_hil_sensor_get_ymag(msg);
|
---|
551 | hil_sensor->zmag = mavlink_msg_hil_sensor_get_zmag(msg);
|
---|
552 | hil_sensor->abs_pressure = mavlink_msg_hil_sensor_get_abs_pressure(msg);
|
---|
553 | hil_sensor->diff_pressure = mavlink_msg_hil_sensor_get_diff_pressure(msg);
|
---|
554 | hil_sensor->pressure_alt = mavlink_msg_hil_sensor_get_pressure_alt(msg);
|
---|
555 | hil_sensor->temperature = mavlink_msg_hil_sensor_get_temperature(msg);
|
---|
556 | hil_sensor->fields_updated = mavlink_msg_hil_sensor_get_fields_updated(msg);
|
---|
557 | #else
|
---|
558 | uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_SENSOR_LEN? msg->len : MAVLINK_MSG_ID_HIL_SENSOR_LEN;
|
---|
559 | memset(hil_sensor, 0, MAVLINK_MSG_ID_HIL_SENSOR_LEN);
|
---|
560 | memcpy(hil_sensor, _MAV_PAYLOAD(msg), len);
|
---|
561 | #endif
|
---|
562 | }
|
---|