aboutsummaryrefslogtreecommitdiff
path: root/mavlink/include/mavlink/v1.0/common/mavlink_msg_sim_state.h
blob: ebd657cf38bcc47b3b3a6f191b61775407953735 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
// MESSAGE SIM_STATE PACKING

#define MAVLINK_MSG_ID_SIM_STATE 108

typedef struct __mavlink_sim_state_t
{
 float q1; ///< True attitude quaternion component 1
 float q2; ///< True attitude quaternion component 2
 float q3; ///< True attitude quaternion component 3
 float q4; ///< True attitude quaternion component 4
 float roll; ///< Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
 float pitch; ///< Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
 float yaw; ///< Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
 float xacc; ///< X acceleration m/s/s
 float yacc; ///< Y acceleration m/s/s
 float zacc; ///< Z acceleration m/s/s
 float xgyro; ///< Angular speed around X axis rad/s
 float ygyro; ///< Angular speed around Y axis rad/s
 float zgyro; ///< Angular speed around Z axis rad/s
 float lat; ///< Latitude in degrees
 float lon; ///< Longitude in degrees
 float alt; ///< Altitude in meters
 float std_dev_horz; ///< Horizontal position standard deviation
 float std_dev_vert; ///< Vertical position standard deviation
 float vn; ///< True velocity in m/s in NORTH direction in earth-fixed NED frame
 float ve; ///< True velocity in m/s in EAST direction in earth-fixed NED frame
 float vd; ///< True velocity in m/s in DOWN direction in earth-fixed NED frame
} mavlink_sim_state_t;

#define MAVLINK_MSG_ID_SIM_STATE_LEN 84
#define MAVLINK_MSG_ID_108_LEN 84

#define MAVLINK_MSG_ID_SIM_STATE_CRC 32
#define MAVLINK_MSG_ID_108_CRC 32



