RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_ahrs3.h
1#pragma once
2// MESSAGE AHRS3 PACKING
3
4#define MAVLINK_MSG_ID_AHRS3 182
5
6MAVPACKED(
7typedef struct __mavlink_ahrs3_t {
8 float roll; /*< Roll angle (rad)*/
9 float pitch; /*< Pitch angle (rad)*/
10 float yaw; /*< Yaw angle (rad)*/
11 float altitude; /*< Altitude (MSL)*/
12 int32_t lat; /*< Latitude in degrees * 1E7*/
13 int32_t lng; /*< Longitude in degrees * 1E7*/
14 float v1; /*< test variable1*/
15 float v2; /*< test variable2*/
16 float v3; /*< test variable3*/
17 float v4; /*< test variable4*/
18}) mavlink_ahrs3_t;
19
20#define MAVLINK_MSG_ID_AHRS3_LEN 40
21#define MAVLINK_MSG_ID_AHRS3_MIN_LEN 40
22#define MAVLINK_MSG_ID_182_LEN 40
23#define MAVLINK_MSG_ID_182_MIN_LEN 40
24
25#define MAVLINK_MSG_ID_AHRS3_CRC 229
26#define MAVLINK_MSG_ID_182_CRC 229
27
28
29
30#if MAVLINK_COMMAND_24BIT
31#define MAVLINK_MESSAGE_INFO_AHRS3 { \
32 182, \
33 "AHRS3", \
34 10, \
35 { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs3_t, roll) }, \
36 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs3_t, pitch) }, \
37 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs3_t, yaw) }, \
38 { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs3_t, altitude) }, \
39 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs3_t, lat) }, \
40 { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs3_t, lng) }, \
41 { "v1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs3_t, v1) }, \
42 { "v2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ahrs3_t, v2) }, \
43 { "v3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_ahrs3_t, v3) }, \
44 { "v4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_ahrs3_t, v4) }, \
45 } \
46}
47#else
48#define MAVLINK_MESSAGE_INFO_AHRS3 { \
49 "AHRS3", \
50 10, \
51 { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_ahrs3_t, roll) }, \
52 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_ahrs3_t, pitch) }, \
53 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ahrs3_t, yaw) }, \
54 { "altitude", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ahrs3_t, altitude) }, \
55 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_ahrs3_t, lat) }, \
56 { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_ahrs3_t, lng) }, \
57 { "v1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ahrs3_t, v1) }, \
58 { "v2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ahrs3_t, v2) }, \
59 { "v3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_ahrs3_t, v3) }, \
60 { "v4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_ahrs3_t, v4) }, \
61 } \
62}
63#endif
64
83static inline uint16_t mavlink_msg_ahrs3_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
84 float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4)
85{
86#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf[MAVLINK_MSG_ID_AHRS3_LEN];
88 _mav_put_float(buf, 0, roll);
89 _mav_put_float(buf, 4, pitch);
90 _mav_put_float(buf, 8, yaw);
91 _mav_put_float(buf, 12, altitude);
92 _mav_put_int32_t(buf, 16, lat);
93 _mav_put_int32_t(buf, 20, lng);
94 _mav_put_float(buf, 24, v1);
95 _mav_put_float(buf, 28, v2);
96 _mav_put_float(buf, 32, v3);
97 _mav_put_float(buf, 36, v4);
98
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS3_LEN);
100#else
101 mavlink_ahrs3_t packet;
102 packet.roll = roll;
103 packet.pitch = pitch;
104 packet.yaw = yaw;
105 packet.altitude = altitude;
106 packet.lat = lat;
107 packet.lng = lng;
108 packet.v1 = v1;
109 packet.v2 = v2;
110 packet.v3 = v3;
111 packet.v4 = v4;
112
113 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS3_LEN);
114#endif
115
116 msg->msgid = MAVLINK_MSG_ID_AHRS3;
117 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
118}
119
138static inline uint16_t mavlink_msg_ahrs3_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
139 mavlink_message_t* msg,
140 float roll,float pitch,float yaw,float altitude,int32_t lat,int32_t lng,float v1,float v2,float v3,float v4)
141{
142#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_AHRS3_LEN];
144 _mav_put_float(buf, 0, roll);
145 _mav_put_float(buf, 4, pitch);
146 _mav_put_float(buf, 8, yaw);
147 _mav_put_float(buf, 12, altitude);
148 _mav_put_int32_t(buf, 16, lat);
149 _mav_put_int32_t(buf, 20, lng);
150 _mav_put_float(buf, 24, v1);
151 _mav_put_float(buf, 28, v2);
152 _mav_put_float(buf, 32, v3);
153 _mav_put_float(buf, 36, v4);
154
155 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AHRS3_LEN);
156#else
157 mavlink_ahrs3_t packet;
158 packet.roll = roll;
159 packet.pitch = pitch;
160 packet.yaw = yaw;
161 packet.altitude = altitude;
162 packet.lat = lat;
163 packet.lng = lng;
164 packet.v1 = v1;
165 packet.v2 = v2;
166 packet.v3 = v3;
167 packet.v4 = v4;
168
169 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AHRS3_LEN);
170#endif
171
172 msg->msgid = MAVLINK_MSG_ID_AHRS3;
173 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
174}
175
184static inline uint16_t mavlink_msg_ahrs3_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ahrs3_t* ahrs3)
185{
186 return mavlink_msg_ahrs3_pack(system_id, component_id, msg, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4);
187}
188
198static inline uint16_t mavlink_msg_ahrs3_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ahrs3_t* ahrs3)
199{
200 return mavlink_msg_ahrs3_pack_chan(system_id, component_id, chan, msg, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4);
201}
202
218#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
219
220static inline void mavlink_msg_ahrs3_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4)
221{
222#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
223 char buf[MAVLINK_MSG_ID_AHRS3_LEN];
224 _mav_put_float(buf, 0, roll);
225 _mav_put_float(buf, 4, pitch);
226 _mav_put_float(buf, 8, yaw);
227 _mav_put_float(buf, 12, altitude);
228 _mav_put_int32_t(buf, 16, lat);
229 _mav_put_int32_t(buf, 20, lng);
230 _mav_put_float(buf, 24, v1);
231 _mav_put_float(buf, 28, v2);
232 _mav_put_float(buf, 32, v3);
233 _mav_put_float(buf, 36, v4);
234
235 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, buf, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
236#else
237 mavlink_ahrs3_t packet;
238 packet.roll = roll;
239 packet.pitch = pitch;
240 packet.yaw = yaw;
241 packet.altitude = altitude;
242 packet.lat = lat;
243 packet.lng = lng;
244 packet.v1 = v1;
245 packet.v2 = v2;
246 packet.v3 = v3;
247 packet.v4 = v4;
248
249 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)&packet, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
250#endif
251}
252
258static inline void mavlink_msg_ahrs3_send_struct(mavlink_channel_t chan, const mavlink_ahrs3_t* ahrs3)
259{
260#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
261 mavlink_msg_ahrs3_send(chan, ahrs3->roll, ahrs3->pitch, ahrs3->yaw, ahrs3->altitude, ahrs3->lat, ahrs3->lng, ahrs3->v1, ahrs3->v2, ahrs3->v3, ahrs3->v4);
262#else
263 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)ahrs3, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
264#endif
265}
266
267#if MAVLINK_MSG_ID_AHRS3_LEN <= MAVLINK_MAX_PAYLOAD_LEN
268/*
269 This varient of _send() can be used to save stack space by re-using
270 memory from the receive buffer. The caller provides a
271 mavlink_message_t which is the size of a full mavlink message. This
272 is usually the receive buffer for the channel, and allows a reply to an
273 incoming message with minimum stack space usage.
274 */
275static inline void mavlink_msg_ahrs3_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float roll, float pitch, float yaw, float altitude, int32_t lat, int32_t lng, float v1, float v2, float v3, float v4)
276{
277#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 char *buf = (char *)msgbuf;
279 _mav_put_float(buf, 0, roll);
280 _mav_put_float(buf, 4, pitch);
281 _mav_put_float(buf, 8, yaw);
282 _mav_put_float(buf, 12, altitude);
283 _mav_put_int32_t(buf, 16, lat);
284 _mav_put_int32_t(buf, 20, lng);
285 _mav_put_float(buf, 24, v1);
286 _mav_put_float(buf, 28, v2);
287 _mav_put_float(buf, 32, v3);
288 _mav_put_float(buf, 36, v4);
289
290 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, buf, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
291#else
292 mavlink_ahrs3_t *packet = (mavlink_ahrs3_t *)msgbuf;
293 packet->roll = roll;
294 packet->pitch = pitch;
295 packet->yaw = yaw;
296 packet->altitude = altitude;
297 packet->lat = lat;
298 packet->lng = lng;
299 packet->v1 = v1;
300 packet->v2 = v2;
301 packet->v3 = v3;
302 packet->v4 = v4;
303
304 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AHRS3, (const char *)packet, MAVLINK_MSG_ID_AHRS3_MIN_LEN, MAVLINK_MSG_ID_AHRS3_LEN, MAVLINK_MSG_ID_AHRS3_CRC);
305#endif
306}
307#endif
308
309#endif
310
311// MESSAGE AHRS3 UNPACKING
312
313
319static inline float mavlink_msg_ahrs3_get_roll(const mavlink_message_t* msg)
320{
321 return _MAV_RETURN_float(msg, 0);
322}
323
329static inline float mavlink_msg_ahrs3_get_pitch(const mavlink_message_t* msg)
330{
331 return _MAV_RETURN_float(msg, 4);
332}
333
339static inline float mavlink_msg_ahrs3_get_yaw(const mavlink_message_t* msg)
340{
341 return _MAV_RETURN_float(msg, 8);
342}
343
349static inline float mavlink_msg_ahrs3_get_altitude(const mavlink_message_t* msg)
350{
351 return _MAV_RETURN_float(msg, 12);
352}
353
359static inline int32_t mavlink_msg_ahrs3_get_lat(const mavlink_message_t* msg)
360{
361 return _MAV_RETURN_int32_t(msg, 16);
362}
363
369static inline int32_t mavlink_msg_ahrs3_get_lng(const mavlink_message_t* msg)
370{
371 return _MAV_RETURN_int32_t(msg, 20);
372}
373
379static inline float mavlink_msg_ahrs3_get_v1(const mavlink_message_t* msg)
380{
381 return _MAV_RETURN_float(msg, 24);
382}
383
389static inline float mavlink_msg_ahrs3_get_v2(const mavlink_message_t* msg)
390{
391 return _MAV_RETURN_float(msg, 28);
392}
393
399static inline float mavlink_msg_ahrs3_get_v3(const mavlink_message_t* msg)
400{
401 return _MAV_RETURN_float(msg, 32);
402}
403
409static inline float mavlink_msg_ahrs3_get_v4(const mavlink_message_t* msg)
410{
411 return _MAV_RETURN_float(msg, 36);
412}
413
420static inline void mavlink_msg_ahrs3_decode(const mavlink_message_t* msg, mavlink_ahrs3_t* ahrs3)
421{
422#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
423 ahrs3->roll = mavlink_msg_ahrs3_get_roll(msg);
424 ahrs3->pitch = mavlink_msg_ahrs3_get_pitch(msg);
425 ahrs3->yaw = mavlink_msg_ahrs3_get_yaw(msg);
426 ahrs3->altitude = mavlink_msg_ahrs3_get_altitude(msg);
427 ahrs3->lat = mavlink_msg_ahrs3_get_lat(msg);
428 ahrs3->lng = mavlink_msg_ahrs3_get_lng(msg);
429 ahrs3->v1 = mavlink_msg_ahrs3_get_v1(msg);
430 ahrs3->v2 = mavlink_msg_ahrs3_get_v2(msg);
431 ahrs3->v3 = mavlink_msg_ahrs3_get_v3(msg);
432 ahrs3->v4 = mavlink_msg_ahrs3_get_v4(msg);
433#else
434 uint8_t len = msg->len < MAVLINK_MSG_ID_AHRS3_LEN? msg->len : MAVLINK_MSG_ID_AHRS3_LEN;
435 memset(ahrs3, 0, MAVLINK_MSG_ID_AHRS3_LEN);
436 memcpy(ahrs3, _MAV_PAYLOAD(msg), len);
437#endif
438}