RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_ekf_ext.h
1#pragma once
2// MESSAGE EKF_EXT PACKING
3
4#define MAVLINK_MSG_ID_EKF_EXT 206
5
6MAVPACKED(
7typedef struct __mavlink_ekf_ext_t {
8 uint64_t timestamp; /*< Time since system start [us]*/
9 float Windspeed; /*< Magnitude of wind velocity (in lateral inertial plane) [m/s]*/
10 float WindDir; /*< Wind heading angle from North [rad]*/
11 float WindZ; /*< Z (Down) component of inertial wind velocity [m/s]*/
12 float Airspeed; /*< Magnitude of air velocity [m/s]*/
13 float beta; /*< Sideslip angle [rad]*/
14 float alpha; /*< Angle of attack [rad]*/
15}) mavlink_ekf_ext_t;
16
17#define MAVLINK_MSG_ID_EKF_EXT_LEN 32
18#define MAVLINK_MSG_ID_EKF_EXT_MIN_LEN 32
19#define MAVLINK_MSG_ID_206_LEN 32
20#define MAVLINK_MSG_ID_206_MIN_LEN 32
21
22#define MAVLINK_MSG_ID_EKF_EXT_CRC 64
23#define MAVLINK_MSG_ID_206_CRC 64
24
25
26
27#if MAVLINK_COMMAND_24BIT
28#define MAVLINK_MESSAGE_INFO_EKF_EXT { \
29 206, \
30 "EKF_EXT", \
31 7, \
32 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_ekf_ext_t, timestamp) }, \
33 { "Windspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_ext_t, Windspeed) }, \
34 { "WindDir", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_ext_t, WindDir) }, \
35 { "WindZ", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_ext_t, WindZ) }, \
36 { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ekf_ext_t, Airspeed) }, \
37 { "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ekf_ext_t, beta) }, \
38 { "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ekf_ext_t, alpha) }, \
39 } \
40}
41#else
42#define MAVLINK_MESSAGE_INFO_EKF_EXT { \
43 "EKF_EXT", \
44 7, \
45 { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_ekf_ext_t, timestamp) }, \
46 { "Windspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_ekf_ext_t, Windspeed) }, \
47 { "WindDir", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_ekf_ext_t, WindDir) }, \
48 { "WindZ", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_ekf_ext_t, WindZ) }, \
49 { "Airspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_ekf_ext_t, Airspeed) }, \
50 { "beta", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_ekf_ext_t, beta) }, \
51 { "alpha", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_ekf_ext_t, alpha) }, \
52 } \
53}
54#endif
55
71static inline uint16_t mavlink_msg_ekf_ext_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha)
73{
74#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf[MAVLINK_MSG_ID_EKF_EXT_LEN];
76 _mav_put_uint64_t(buf, 0, timestamp);
77 _mav_put_float(buf, 8, Windspeed);
78 _mav_put_float(buf, 12, WindDir);
79 _mav_put_float(buf, 16, WindZ);
80 _mav_put_float(buf, 20, Airspeed);
81 _mav_put_float(buf, 24, beta);
82 _mav_put_float(buf, 28, alpha);
83
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_EXT_LEN);
85#else
86 mavlink_ekf_ext_t packet;
87 packet.timestamp = timestamp;
88 packet.Windspeed = Windspeed;
89 packet.WindDir = WindDir;
90 packet.WindZ = WindZ;
91 packet.Airspeed = Airspeed;
92 packet.beta = beta;
93 packet.alpha = alpha;
94
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_EXT_LEN);
96#endif
97
98 msg->msgid = MAVLINK_MSG_ID_EKF_EXT;
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
100}
101
117static inline uint16_t mavlink_msg_ekf_ext_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
118 mavlink_message_t* msg,
119 uint64_t timestamp,float Windspeed,float WindDir,float WindZ,float Airspeed,float beta,float alpha)
120{
121#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf[MAVLINK_MSG_ID_EKF_EXT_LEN];
123 _mav_put_uint64_t(buf, 0, timestamp);
124 _mav_put_float(buf, 8, Windspeed);
125 _mav_put_float(buf, 12, WindDir);
126 _mav_put_float(buf, 16, WindZ);
127 _mav_put_float(buf, 20, Airspeed);
128 _mav_put_float(buf, 24, beta);
129 _mav_put_float(buf, 28, alpha);
130
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_EKF_EXT_LEN);
132#else
133 mavlink_ekf_ext_t packet;
134 packet.timestamp = timestamp;
135 packet.Windspeed = Windspeed;
136 packet.WindDir = WindDir;
137 packet.WindZ = WindZ;
138 packet.Airspeed = Airspeed;
139 packet.beta = beta;
140 packet.alpha = alpha;
141
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_EKF_EXT_LEN);
143#endif
144
145 msg->msgid = MAVLINK_MSG_ID_EKF_EXT;
146 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
147}
148
157static inline uint16_t mavlink_msg_ekf_ext_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ekf_ext_t* ekf_ext)
158{
159 return mavlink_msg_ekf_ext_pack(system_id, component_id, msg, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha);
160}
161
171static inline uint16_t mavlink_msg_ekf_ext_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_ekf_ext_t* ekf_ext)
172{
173 return mavlink_msg_ekf_ext_pack_chan(system_id, component_id, chan, msg, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha);
174}
175
188#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189
190static inline void mavlink_msg_ekf_ext_send(mavlink_channel_t chan, uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha)
191{
192#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_EKF_EXT_LEN];
194 _mav_put_uint64_t(buf, 0, timestamp);
195 _mav_put_float(buf, 8, Windspeed);
196 _mav_put_float(buf, 12, WindDir);
197 _mav_put_float(buf, 16, WindZ);
198 _mav_put_float(buf, 20, Airspeed);
199 _mav_put_float(buf, 24, beta);
200 _mav_put_float(buf, 28, alpha);
201
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, buf, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
203#else
204 mavlink_ekf_ext_t packet;
205 packet.timestamp = timestamp;
206 packet.Windspeed = Windspeed;
207 packet.WindDir = WindDir;
208 packet.WindZ = WindZ;
209 packet.Airspeed = Airspeed;
210 packet.beta = beta;
211 packet.alpha = alpha;
212
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)&packet, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
214#endif
215}
216
222static inline void mavlink_msg_ekf_ext_send_struct(mavlink_channel_t chan, const mavlink_ekf_ext_t* ekf_ext)
223{
224#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 mavlink_msg_ekf_ext_send(chan, ekf_ext->timestamp, ekf_ext->Windspeed, ekf_ext->WindDir, ekf_ext->WindZ, ekf_ext->Airspeed, ekf_ext->beta, ekf_ext->alpha);
226#else
227 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)ekf_ext, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
228#endif
229}
230
231#if MAVLINK_MSG_ID_EKF_EXT_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_ekf_ext_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float Windspeed, float WindDir, float WindZ, float Airspeed, float beta, float alpha)
240{
241#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_uint64_t(buf, 0, timestamp);
244 _mav_put_float(buf, 8, Windspeed);
245 _mav_put_float(buf, 12, WindDir);
246 _mav_put_float(buf, 16, WindZ);
247 _mav_put_float(buf, 20, Airspeed);
248 _mav_put_float(buf, 24, beta);
249 _mav_put_float(buf, 28, alpha);
250
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, buf, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
252#else
253 mavlink_ekf_ext_t *packet = (mavlink_ekf_ext_t *)msgbuf;
254 packet->timestamp = timestamp;
255 packet->Windspeed = Windspeed;
256 packet->WindDir = WindDir;
257 packet->WindZ = WindZ;
258 packet->Airspeed = Airspeed;
259 packet->beta = beta;
260 packet->alpha = alpha;
261
262 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_EKF_EXT, (const char *)packet, MAVLINK_MSG_ID_EKF_EXT_MIN_LEN, MAVLINK_MSG_ID_EKF_EXT_LEN, MAVLINK_MSG_ID_EKF_EXT_CRC);
263#endif
264}
265#endif
266
267#endif
268
269// MESSAGE EKF_EXT UNPACKING
270
271
277static inline uint64_t mavlink_msg_ekf_ext_get_timestamp(const mavlink_message_t* msg)
278{
279 return _MAV_RETURN_uint64_t(msg, 0);
280}
281
287static inline float mavlink_msg_ekf_ext_get_Windspeed(const mavlink_message_t* msg)
288{
289 return _MAV_RETURN_float(msg, 8);
290}
291
297static inline float mavlink_msg_ekf_ext_get_WindDir(const mavlink_message_t* msg)
298{
299 return _MAV_RETURN_float(msg, 12);
300}
301
307static inline float mavlink_msg_ekf_ext_get_WindZ(const mavlink_message_t* msg)
308{
309 return _MAV_RETURN_float(msg, 16);
310}
311
317static inline float mavlink_msg_ekf_ext_get_Airspeed(const mavlink_message_t* msg)
318{
319 return _MAV_RETURN_float(msg, 20);
320}
321
327static inline float mavlink_msg_ekf_ext_get_beta(const mavlink_message_t* msg)
328{
329 return _MAV_RETURN_float(msg, 24);
330}
331
337static inline float mavlink_msg_ekf_ext_get_alpha(const mavlink_message_t* msg)
338{
339 return _MAV_RETURN_float(msg, 28);
340}
341
348static inline void mavlink_msg_ekf_ext_decode(const mavlink_message_t* msg, mavlink_ekf_ext_t* ekf_ext)
349{
350#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 ekf_ext->timestamp = mavlink_msg_ekf_ext_get_timestamp(msg);
352 ekf_ext->Windspeed = mavlink_msg_ekf_ext_get_Windspeed(msg);
353 ekf_ext->WindDir = mavlink_msg_ekf_ext_get_WindDir(msg);
354 ekf_ext->WindZ = mavlink_msg_ekf_ext_get_WindZ(msg);
355 ekf_ext->Airspeed = mavlink_msg_ekf_ext_get_Airspeed(msg);
356 ekf_ext->beta = mavlink_msg_ekf_ext_get_beta(msg);
357 ekf_ext->alpha = mavlink_msg_ekf_ext_get_alpha(msg);
358#else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_EKF_EXT_LEN? msg->len : MAVLINK_MSG_ID_EKF_EXT_LEN;
360 memset(ekf_ext, 0, MAVLINK_MSG_ID_EKF_EXT_LEN);
361 memcpy(ekf_ext, _MAV_PAYLOAD(msg), len);
362#endif
363}