#define MAVLINK_MESSAGE_INFO_SIM_STATE { \
	"SIM_STATE", \
	21, \
	{  { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \
         { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \
         { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \
         { "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sim_state_t, q4) }, \
         { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sim_state_t, roll) }, \
         { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sim_state_t, pitch) }, \
         { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sim_state_t, yaw) }, \
         { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sim_state_t, xacc) }, \
         { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sim_state_t, yacc) }, \
         { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sim_state_t, zacc) }, \
         { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sim_state_t, xgyro) }, \
         { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_sim_state_t, ygyro) }, \
         { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_sim_state_t, zgyro) }, \
         { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_sim_state_t, lat) }, \
         { "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_sim_state_t, lon) }, \
         { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_sim_state_t, alt) }, \
         { "std_dev_horz", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_sim_state_t, std_dev_horz) }, \
         { "std_dev_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_sim_state_t, std_dev_vert) }, \
         { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \
         { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \
         { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \
         } \
}


/**
 * @brief Pack a sim_state message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param q1 True attitude quaternion component 1
 * @param q2 True attitude quaternion component 2
 * @param q3 True attitude quaternion component 3
 * @param q4 True attitude quaternion component 4
 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
 * @param xacc X acceleration m/s/s
 * @param yacc Y acceleration m/s/s
 * @param zacc Z acceleration m/s/s
 * @param xgyro Angular speed around X axis rad/s
 * @param ygyro Angular speed around Y axis rad/s
 * @param zgyro Angular speed around Z axis rad/s
 * @param lat Latitude in degrees
 * @param lon Longitude in degrees
 * @param alt Altitude in meters
 * @param std_dev_horz Horizontal position standard deviation
 * @param std_dev_vert Vertical position standard deviation
 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       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)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
	_mav_put_float(buf, 0, q1);
	_mav_put_float(buf, 4, q2);
	_mav_put_float(buf, 8, q3);
	_mav_put_float(buf, 12, q4);
	_mav_put_float(buf, 16, roll);
	_mav_put_float(buf, 20, pitch);
	_mav_put_float(buf, 24, yaw);
	_mav_put_float(buf, 28, xacc);
	_mav_put_float(buf, 32, yacc);
	_mav_put_float(buf, 36, zacc);
	_mav_put_float(buf, 40, xgyro);
	_mav_put_float(buf, 44, ygyro);
	_mav_put_float(buf, 48, zgyro);
	_mav_put_float(buf, 52, lat);
	_mav_put_float(buf, 56, lon);
	_mav_put_float(buf, 60, alt);
	_mav_put_float(buf, 64, std_dev_horz);
	_mav_put_float(buf, 68, std_dev_vert);
	_mav_put_float(buf, 72, vn);
	_mav_put_float(buf, 76, ve);
	_mav_put_float(buf, 80, vd);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN);
#else
	mavlink_sim_state_t packet;
	packet.q1 = q1;
	packet.q2 = q2;
	packet.q3 = q3;
	packet.q4 = q4;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.xacc = xacc;
	packet.yacc = yacc;
	packet.zacc = zacc;
	packet.xgyro = xgyro;
	packet.ygyro = ygyro;
	packet.zgyro = zgyro;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.std_dev_horz = std_dev_horz;
	packet.std_dev_vert = std_dev_vert;
	packet.vn = vn;
	packet.ve = ve;
	packet.vd = vd;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_SIM_STATE;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
#else
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif
}

/**
 * @brief Pack a sim_state message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param q1 True attitude quaternion component 1
 * @param q2 True attitude quaternion component 2
 * @param q3 True attitude quaternion component 3
 * @param q4 True attitude quaternion component 4
 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
 * @param xacc X acceleration m/s/s
 * @param yacc Y acceleration m/s/s
 * @param zacc Z acceleration m/s/s
 * @param xgyro Angular speed around X axis rad/s
 * @param ygyro Angular speed around Y axis rad/s
 * @param zgyro Angular speed around Z axis rad/s
 * @param lat Latitude in degrees
 * @param lon Longitude in degrees
 * @param alt Altitude in meters
 * @param std_dev_horz Horizontal position standard deviation
 * @param std_dev_vert Vertical position standard deviation
 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           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)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
	_mav_put_float(buf, 0, q1);
	_mav_put_float(buf, 4, q2);
	_mav_put_float(buf, 8, q3);
	_mav_put_float(buf, 12, q4);
	_mav_put_float(buf, 16, roll);
	_mav_put_float(buf, 20, pitch);
	_mav_put_float(buf, 24, yaw);
	_mav_put_float(buf, 28, xacc);
	_mav_put_float(buf, 32, yacc);
	_mav_put_float(buf, 36, zacc);
	_mav_put_float(buf, 40, xgyro);
	_mav_put_float(buf, 44, ygyro);
	_mav_put_float(buf, 48, zgyro);
	_mav_put_float(buf, 52, lat);
	_mav_put_float(buf, 56, lon);
	_mav_put_float(buf, 60, alt);
	_mav_put_float(buf, 64, std_dev_horz);
	_mav_put_float(buf, 68, std_dev_vert);
	_mav_put_float(buf, 72, vn);
	_mav_put_float(buf, 76, ve);
	_mav_put_float(buf, 80, vd);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN);
#else
	mavlink_sim_state_t packet;
	packet.q1 = q1;
	packet.q2 = q2;
	packet.q3 = q3;
	packet.q4 = q4;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.xacc = xacc;
	packet.yacc = yacc;
	packet.zacc = zacc;
	packet.xgyro = xgyro;
	packet.ygyro = ygyro;
	packet.zgyro = zgyro;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.std_dev_horz = std_dev_horz;
	packet.std_dev_vert = std_dev_vert;
	packet.vn = vn;
	packet.ve = ve;
	packet.vd = vd;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_SIM_STATE;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
#else
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif
}

/**
 * @brief Encode a sim_state struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param sim_state C-struct to read the message contents from
 */
static 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)
{
	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);
}

/**
 * @brief Encode a sim_state struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param sim_state C-struct to read the message contents from
 */
static 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)
{
	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);
}

