RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_airspeeds.h
1#pragma once
2// MESSAGE AIRSPEEDS PACKING
3
4#define MAVLINK_MSG_ID_AIRSPEEDS 182
5
6MAVPACKED(
7typedef struct __mavlink_airspeeds_t {
8 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
9 int16_t airspeed_imu; /*< Airspeed estimate from IMU, cm/s*/
10 int16_t airspeed_pitot; /*< Pitot measured forward airpseed, cm/s*/
11 int16_t airspeed_hot_wire; /*< Hot wire anenometer measured airspeed, cm/s*/
12 int16_t airspeed_ultrasonic; /*< Ultrasonic measured airspeed, cm/s*/
13 int16_t aoa; /*< Angle of attack sensor, degrees * 10*/
14 int16_t aoy; /*< Yaw angle sensor, degrees * 10*/
15}) mavlink_airspeeds_t;
16
17#define MAVLINK_MSG_ID_AIRSPEEDS_LEN 16
18#define MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN 16
19#define MAVLINK_MSG_ID_182_LEN 16
20#define MAVLINK_MSG_ID_182_MIN_LEN 16
21
22#define MAVLINK_MSG_ID_AIRSPEEDS_CRC 154
23#define MAVLINK_MSG_ID_182_CRC 154
24
25
26
27#if MAVLINK_COMMAND_24BIT
28#define MAVLINK_MESSAGE_INFO_AIRSPEEDS { \
29 182, \
30 "AIRSPEEDS", \
31 7, \
32 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_airspeeds_t, time_boot_ms) }, \
33 { "airspeed_imu", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_airspeeds_t, airspeed_imu) }, \
34 { "airspeed_pitot", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_airspeeds_t, airspeed_pitot) }, \
35 { "airspeed_hot_wire", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_airspeeds_t, airspeed_hot_wire) }, \
36 { "airspeed_ultrasonic", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_airspeeds_t, airspeed_ultrasonic) }, \
37 { "aoa", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_airspeeds_t, aoa) }, \
38 { "aoy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_airspeeds_t, aoy) }, \
39 } \
40}
41#else
42#define MAVLINK_MESSAGE_INFO_AIRSPEEDS { \
43 "AIRSPEEDS", \
44 7, \
45 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_airspeeds_t, time_boot_ms) }, \
46 { "airspeed_imu", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_airspeeds_t, airspeed_imu) }, \
47 { "airspeed_pitot", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_airspeeds_t, airspeed_pitot) }, \
48 { "airspeed_hot_wire", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_airspeeds_t, airspeed_hot_wire) }, \
49 { "airspeed_ultrasonic", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_airspeeds_t, airspeed_ultrasonic) }, \
50 { "aoa", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_airspeeds_t, aoa) }, \
51 { "aoy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_airspeeds_t, aoy) }, \
52 } \
53}
54#endif
55
71static inline uint16_t mavlink_msg_airspeeds_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
73{
74#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN];
76 _mav_put_uint32_t(buf, 0, time_boot_ms);
77 _mav_put_int16_t(buf, 4, airspeed_imu);
78 _mav_put_int16_t(buf, 6, airspeed_pitot);
79 _mav_put_int16_t(buf, 8, airspeed_hot_wire);
80 _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
81 _mav_put_int16_t(buf, 12, aoa);
82 _mav_put_int16_t(buf, 14, aoy);
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
85#else
86 mavlink_airspeeds_t packet;
87 packet.time_boot_ms = time_boot_ms;
88 packet.airspeed_imu = airspeed_imu;
89 packet.airspeed_pitot = airspeed_pitot;
90 packet.airspeed_hot_wire = airspeed_hot_wire;
91 packet.airspeed_ultrasonic = airspeed_ultrasonic;
92 packet.aoa = aoa;
93 packet.aoy = aoy;
94
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
96#endif
97
98 msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS;
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
100}
101
117static inline uint16_t mavlink_msg_airspeeds_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
118 mavlink_message_t* msg,
119 uint32_t time_boot_ms,int16_t airspeed_imu,int16_t airspeed_pitot,int16_t airspeed_hot_wire,int16_t airspeed_ultrasonic,int16_t aoa,int16_t aoy)
120{
121#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN];
123 _mav_put_uint32_t(buf, 0, time_boot_ms);
124 _mav_put_int16_t(buf, 4, airspeed_imu);
125 _mav_put_int16_t(buf, 6, airspeed_pitot);
126 _mav_put_int16_t(buf, 8, airspeed_hot_wire);
127 _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
128 _mav_put_int16_t(buf, 12, aoa);
129 _mav_put_int16_t(buf, 14, aoy);
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
132#else
133 mavlink_airspeeds_t packet;
134 packet.time_boot_ms = time_boot_ms;
135 packet.airspeed_imu = airspeed_imu;
136 packet.airspeed_pitot = airspeed_pitot;
137 packet.airspeed_hot_wire = airspeed_hot_wire;
138 packet.airspeed_ultrasonic = airspeed_ultrasonic;
139 packet.aoa = aoa;
140 packet.aoy = aoy;
141
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
143#endif
144
145 msg->msgid = MAVLINK_MSG_ID_AIRSPEEDS;
146 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
147}
148
157static inline uint16_t mavlink_msg_airspeeds_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds)
158{
159 return mavlink_msg_airspeeds_pack(system_id, component_id, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy);
160}
161
171static inline uint16_t mavlink_msg_airspeeds_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_airspeeds_t* airspeeds)
172{
173 return mavlink_msg_airspeeds_pack_chan(system_id, component_id, chan, msg, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy);
174}
175
188#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189
190static inline void mavlink_msg_airspeeds_send(mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_AIRSPEEDS_LEN];
194 _mav_put_uint32_t(buf, 0, time_boot_ms);
195 _mav_put_int16_t(buf, 4, airspeed_imu);
196 _mav_put_int16_t(buf, 6, airspeed_pitot);
197 _mav_put_int16_t(buf, 8, airspeed_hot_wire);
198 _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
199 _mav_put_int16_t(buf, 12, aoa);
200 _mav_put_int16_t(buf, 14, aoy);
201
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
203#else
204 mavlink_airspeeds_t packet;
205 packet.time_boot_ms = time_boot_ms;
206 packet.airspeed_imu = airspeed_imu;
207 packet.airspeed_pitot = airspeed_pitot;
208 packet.airspeed_hot_wire = airspeed_hot_wire;
209 packet.airspeed_ultrasonic = airspeed_ultrasonic;
210 packet.aoa = aoa;
211 packet.aoy = aoy;
212
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)&packet, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
214#endif
215}
216
222static inline void mavlink_msg_airspeeds_send_struct(mavlink_channel_t chan, const mavlink_airspeeds_t* airspeeds)
223{
224#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 mavlink_msg_airspeeds_send(chan, airspeeds->time_boot_ms, airspeeds->airspeed_imu, airspeeds->airspeed_pitot, airspeeds->airspeed_hot_wire, airspeeds->airspeed_ultrasonic, airspeeds->aoa, airspeeds->aoy);
226#else
227 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)airspeeds, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
228#endif
229}
230
231#if MAVLINK_MSG_ID_AIRSPEEDS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
232/*
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
238 */
239static inline void mavlink_msg_airspeeds_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, int16_t airspeed_imu, int16_t airspeed_pitot, int16_t airspeed_hot_wire, int16_t airspeed_ultrasonic, int16_t aoa, int16_t aoy)
240{
241#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_uint32_t(buf, 0, time_boot_ms);
244 _mav_put_int16_t(buf, 4, airspeed_imu);
245 _mav_put_int16_t(buf, 6, airspeed_pitot);
246 _mav_put_int16_t(buf, 8, airspeed_hot_wire);
247 _mav_put_int16_t(buf, 10, airspeed_ultrasonic);
248 _mav_put_int16_t(buf, 12, aoa);
249 _mav_put_int16_t(buf, 14, aoy);
250
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, buf, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
252#else
253 mavlink_airspeeds_t *packet = (mavlink_airspeeds_t *)msgbuf;
254 packet->time_boot_ms = time_boot_ms;
255 packet->airspeed_imu = airspeed_imu;
256 packet->airspeed_pitot = airspeed_pitot;
257 packet->airspeed_hot_wire = airspeed_hot_wire;
258 packet->airspeed_ultrasonic = airspeed_ultrasonic;
259 packet->aoa = aoa;
260 packet->aoy = aoy;
261
262 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AIRSPEEDS, (const char *)packet, MAVLINK_MSG_ID_AIRSPEEDS_MIN_LEN, MAVLINK_MSG_ID_AIRSPEEDS_LEN, MAVLINK_MSG_ID_AIRSPEEDS_CRC);
263#endif
264}
265#endif
266
267#endif
268
269// MESSAGE AIRSPEEDS UNPACKING
270
271
277static inline uint32_t mavlink_msg_airspeeds_get_time_boot_ms(const mavlink_message_t* msg)
278{
279 return _MAV_RETURN_uint32_t(msg, 0);
280}
281
287static inline int16_t mavlink_msg_airspeeds_get_airspeed_imu(const mavlink_message_t* msg)
288{
289 return _MAV_RETURN_int16_t(msg, 4);
290}
291
297static inline int16_t mavlink_msg_airspeeds_get_airspeed_pitot(const mavlink_message_t* msg)
298{
299 return _MAV_RETURN_int16_t(msg, 6);
300}
301
307static inline int16_t mavlink_msg_airspeeds_get_airspeed_hot_wire(const mavlink_message_t* msg)
308{
309 return _MAV_RETURN_int16_t(msg, 8);
310}
311
317static inline int16_t mavlink_msg_airspeeds_get_airspeed_ultrasonic(const mavlink_message_t* msg)
318{
319 return _MAV_RETURN_int16_t(msg, 10);
320}
321
327static inline int16_t mavlink_msg_airspeeds_get_aoa(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_int16_t(msg, 12);
330}
331
337static inline int16_t mavlink_msg_airspeeds_get_aoy(const mavlink_message_t* msg)
338{
339 return _MAV_RETURN_int16_t(msg, 14);
340}
341
348static inline void mavlink_msg_airspeeds_decode(const mavlink_message_t* msg, mavlink_airspeeds_t* airspeeds)
349{
350#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 airspeeds->time_boot_ms = mavlink_msg_airspeeds_get_time_boot_ms(msg);
352 airspeeds->airspeed_imu = mavlink_msg_airspeeds_get_airspeed_imu(msg);
353 airspeeds->airspeed_pitot = mavlink_msg_airspeeds_get_airspeed_pitot(msg);
354 airspeeds->airspeed_hot_wire = mavlink_msg_airspeeds_get_airspeed_hot_wire(msg);
355 airspeeds->airspeed_ultrasonic = mavlink_msg_airspeeds_get_airspeed_ultrasonic(msg);
356 airspeeds->aoa = mavlink_msg_airspeeds_get_aoa(msg);
357 airspeeds->aoy = mavlink_msg_airspeeds_get_aoy(msg);
358#else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_AIRSPEEDS_LEN? msg->len : MAVLINK_MSG_ID_AIRSPEEDS_LEN;
360 memset(airspeeds, 0, MAVLINK_MSG_ID_AIRSPEEDS_LEN);
361 memcpy(airspeeds, _MAV_PAYLOAD(msg), len);
362#endif
363}