source: flair-src/trunk/tools/Controller/Mavlink/src/include/common/mavlink_msg_sim_state.h@ 137

Last change on this file since 137 was 88, checked in by Sanahuja Guillaume, 8 years ago

m

File size: 28.0 KB
Line 
1// MESSAGE SIM_STATE PACKING
2
3#define MAVLINK_MSG_ID_SIM_STATE 108
4
5typedef struct MAVLINK_PACKED __mavlink_sim_state_t
6{
7 float q1; /*< True attitude quaternion component 1, w (1 in null-rotation)*/
8 float q2; /*< True attitude quaternion component 2, x (0 in null-rotation)*/
9 float q3; /*< True attitude quaternion component 3, y (0 in null-rotation)*/
10 float q4; /*< True attitude quaternion component 4, z (0 in null-rotation)*/
11 float roll; /*< Attitude roll expressed as Euler angles, not recommended except for human-readable outputs*/
12 float pitch; /*< Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs*/
13 float yaw; /*< Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs*/
14 float xacc; /*< X acceleration m/s/s*/
15 float yacc; /*< Y acceleration m/s/s*/
16 float zacc; /*< Z acceleration m/s/s*/
17 float xgyro; /*< Angular speed around X axis rad/s*/
18 float ygyro; /*< Angular speed around Y axis rad/s*/
19 float zgyro; /*< Angular speed around Z axis rad/s*/
20 float lat; /*< Latitude in degrees*/
21 float lon; /*< Longitude in degrees*/
22 float alt; /*< Altitude in meters*/
23 float std_dev_horz; /*< Horizontal position standard deviation*/
24 float std_dev_vert; /*< Vertical position standard deviation*/
25 float vn; /*< True velocity in m/s in NORTH direction in earth-fixed NED frame*/
26 float ve; /*< True velocity in m/s in EAST direction in earth-fixed NED frame*/
27 float vd; /*< True velocity in m/s in DOWN direction in earth-fixed NED frame*/
28} mavlink_sim_state_t;
29
30#define MAVLINK_MSG_ID_SIM_STATE_LEN 84
31#define MAVLINK_MSG_ID_SIM_STATE_MIN_LEN 84
32#define MAVLINK_MSG_ID_108_LEN 84
33#define MAVLINK_MSG_ID_108_MIN_LEN 84
34
35#define MAVLINK_MSG_ID_SIM_STATE_CRC 32
36#define MAVLINK_MSG_ID_108_CRC 32
37
38
39
40#if MAVLINK_COMMAND_24BIT
41#define MAVLINK_MESSAGE_INFO_SIM_STATE { \
42 108, \
43 "SIM_STATE", \
44 21, \
45 { { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \
46 { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \
47 { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \
48 { "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sim_state_t, q4) }, \
49 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sim_state_t, roll) }, \
50 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sim_state_t, pitch) }, \
51 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sim_state_t, yaw) }, \
52 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sim_state_t, xacc) }, \
53 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sim_state_t, yacc) }, \
54 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sim_state_t, zacc) }, \
55 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sim_state_t, xgyro) }, \
56 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_sim_state_t, ygyro) }, \
57 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_sim_state_t, zgyro) }, \
58 { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_sim_state_t, lat) }, \
59 { "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_sim_state_t, lon) }, \
60 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_sim_state_t, alt) }, \
61 { "std_dev_horz", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_sim_state_t, std_dev_horz) }, \
62 { "std_dev_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_sim_state_t, std_dev_vert) }, \
63 { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \
64 { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \
65 { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \
66 } \
67}
68#else
69#define MAVLINK_MESSAGE_INFO_SIM_STATE { \
70 "SIM_STATE", \
71 21, \
72 { { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \
73 { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \
74 { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \
75 { "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sim_state_t, q4) }, \
76 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sim_state_t, roll) }, \
77 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sim_state_t, pitch) }, \
78 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sim_state_t, yaw) }, \
79 { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sim_state_t, xacc) }, \
80 { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sim_state_t, yacc) }, \
81 { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sim_state_t, zacc) }, \
82 { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sim_state_t, xgyro) }, \
83 { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_sim_state_t, ygyro) }, \
84 { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_sim_state_t, zgyro) }, \
85 { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_sim_state_t, lat) }, \
86 { "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_sim_state_t, lon) }, \
87 { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_sim_state_t, alt) }, \
88 { "std_dev_horz", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_sim_state_t, std_dev_horz) }, \
89 { "std_dev_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_sim_state_t, std_dev_vert) }, \
90 { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \
91 { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \
92 { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \
93 } \
94}
95#endif
96
97/**
98 * @brief Pack a sim_state message
99 * @param system_id ID of this system
100 * @param component_id ID of this component (e.g. 200 for IMU)
101 * @param msg The MAVLink message to compress the data into
102 *
103 * @param q1 True attitude quaternion component 1, w (1 in null-rotation)
104 * @param q2 True attitude quaternion component 2, x (0 in null-rotation)
105 * @param q3 True attitude quaternion component 3, y (0 in null-rotation)
106 * @param q4 True attitude quaternion component 4, z (0 in null-rotation)
107 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
108 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
109 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
110 * @param xacc X acceleration m/s/s
111 * @param yacc Y acceleration m/s/s
112 * @param zacc Z acceleration m/s/s
113 * @param xgyro Angular speed around X axis rad/s
114 * @param ygyro Angular speed around Y axis rad/s
115 * @param zgyro Angular speed around Z axis rad/s
116 * @param lat Latitude in degrees
117 * @param lon Longitude in degrees
118 * @param alt Altitude in meters
119 * @param std_dev_horz Horizontal position standard deviation
120 * @param std_dev_vert Vertical position standard deviation
121 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
122 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
123 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
124 * @return length of the message in bytes (excluding serial stream start sign)
125 */
126static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
127 float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd)
128{
129#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
130 char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
131 _mav_put_float(buf, 0, q1);
132 _mav_put_float(buf, 4, q2);
133 _mav_put_float(buf, 8, q3);
134 _mav_put_float(buf, 12, q4);
135 _mav_put_float(buf, 16, roll);
136 _mav_put_float(buf, 20, pitch);
137 _mav_put_float(buf, 24, yaw);
138 _mav_put_float(buf, 28, xacc);
139 _mav_put_float(buf, 32, yacc);
140 _mav_put_float(buf, 36, zacc);
141 _mav_put_float(buf, 40, xgyro);
142 _mav_put_float(buf, 44, ygyro);
143 _mav_put_float(buf, 48, zgyro);
144 _mav_put_float(buf, 52, lat);
145 _mav_put_float(buf, 56, lon);
146 _mav_put_float(buf, 60, alt);
147 _mav_put_float(buf, 64, std_dev_horz);
148 _mav_put_float(buf, 68, std_dev_vert);
149 _mav_put_float(buf, 72, vn);
150 _mav_put_float(buf, 76, ve);
151 _mav_put_float(buf, 80, vd);
152
153 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN);
154#else
155 mavlink_sim_state_t packet;
156 packet.q1 = q1;
157 packet.q2 = q2;
158 packet.q3 = q3;
159 packet.q4 = q4;
160 packet.roll = roll;
161 packet.pitch = pitch;
162 packet.yaw = yaw;
163 packet.xacc = xacc;
164 packet.yacc = yacc;
165 packet.zacc = zacc;
166 packet.xgyro = xgyro;
167 packet.ygyro = ygyro;
168 packet.zgyro = zgyro;
169 packet.lat = lat;
170 packet.lon = lon;
171 packet.alt = alt;
172 packet.std_dev_horz = std_dev_horz;
173 packet.std_dev_vert = std_dev_vert;
174 packet.vn = vn;
175 packet.ve = ve;
176 packet.vd = vd;
177
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN);
179#endif
180
181 msg->msgid = MAVLINK_MSG_ID_SIM_STATE;
182 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
183}
184
185/**
186 * @brief Pack a sim_state message on a channel
187 * @param system_id ID of this system
188 * @param component_id ID of this component (e.g. 200 for IMU)
189 * @param chan The MAVLink channel this message will be sent over
190 * @param msg The MAVLink message to compress the data into
191 * @param q1 True attitude quaternion component 1, w (1 in null-rotation)
192 * @param q2 True attitude quaternion component 2, x (0 in null-rotation)
193 * @param q3 True attitude quaternion component 3, y (0 in null-rotation)
194 * @param q4 True attitude quaternion component 4, z (0 in null-rotation)
195 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
196 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
197 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
198 * @param xacc X acceleration m/s/s
199 * @param yacc Y acceleration m/s/s
200 * @param zacc Z acceleration m/s/s
201 * @param xgyro Angular speed around X axis rad/s
202 * @param ygyro Angular speed around Y axis rad/s
203 * @param zgyro Angular speed around Z axis rad/s
204 * @param lat Latitude in degrees
205 * @param lon Longitude in degrees
206 * @param alt Altitude in meters
207 * @param std_dev_horz Horizontal position standard deviation
208 * @param std_dev_vert Vertical position standard deviation
209 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
210 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
211 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
212 * @return length of the message in bytes (excluding serial stream start sign)
213 */
214static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
215 mavlink_message_t* msg,
216 float q1,float q2,float q3,float q4,float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float lat,float lon,float alt,float std_dev_horz,float std_dev_vert,float vn,float ve,float vd)
217{
218#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
219 char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
220 _mav_put_float(buf, 0, q1);
221 _mav_put_float(buf, 4, q2);
222 _mav_put_float(buf, 8, q3);
223 _mav_put_float(buf, 12, q4);
224 _mav_put_float(buf, 16, roll);
225 _mav_put_float(buf, 20, pitch);
226 _mav_put_float(buf, 24, yaw);
227 _mav_put_float(buf, 28, xacc);
228 _mav_put_float(buf, 32, yacc);
229 _mav_put_float(buf, 36, zacc);
230 _mav_put_float(buf, 40, xgyro);
231 _mav_put_float(buf, 44, ygyro);
232 _mav_put_float(buf, 48, zgyro);
233 _mav_put_float(buf, 52, lat);
234 _mav_put_float(buf, 56, lon);
235 _mav_put_float(buf, 60, alt);
236 _mav_put_float(buf, 64, std_dev_horz);
237 _mav_put_float(buf, 68, std_dev_vert);
238 _mav_put_float(buf, 72, vn);
239 _mav_put_float(buf, 76, ve);
240 _mav_put_float(buf, 80, vd);
241
242 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN);
243#else
244 mavlink_sim_state_t packet;
245 packet.q1 = q1;
246 packet.q2 = q2;
247 packet.q3 = q3;
248 packet.q4 = q4;
249 packet.roll = roll;
250 packet.pitch = pitch;
251 packet.yaw = yaw;
252 packet.xacc = xacc;
253 packet.yacc = yacc;
254 packet.zacc = zacc;
255 packet.xgyro = xgyro;
256 packet.ygyro = ygyro;
257 packet.zgyro = zgyro;
258 packet.lat = lat;
259 packet.lon = lon;
260 packet.alt = alt;
261 packet.std_dev_horz = std_dev_horz;
262 packet.std_dev_vert = std_dev_vert;
263 packet.vn = vn;
264 packet.ve = ve;
265 packet.vd = vd;
266
267 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN);
268#endif
269
270 msg->msgid = MAVLINK_MSG_ID_SIM_STATE;
271 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
272}
273
274/**
275 * @brief Encode a sim_state struct
276 *
277 * @param system_id ID of this system
278 * @param component_id ID of this component (e.g. 200 for IMU)
279 * @param msg The MAVLink message to compress the data into
280 * @param sim_state C-struct to read the message contents from
281 */
282static inline uint16_t mavlink_msg_sim_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state)
283{
284 return mavlink_msg_sim_state_pack(system_id, component_id, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd);
285}
286
287/**
288 * @brief Encode a sim_state struct on a channel
289 *
290 * @param system_id ID of this system
291 * @param component_id ID of this component (e.g. 200 for IMU)
292 * @param chan The MAVLink channel this message will be sent over
293 * @param msg The MAVLink message to compress the data into
294 * @param sim_state C-struct to read the message contents from
295 */
296static inline uint16_t mavlink_msg_sim_state_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state)
297{
298 return mavlink_msg_sim_state_pack_chan(system_id, component_id, chan, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd);
299}
300
301/**
302 * @brief Send a sim_state message
303 * @param chan MAVLink channel to send the message
304 *
305 * @param q1 True attitude quaternion component 1, w (1 in null-rotation)
306 * @param q2 True attitude quaternion component 2, x (0 in null-rotation)
307 * @param q3 True attitude quaternion component 3, y (0 in null-rotation)
308 * @param q4 True attitude quaternion component 4, z (0 in null-rotation)
309 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
310 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
311 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
312 * @param xacc X acceleration m/s/s
313 * @param yacc Y acceleration m/s/s
314 * @param zacc Z acceleration m/s/s
315 * @param xgyro Angular speed around X axis rad/s
316 * @param ygyro Angular speed around Y axis rad/s
317 * @param zgyro Angular speed around Z axis rad/s
318 * @param lat Latitude in degrees
319 * @param lon Longitude in degrees
320 * @param alt Altitude in meters
321 * @param std_dev_horz Horizontal position standard deviation
322 * @param std_dev_vert Vertical position standard deviation
323 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
324 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
325 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
326 */
327#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
328
329static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd)
330{
331#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
332 char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
333 _mav_put_float(buf, 0, q1);
334 _mav_put_float(buf, 4, q2);
335 _mav_put_float(buf, 8, q3);
336 _mav_put_float(buf, 12, q4);
337 _mav_put_float(buf, 16, roll);
338 _mav_put_float(buf, 20, pitch);
339 _mav_put_float(buf, 24, yaw);
340 _mav_put_float(buf, 28, xacc);
341 _mav_put_float(buf, 32, yacc);
342 _mav_put_float(buf, 36, zacc);
343 _mav_put_float(buf, 40, xgyro);
344 _mav_put_float(buf, 44, ygyro);
345 _mav_put_float(buf, 48, zgyro);
346 _mav_put_float(buf, 52, lat);
347 _mav_put_float(buf, 56, lon);
348 _mav_put_float(buf, 60, alt);
349 _mav_put_float(buf, 64, std_dev_horz);
350 _mav_put_float(buf, 68, std_dev_vert);
351 _mav_put_float(buf, 72, vn);
352 _mav_put_float(buf, 76, ve);
353 _mav_put_float(buf, 80, vd);
354
355 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
356#else
357 mavlink_sim_state_t packet;
358 packet.q1 = q1;
359 packet.q2 = q2;
360 packet.q3 = q3;
361 packet.q4 = q4;
362 packet.roll = roll;
363 packet.pitch = pitch;
364 packet.yaw = yaw;
365 packet.xacc = xacc;
366 packet.yacc = yacc;
367 packet.zacc = zacc;
368 packet.xgyro = xgyro;
369 packet.ygyro = ygyro;
370 packet.zgyro = zgyro;
371 packet.lat = lat;
372 packet.lon = lon;
373 packet.alt = alt;
374 packet.std_dev_horz = std_dev_horz;
375 packet.std_dev_vert = std_dev_vert;
376 packet.vn = vn;
377 packet.ve = ve;
378 packet.vd = vd;
379
380 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)&packet, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
381#endif
382}
383
384/**
385 * @brief Send a sim_state message
386 * @param chan MAVLink channel to send the message
387 * @param struct The MAVLink struct to serialize
388 */
389static inline void mavlink_msg_sim_state_send_struct(mavlink_channel_t chan, const mavlink_sim_state_t* sim_state)
390{
391#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
392 mavlink_msg_sim_state_send(chan, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd);
393#else
394 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)sim_state, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
395#endif
396}
397
398#if MAVLINK_MSG_ID_SIM_STATE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
399/*
400 This varient of _send() can be used to save stack space by re-using
401 memory from the receive buffer. The caller provides a
402 mavlink_message_t which is the size of a full mavlink message. This
403 is usually the receive buffer for the channel, and allows a reply to an
404 incoming message with minimum stack space usage.
405 */
406static inline void mavlink_msg_sim_state_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd)
407{
408#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
409 char *buf = (char *)msgbuf;
410 _mav_put_float(buf, 0, q1);
411 _mav_put_float(buf, 4, q2);
412 _mav_put_float(buf, 8, q3);
413 _mav_put_float(buf, 12, q4);
414 _mav_put_float(buf, 16, roll);
415 _mav_put_float(buf, 20, pitch);
416 _mav_put_float(buf, 24, yaw);
417 _mav_put_float(buf, 28, xacc);
418 _mav_put_float(buf, 32, yacc);
419 _mav_put_float(buf, 36, zacc);
420 _mav_put_float(buf, 40, xgyro);
421 _mav_put_float(buf, 44, ygyro);
422 _mav_put_float(buf, 48, zgyro);
423 _mav_put_float(buf, 52, lat);
424 _mav_put_float(buf, 56, lon);
425 _mav_put_float(buf, 60, alt);
426 _mav_put_float(buf, 64, std_dev_horz);
427 _mav_put_float(buf, 68, std_dev_vert);
428 _mav_put_float(buf, 72, vn);
429 _mav_put_float(buf, 76, ve);
430 _mav_put_float(buf, 80, vd);
431
432 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
433#else
434 mavlink_sim_state_t *packet = (mavlink_sim_state_t *)msgbuf;
435 packet->q1 = q1;
436 packet->q2 = q2;
437 packet->q3 = q3;
438 packet->q4 = q4;
439 packet->roll = roll;
440 packet->pitch = pitch;
441 packet->yaw = yaw;
442 packet->xacc = xacc;
443 packet->yacc = yacc;
444 packet->zacc = zacc;
445 packet->xgyro = xgyro;
446 packet->ygyro = ygyro;
447 packet->zgyro = zgyro;
448 packet->lat = lat;
449 packet->lon = lon;
450 packet->alt = alt;
451 packet->std_dev_horz = std_dev_horz;
452 packet->std_dev_vert = std_dev_vert;
453 packet->vn = vn;
454 packet->ve = ve;
455 packet->vd = vd;
456
457 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)packet, MAVLINK_MSG_ID_SIM_STATE_MIN_LEN, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
458#endif
459}
460#endif
461
462#endif
463
464// MESSAGE SIM_STATE UNPACKING
465
466
467/**
468 * @brief Get field q1 from sim_state message
469 *
470 * @return True attitude quaternion component 1, w (1 in null-rotation)
471 */
472static inline float mavlink_msg_sim_state_get_q1(const mavlink_message_t* msg)
473{
474 return _MAV_RETURN_float(msg, 0);
475}
476
477/**
478 * @brief Get field q2 from sim_state message
479 *
480 * @return True attitude quaternion component 2, x (0 in null-rotation)
481 */
482static inline float mavlink_msg_sim_state_get_q2(const mavlink_message_t* msg)
483{
484 return _MAV_RETURN_float(msg, 4);
485}
486
487/**
488 * @brief Get field q3 from sim_state message
489 *
490 * @return True attitude quaternion component 3, y (0 in null-rotation)
491 */
492static inline float mavlink_msg_sim_state_get_q3(const mavlink_message_t* msg)
493{
494 return _MAV_RETURN_float(msg, 8);
495}
496
497/**
498 * @brief Get field q4 from sim_state message
499 *
500 * @return True attitude quaternion component 4, z (0 in null-rotation)
501 */
502static inline float mavlink_msg_sim_state_get_q4(const mavlink_message_t* msg)
503{
504 return _MAV_RETURN_float(msg, 12);
505}
506
507/**
508 * @brief Get field roll from sim_state message
509 *
510 * @return Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
511 */
512static inline float mavlink_msg_sim_state_get_roll(const mavlink_message_t* msg)
513{
514 return _MAV_RETURN_float(msg, 16);
515}
516
517/**
518 * @brief Get field pitch from sim_state message
519 *
520 * @return Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
521 */
522static inline float mavlink_msg_sim_state_get_pitch(const mavlink_message_t* msg)
523{
524 return _MAV_RETURN_float(msg, 20);
525}
526
527/**
528 * @brief Get field yaw from sim_state message
529 *
530 * @return Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
531 */
532static inline float mavlink_msg_sim_state_get_yaw(const mavlink_message_t* msg)
533{
534 return _MAV_RETURN_float(msg, 24);
535}
536
537/**
538 * @brief Get field xacc from sim_state message
539 *
540 * @return X acceleration m/s/s
541 */
542static inline float mavlink_msg_sim_state_get_xacc(const mavlink_message_t* msg)
543{
544 return _MAV_RETURN_float(msg, 28);
545}
546
547/**
548 * @brief Get field yacc from sim_state message
549 *
550 * @return Y acceleration m/s/s
551 */
552static inline float mavlink_msg_sim_state_get_yacc(const mavlink_message_t* msg)
553{
554 return _MAV_RETURN_float(msg, 32);
555}
556
557/**
558 * @brief Get field zacc from sim_state message
559 *
560 * @return Z acceleration m/s/s
561 */
562static inline float mavlink_msg_sim_state_get_zacc(const mavlink_message_t* msg)
563{
564 return _MAV_RETURN_float(msg, 36);
565}
566
567/**
568 * @brief Get field xgyro from sim_state message
569 *
570 * @return Angular speed around X axis rad/s
571 */
572static inline float mavlink_msg_sim_state_get_xgyro(const mavlink_message_t* msg)
573{
574 return _MAV_RETURN_float(msg, 40);
575}
576
577/**
578 * @brief Get field ygyro from sim_state message
579 *
580 * @return Angular speed around Y axis rad/s
581 */
582static inline float mavlink_msg_sim_state_get_ygyro(const mavlink_message_t* msg)
583{
584 return _MAV_RETURN_float(msg, 44);
585}
586
587/**
588 * @brief Get field zgyro from sim_state message
589 *
590 * @return Angular speed around Z axis rad/s
591 */
592static inline float mavlink_msg_sim_state_get_zgyro(const mavlink_message_t* msg)
593{
594 return _MAV_RETURN_float(msg, 48);
595}
596
597/**
598 * @brief Get field lat from sim_state message
599 *
600 * @return Latitude in degrees
601 */
602static inline float mavlink_msg_sim_state_get_lat(const mavlink_message_t* msg)
603{
604 return _MAV_RETURN_float(msg, 52);
605}
606
607/**
608 * @brief Get field lon from sim_state message
609 *
610 * @return Longitude in degrees
611 */
612static inline float mavlink_msg_sim_state_get_lon(const mavlink_message_t* msg)
613{
614 return _MAV_RETURN_float(msg, 56);
615}
616
617/**
618 * @brief Get field alt from sim_state message
619 *
620 * @return Altitude in meters
621 */
622static inline float mavlink_msg_sim_state_get_alt(const mavlink_message_t* msg)
623{
624 return _MAV_RETURN_float(msg, 60);
625}
626
627/**
628 * @brief Get field std_dev_horz from sim_state message
629 *
630 * @return Horizontal position standard deviation
631 */
632static inline float mavlink_msg_sim_state_get_std_dev_horz(const mavlink_message_t* msg)
633{
634 return _MAV_RETURN_float(msg, 64);
635}
636
637/**
638 * @brief Get field std_dev_vert from sim_state message
639 *
640 * @return Vertical position standard deviation
641 */
642static inline float mavlink_msg_sim_state_get_std_dev_vert(const mavlink_message_t* msg)
643{
644 return _MAV_RETURN_float(msg, 68);
645}
646
647/**
648 * @brief Get field vn from sim_state message
649 *
650 * @return True velocity in m/s in NORTH direction in earth-fixed NED frame
651 */
652static inline float mavlink_msg_sim_state_get_vn(const mavlink_message_t* msg)
653{
654 return _MAV_RETURN_float(msg, 72);
655}
656
657/**
658 * @brief Get field ve from sim_state message
659 *
660 * @return True velocity in m/s in EAST direction in earth-fixed NED frame
661 */
662static inline float mavlink_msg_sim_state_get_ve(const mavlink_message_t* msg)
663{
664 return _MAV_RETURN_float(msg, 76);
665}
666
667/**
668 * @brief Get field vd from sim_state message
669 *
670 * @return True velocity in m/s in DOWN direction in earth-fixed NED frame
671 */
672static inline float mavlink_msg_sim_state_get_vd(const mavlink_message_t* msg)
673{
674 return _MAV_RETURN_float(msg, 80);
675}
676
677/**
678 * @brief Decode a sim_state message into a struct
679 *
680 * @param msg The message to decode
681 * @param sim_state C-struct to decode the message contents into
682 */
683static inline void mavlink_msg_sim_state_decode(const mavlink_message_t* msg, mavlink_sim_state_t* sim_state)
684{
685#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
686 sim_state->q1 = mavlink_msg_sim_state_get_q1(msg);
687 sim_state->q2 = mavlink_msg_sim_state_get_q2(msg);
688 sim_state->q3 = mavlink_msg_sim_state_get_q3(msg);
689 sim_state->q4 = mavlink_msg_sim_state_get_q4(msg);
690 sim_state->roll = mavlink_msg_sim_state_get_roll(msg);
691 sim_state->pitch = mavlink_msg_sim_state_get_pitch(msg);
692 sim_state->yaw = mavlink_msg_sim_state_get_yaw(msg);
693 sim_state->xacc = mavlink_msg_sim_state_get_xacc(msg);
694 sim_state->yacc = mavlink_msg_sim_state_get_yacc(msg);
695 sim_state->zacc = mavlink_msg_sim_state_get_zacc(msg);
696 sim_state->xgyro = mavlink_msg_sim_state_get_xgyro(msg);
697 sim_state->ygyro = mavlink_msg_sim_state_get_ygyro(msg);
698 sim_state->zgyro = mavlink_msg_sim_state_get_zgyro(msg);
699 sim_state->lat = mavlink_msg_sim_state_get_lat(msg);
700 sim_state->lon = mavlink_msg_sim_state_get_lon(msg);
701 sim_state->alt = mavlink_msg_sim_state_get_alt(msg);
702 sim_state->std_dev_horz = mavlink_msg_sim_state_get_std_dev_horz(msg);
703 sim_state->std_dev_vert = mavlink_msg_sim_state_get_std_dev_vert(msg);
704 sim_state->vn = mavlink_msg_sim_state_get_vn(msg);
705 sim_state->ve = mavlink_msg_sim_state_get_ve(msg);
706 sim_state->vd = mavlink_msg_sim_state_get_vd(msg);
707#else
708 uint8_t len = msg->len < MAVLINK_MSG_ID_SIM_STATE_LEN? msg->len : MAVLINK_MSG_ID_SIM_STATE_LEN;
709 memset(sim_state, 0, MAVLINK_MSG_ID_SIM_STATE_LEN);
710 memcpy(sim_state, _MAV_PAYLOAD(msg), len);
711#endif
712}
Note: See TracBrowser for help on using the repository browser.