/**
 * @brief Send a sim_state message
 * @param chan MAVLink channel to send the message
 *
 * @param q1 True attitude quaternion component 1
 * @param q2 True attitude quaternion component 2
 * @param q3 True attitude quaternion component 3
 * @param q4 True attitude quaternion component 4
 * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
 * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
 * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
 * @param xacc X acceleration m/s/s
 * @param yacc Y acceleration m/s/s
 * @param zacc Z acceleration m/s/s
 * @param xgyro Angular speed around X axis rad/s
 * @param ygyro Angular speed around Y axis rad/s
 * @param zgyro Angular speed around Z axis rad/s
 * @param lat Latitude in degrees
 * @param lon Longitude in degrees
 * @param alt Altitude in meters
 * @param std_dev_horz Horizontal position standard deviation
 * @param std_dev_vert Vertical position standard deviation
 * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame
 * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame
 * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static 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)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_SIM_STATE_LEN];
	_mav_put_float(buf, 0, q1);
	_mav_put_float(buf, 4, q2);
	_mav_put_float(buf, 8, q3);
	_mav_put_float(buf, 12, q4);
	_mav_put_float(buf, 16, roll);
	_mav_put_float(buf, 20, pitch);
	_mav_put_float(buf, 24, yaw);
	_mav_put_float(buf, 28, xacc);
	_mav_put_float(buf, 32, yacc);
	_mav_put_float(buf, 36, zacc);
	_mav_put_float(buf, 40, xgyro);
	_mav_put_float(buf, 44, ygyro);
	_mav_put_float(buf, 48, zgyro);
	_mav_put_float(buf, 52, lat);
	_mav_put_float(buf, 56, lon);
	_mav_put_float(buf, 60, alt);
	_mav_put_float(buf, 64, std_dev_horz);
	_mav_put_float(buf, 68, std_dev_vert);
	_mav_put_float(buf, 72, vn);
	_mav_put_float(buf, 76, ve);
	_mav_put_float(buf, 80, vd);

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif
#else
	mavlink_sim_state_t packet;
	packet.q1 = q1;
	packet.q2 = q2;
	packet.q3 = q3;
	packet.q4 = q4;
	packet.roll = roll;
	packet.pitch = pitch;
	packet.yaw = yaw;
	packet.xacc = xacc;
	packet.yacc = yacc;
	packet.zacc = zacc;
	packet.xgyro = xgyro;
	packet.ygyro = ygyro;
	packet.zgyro = zgyro;
	packet.lat = lat;
	packet.lon = lon;
	packet.alt = alt;
	packet.std_dev_horz = std_dev_horz;
	packet.std_dev_vert = std_dev_vert;
	packet.vn = vn;
	packet.ve = ve;
	packet.vd = vd;

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)&packet, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)&packet, MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif
#endif
}

#endif

// MESSAGE SIM_STATE UNPACKING


/**
 * @brief Get field q1 from sim_state message
 *
 * @return True attitude quaternion component 1
 */
static inline float mavlink_msg_sim_state_get_q1(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  0);
}

/**
 * @brief Get field q2 from sim_state message
 *
 * @return True attitude quaternion component 2
 */
static inline float mavlink_msg_sim_state_get_q2(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field q3 from sim_state message
 *
 * @return True attitude quaternion component 3
 */
static inline float mavlink_msg_sim_state_get_q3(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field q4 from sim_state message
 *
 * @return True attitude quaternion component 4
 */
static inline float mavlink_msg_sim_state_get_q4(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field roll from sim_state message
 *
 * @return Attitude roll expressed as Euler angles, not recommended except for human-readable outputs
 */
static inline float mavlink_msg_sim_state_get_roll(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field pitch from sim_state message
 *
 * @return Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs
 */
static inline float mavlink_msg_sim_state_get_pitch(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field yaw from sim_state message
 *
 * @return Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs
 */
static inline float mavlink_msg_sim_state_get_yaw(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Get field xacc from sim_state message
 *
 * @return X acceleration m/s/s
 */
static inline float mavlink_msg_sim_state_get_xacc(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  28);
}

/**
 * @brief Get field yacc from sim_state message
 *
 * @return Y acceleration m/s/s
 */
static inline float mavlink_msg_sim_state_get_yacc(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  32);
}

/**
 * @brief Get field zacc from sim_state message
 *
 * @return Z acceleration m/s/s
 */
static inline float mavlink_msg_sim_state_get_zacc(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  36);
}

/**
 * @brief Get field xgyro from sim_state message
 *
 * @return Angular speed around X axis rad/s
 */
static inline float mavlink_msg_sim_state_get_xgyro(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  40);
}

/**
 * @brief Get field ygyro from sim_state message
 *
 * @return Angular speed around Y axis rad/s
 */
static inline float mavlink_msg_sim_state_get_ygyro(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  44);
}

/**
 * @brief Get field zgyro from sim_state message
 *
 * @return Angular speed around Z axis rad/s
 */
static inline float mavlink_msg_sim_state_get_zgyro(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  48);
}

/**
 * @brief Get field lat from sim_state message
 *
 * @return Latitude in degrees
 */
static inline float mavlink_msg_sim_state_get_lat(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  52);
}

/**
 * @brief Get field lon from sim_state message
 *
 * @return Longitude in degrees
 */
static inline float mavlink_msg_sim_state_get_lon(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  56);
}

/**
 * @brief Get field alt from sim_state message
 *
 * @return Altitude in meters
 */
static inline float mavlink_msg_sim_state_get_alt(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  60);
}

/**
 * @brief Get field std_dev_horz from sim_state message
 *
 * @return Horizontal position standard deviation
 */
static inline float mavlink_msg_sim_state_get_std_dev_horz(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  64);
}

/**
 * @brief Get field std_dev_vert from sim_state message
 *
 * @return Vertical position standard deviation
 */
static inline float mavlink_msg_sim_state_get_std_dev_vert(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  68);
}

/**
 * @brief Get field vn from sim_state message
 *
 * @return True velocity in m/s in NORTH direction in earth-fixed NED frame
 */
static inline float mavlink_msg_sim_state_get_vn(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  72);
}

/**
 * @brief Get field ve from sim_state message
 *
 * @return True velocity in m/s in EAST direction in earth-fixed NED frame
 */
static inline float mavlink_msg_sim_state_get_ve(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  76);
}

/**
 * @brief Get field vd from sim_state message
 *
 * @return True velocity in m/s in DOWN direction in earth-fixed NED frame
 */
static inline float mavlink_msg_sim_state_get_vd(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  80);
}

/**
 * @brief Decode a sim_state message into a struct
 *
 * @param msg The message to decode
 * @param sim_state C-struct to decode the message contents into
 */
static inline void mavlink_msg_sim_state_decode(const mavlink_message_t* msg, mavlink_sim_state_t* sim_state)
{
#if MAVLINK_NEED_BYTE_SWAP
	sim_state->q1 = mavlink_msg_sim_state_get_q1(msg);
	sim_state->q2 = mavlink_msg_sim_state_get_q2(msg);
	sim_state->q3 = mavlink_msg_sim_state_get_q3(msg);
	sim_state->q4 = mavlink_msg_sim_state_get_q4(msg);
	sim_state->roll = mavlink_msg_sim_state_get_roll(msg);
	sim_state->pitch = mavlink_msg_sim_state_get_pitch(msg);
	sim_state->yaw = mavlink_msg_sim_state_get_yaw(msg);
	sim_state->xacc = mavlink_msg_sim_state_get_xacc(msg);
	sim_state->yacc = mavlink_msg_sim_state_get_yacc(msg);
	sim_state->zacc = mavlink_msg_sim_state_get_zacc(msg);
	sim_state->xgyro = mavlink_msg_sim_state_get_xgyro(msg);
	sim_state->ygyro = mavlink_msg_sim_state_get_ygyro(msg);
	sim_state->zgyro = mavlink_msg_sim_state_get_zgyro(msg);
	sim_state->lat = mavlink_msg_sim_state_get_lat(msg);
	sim_state->lon = mavlink_msg_sim_state_get_lon(msg);
	sim_state->alt = mavlink_msg_sim_state_get_alt(msg);
	sim_state->std_dev_horz = mavlink_msg_sim_state_get_std_dev_horz(msg);
	sim_state->std_dev_vert = mavlink_msg_sim_state_get_std_dev_vert(msg);
	sim_state->vn = mavlink_msg_sim_state_get_vn(msg);
	sim_state->ve = mavlink_msg_sim_state_get_ve(msg);
	sim_state->vd = mavlink_msg_sim_state_get_vd(msg);
#else
	memcpy(sim_state, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SIM_STATE_LEN);
#endif
}