2 // MESSAGE WIND_COV PACKING
4 #define MAVLINK_MSG_ID_WIND_COV 231
7 typedef struct __mavlink_wind_cov_t
{
8 uint64_t time_usec
; /*< Timestamp (micros since boot or Unix epoch)*/
9 float wind_x
; /*< Wind in X (NED) direction in m/s*/
10 float wind_y
; /*< Wind in Y (NED) direction in m/s*/
11 float wind_z
; /*< Wind in Z (NED) direction in m/s*/
12 float var_horiz
; /*< Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.*/
13 float var_vert
; /*< Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.*/
14 float wind_alt
; /*< AMSL altitude (m) this measurement was taken at*/
15 float horiz_accuracy
; /*< Horizontal speed 1-STD accuracy*/
16 float vert_accuracy
; /*< Vertical speed 1-STD accuracy*/
17 }) mavlink_wind_cov_t
;
19 #define MAVLINK_MSG_ID_WIND_COV_LEN 40
20 #define MAVLINK_MSG_ID_WIND_COV_MIN_LEN 40
21 #define MAVLINK_MSG_ID_231_LEN 40
22 #define MAVLINK_MSG_ID_231_MIN_LEN 40
24 #define MAVLINK_MSG_ID_WIND_COV_CRC 105
25 #define MAVLINK_MSG_ID_231_CRC 105
29 #if MAVLINK_COMMAND_24BIT
30 #define MAVLINK_MESSAGE_INFO_WIND_COV { \
34 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_cov_t, time_usec) }, \
35 { "wind_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_cov_t, wind_x) }, \
36 { "wind_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_cov_t, wind_y) }, \
37 { "wind_z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_wind_cov_t, wind_z) }, \
38 { "var_horiz", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_wind_cov_t, var_horiz) }, \
39 { "var_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_wind_cov_t, var_vert) }, \
40 { "wind_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_wind_cov_t, wind_alt) }, \
41 { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_wind_cov_t, horiz_accuracy) }, \
42 { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_wind_cov_t, vert_accuracy) }, \
46 #define MAVLINK_MESSAGE_INFO_WIND_COV { \
49 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_cov_t, time_usec) }, \
50 { "wind_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_cov_t, wind_x) }, \
51 { "wind_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_cov_t, wind_y) }, \
52 { "wind_z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_wind_cov_t, wind_z) }, \
53 { "var_horiz", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_wind_cov_t, var_horiz) }, \
54 { "var_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_wind_cov_t, var_vert) }, \
55 { "wind_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_wind_cov_t, wind_alt) }, \
56 { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_wind_cov_t, horiz_accuracy) }, \
57 { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_wind_cov_t, vert_accuracy) }, \
63 * @brief Pack a wind_cov message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
68 * @param time_usec Timestamp (micros since boot or Unix epoch)
69 * @param wind_x Wind in X (NED) direction in m/s
70 * @param wind_y Wind in Y (NED) direction in m/s
71 * @param wind_z Wind in Z (NED) direction in m/s
72 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
73 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
74 * @param wind_alt AMSL altitude (m) this measurement was taken at
75 * @param horiz_accuracy Horizontal speed 1-STD accuracy
76 * @param vert_accuracy Vertical speed 1-STD accuracy
77 * @return length of the message in bytes (excluding serial stream start sign)
79 static inline uint16_t mavlink_msg_wind_cov_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
80 uint64_t time_usec
, float wind_x
, float wind_y
, float wind_z
, float var_horiz
, float var_vert
, float wind_alt
, float horiz_accuracy
, float vert_accuracy
)
82 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf
[MAVLINK_MSG_ID_WIND_COV_LEN
];
84 _mav_put_uint64_t(buf
, 0, time_usec
);
85 _mav_put_float(buf
, 8, wind_x
);
86 _mav_put_float(buf
, 12, wind_y
);
87 _mav_put_float(buf
, 16, wind_z
);
88 _mav_put_float(buf
, 20, var_horiz
);
89 _mav_put_float(buf
, 24, var_vert
);
90 _mav_put_float(buf
, 28, wind_alt
);
91 _mav_put_float(buf
, 32, horiz_accuracy
);
92 _mav_put_float(buf
, 36, vert_accuracy
);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_WIND_COV_LEN
);
96 mavlink_wind_cov_t packet
;
97 packet
.time_usec
= time_usec
;
98 packet
.wind_x
= wind_x
;
99 packet
.wind_y
= wind_y
;
100 packet
.wind_z
= wind_z
;
101 packet
.var_horiz
= var_horiz
;
102 packet
.var_vert
= var_vert
;
103 packet
.wind_alt
= wind_alt
;
104 packet
.horiz_accuracy
= horiz_accuracy
;
105 packet
.vert_accuracy
= vert_accuracy
;
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_WIND_COV_LEN
);
110 msg
->msgid
= MAVLINK_MSG_ID_WIND_COV
;
111 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
115 * @brief Pack a wind_cov message on a channel
116 * @param system_id ID of this system
117 * @param component_id ID of this component (e.g. 200 for IMU)
118 * @param chan The MAVLink channel this message will be sent over
119 * @param msg The MAVLink message to compress the data into
120 * @param time_usec Timestamp (micros since boot or Unix epoch)
121 * @param wind_x Wind in X (NED) direction in m/s
122 * @param wind_y Wind in Y (NED) direction in m/s
123 * @param wind_z Wind in Z (NED) direction in m/s
124 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
125 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
126 * @param wind_alt AMSL altitude (m) this measurement was taken at
127 * @param horiz_accuracy Horizontal speed 1-STD accuracy
128 * @param vert_accuracy Vertical speed 1-STD accuracy
129 * @return length of the message in bytes (excluding serial stream start sign)
131 static inline uint16_t mavlink_msg_wind_cov_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
132 mavlink_message_t
* msg
,
133 uint64_t time_usec
,float wind_x
,float wind_y
,float wind_z
,float var_horiz
,float var_vert
,float wind_alt
,float horiz_accuracy
,float vert_accuracy
)
135 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
136 char buf
[MAVLINK_MSG_ID_WIND_COV_LEN
];
137 _mav_put_uint64_t(buf
, 0, time_usec
);
138 _mav_put_float(buf
, 8, wind_x
);
139 _mav_put_float(buf
, 12, wind_y
);
140 _mav_put_float(buf
, 16, wind_z
);
141 _mav_put_float(buf
, 20, var_horiz
);
142 _mav_put_float(buf
, 24, var_vert
);
143 _mav_put_float(buf
, 28, wind_alt
);
144 _mav_put_float(buf
, 32, horiz_accuracy
);
145 _mav_put_float(buf
, 36, vert_accuracy
);
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_WIND_COV_LEN
);
149 mavlink_wind_cov_t packet
;
150 packet
.time_usec
= time_usec
;
151 packet
.wind_x
= wind_x
;
152 packet
.wind_y
= wind_y
;
153 packet
.wind_z
= wind_z
;
154 packet
.var_horiz
= var_horiz
;
155 packet
.var_vert
= var_vert
;
156 packet
.wind_alt
= wind_alt
;
157 packet
.horiz_accuracy
= horiz_accuracy
;
158 packet
.vert_accuracy
= vert_accuracy
;
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_WIND_COV_LEN
);
163 msg
->msgid
= MAVLINK_MSG_ID_WIND_COV
;
164 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
168 * @brief Encode a wind_cov struct
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param msg The MAVLink message to compress the data into
173 * @param wind_cov C-struct to read the message contents from
175 static inline uint16_t mavlink_msg_wind_cov_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_wind_cov_t
* wind_cov
)
177 return mavlink_msg_wind_cov_pack(system_id
, component_id
, msg
, wind_cov
->time_usec
, wind_cov
->wind_x
, wind_cov
->wind_y
, wind_cov
->wind_z
, wind_cov
->var_horiz
, wind_cov
->var_vert
, wind_cov
->wind_alt
, wind_cov
->horiz_accuracy
, wind_cov
->vert_accuracy
);
181 * @brief Encode a wind_cov struct on a channel
183 * @param system_id ID of this system
184 * @param component_id ID of this component (e.g. 200 for IMU)
185 * @param chan The MAVLink channel this message will be sent over
186 * @param msg The MAVLink message to compress the data into
187 * @param wind_cov C-struct to read the message contents from
189 static inline uint16_t mavlink_msg_wind_cov_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_wind_cov_t
* wind_cov
)
191 return mavlink_msg_wind_cov_pack_chan(system_id
, component_id
, chan
, msg
, wind_cov
->time_usec
, wind_cov
->wind_x
, wind_cov
->wind_y
, wind_cov
->wind_z
, wind_cov
->var_horiz
, wind_cov
->var_vert
, wind_cov
->wind_alt
, wind_cov
->horiz_accuracy
, wind_cov
->vert_accuracy
);
195 * @brief Send a wind_cov message
196 * @param chan MAVLink channel to send the message
198 * @param time_usec Timestamp (micros since boot or Unix epoch)
199 * @param wind_x Wind in X (NED) direction in m/s
200 * @param wind_y Wind in Y (NED) direction in m/s
201 * @param wind_z Wind in Z (NED) direction in m/s
202 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
203 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
204 * @param wind_alt AMSL altitude (m) this measurement was taken at
205 * @param horiz_accuracy Horizontal speed 1-STD accuracy
206 * @param vert_accuracy Vertical speed 1-STD accuracy
208 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
210 static inline void mavlink_msg_wind_cov_send(mavlink_channel_t chan
, uint64_t time_usec
, float wind_x
, float wind_y
, float wind_z
, float var_horiz
, float var_vert
, float wind_alt
, float horiz_accuracy
, float vert_accuracy
)
212 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 char buf
[MAVLINK_MSG_ID_WIND_COV_LEN
];
214 _mav_put_uint64_t(buf
, 0, time_usec
);
215 _mav_put_float(buf
, 8, wind_x
);
216 _mav_put_float(buf
, 12, wind_y
);
217 _mav_put_float(buf
, 16, wind_z
);
218 _mav_put_float(buf
, 20, var_horiz
);
219 _mav_put_float(buf
, 24, var_vert
);
220 _mav_put_float(buf
, 28, wind_alt
);
221 _mav_put_float(buf
, 32, horiz_accuracy
);
222 _mav_put_float(buf
, 36, vert_accuracy
);
224 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_WIND_COV
, buf
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
226 mavlink_wind_cov_t packet
;
227 packet
.time_usec
= time_usec
;
228 packet
.wind_x
= wind_x
;
229 packet
.wind_y
= wind_y
;
230 packet
.wind_z
= wind_z
;
231 packet
.var_horiz
= var_horiz
;
232 packet
.var_vert
= var_vert
;
233 packet
.wind_alt
= wind_alt
;
234 packet
.horiz_accuracy
= horiz_accuracy
;
235 packet
.vert_accuracy
= vert_accuracy
;
237 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_WIND_COV
, (const char *)&packet
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
242 * @brief Send a wind_cov message
243 * @param chan MAVLink channel to send the message
244 * @param struct The MAVLink struct to serialize
246 static inline void mavlink_msg_wind_cov_send_struct(mavlink_channel_t chan
, const mavlink_wind_cov_t
* wind_cov
)
248 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
249 mavlink_msg_wind_cov_send(chan
, wind_cov
->time_usec
, wind_cov
->wind_x
, wind_cov
->wind_y
, wind_cov
->wind_z
, wind_cov
->var_horiz
, wind_cov
->var_vert
, wind_cov
->wind_alt
, wind_cov
->horiz_accuracy
, wind_cov
->vert_accuracy
);
251 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_WIND_COV
, (const char *)wind_cov
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
255 #if MAVLINK_MSG_ID_WIND_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
257 This varient of _send() can be used to save stack space by re-using
258 memory from the receive buffer. The caller provides a
259 mavlink_message_t which is the size of a full mavlink message. This
260 is usually the receive buffer for the channel, and allows a reply to an
261 incoming message with minimum stack space usage.
263 static inline void mavlink_msg_wind_cov_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint64_t time_usec
, float wind_x
, float wind_y
, float wind_z
, float var_horiz
, float var_vert
, float wind_alt
, float horiz_accuracy
, float vert_accuracy
)
265 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
266 char *buf
= (char *)msgbuf
;
267 _mav_put_uint64_t(buf
, 0, time_usec
);
268 _mav_put_float(buf
, 8, wind_x
);
269 _mav_put_float(buf
, 12, wind_y
);
270 _mav_put_float(buf
, 16, wind_z
);
271 _mav_put_float(buf
, 20, var_horiz
);
272 _mav_put_float(buf
, 24, var_vert
);
273 _mav_put_float(buf
, 28, wind_alt
);
274 _mav_put_float(buf
, 32, horiz_accuracy
);
275 _mav_put_float(buf
, 36, vert_accuracy
);
277 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_WIND_COV
, buf
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
279 mavlink_wind_cov_t
*packet
= (mavlink_wind_cov_t
*)msgbuf
;
280 packet
->time_usec
= time_usec
;
281 packet
->wind_x
= wind_x
;
282 packet
->wind_y
= wind_y
;
283 packet
->wind_z
= wind_z
;
284 packet
->var_horiz
= var_horiz
;
285 packet
->var_vert
= var_vert
;
286 packet
->wind_alt
= wind_alt
;
287 packet
->horiz_accuracy
= horiz_accuracy
;
288 packet
->vert_accuracy
= vert_accuracy
;
290 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_WIND_COV
, (const char *)packet
, MAVLINK_MSG_ID_WIND_COV_MIN_LEN
, MAVLINK_MSG_ID_WIND_COV_LEN
, MAVLINK_MSG_ID_WIND_COV_CRC
);
297 // MESSAGE WIND_COV UNPACKING
301 * @brief Get field time_usec from wind_cov message
303 * @return Timestamp (micros since boot or Unix epoch)
305 static inline uint64_t mavlink_msg_wind_cov_get_time_usec(const mavlink_message_t
* msg
)
307 return _MAV_RETURN_uint64_t(msg
, 0);
311 * @brief Get field wind_x from wind_cov message
313 * @return Wind in X (NED) direction in m/s
315 static inline float mavlink_msg_wind_cov_get_wind_x(const mavlink_message_t
* msg
)
317 return _MAV_RETURN_float(msg
, 8);
321 * @brief Get field wind_y from wind_cov message
323 * @return Wind in Y (NED) direction in m/s
325 static inline float mavlink_msg_wind_cov_get_wind_y(const mavlink_message_t
* msg
)
327 return _MAV_RETURN_float(msg
, 12);
331 * @brief Get field wind_z from wind_cov message
333 * @return Wind in Z (NED) direction in m/s
335 static inline float mavlink_msg_wind_cov_get_wind_z(const mavlink_message_t
* msg
)
337 return _MAV_RETURN_float(msg
, 16);
341 * @brief Get field var_horiz from wind_cov message
343 * @return Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
345 static inline float mavlink_msg_wind_cov_get_var_horiz(const mavlink_message_t
* msg
)
347 return _MAV_RETURN_float(msg
, 20);
351 * @brief Get field var_vert from wind_cov message
353 * @return Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
355 static inline float mavlink_msg_wind_cov_get_var_vert(const mavlink_message_t
* msg
)
357 return _MAV_RETURN_float(msg
, 24);
361 * @brief Get field wind_alt from wind_cov message
363 * @return AMSL altitude (m) this measurement was taken at
365 static inline float mavlink_msg_wind_cov_get_wind_alt(const mavlink_message_t
* msg
)
367 return _MAV_RETURN_float(msg
, 28);
371 * @brief Get field horiz_accuracy from wind_cov message
373 * @return Horizontal speed 1-STD accuracy
375 static inline float mavlink_msg_wind_cov_get_horiz_accuracy(const mavlink_message_t
* msg
)
377 return _MAV_RETURN_float(msg
, 32);
381 * @brief Get field vert_accuracy from wind_cov message
383 * @return Vertical speed 1-STD accuracy
385 static inline float mavlink_msg_wind_cov_get_vert_accuracy(const mavlink_message_t
* msg
)
387 return _MAV_RETURN_float(msg
, 36);
391 * @brief Decode a wind_cov message into a struct
393 * @param msg The message to decode
394 * @param wind_cov C-struct to decode the message contents into
396 static inline void mavlink_msg_wind_cov_decode(const mavlink_message_t
* msg
, mavlink_wind_cov_t
* wind_cov
)
398 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
399 wind_cov
->time_usec
= mavlink_msg_wind_cov_get_time_usec(msg
);
400 wind_cov
->wind_x
= mavlink_msg_wind_cov_get_wind_x(msg
);
401 wind_cov
->wind_y
= mavlink_msg_wind_cov_get_wind_y(msg
);
402 wind_cov
->wind_z
= mavlink_msg_wind_cov_get_wind_z(msg
);
403 wind_cov
->var_horiz
= mavlink_msg_wind_cov_get_var_horiz(msg
);
404 wind_cov
->var_vert
= mavlink_msg_wind_cov_get_var_vert(msg
);
405 wind_cov
->wind_alt
= mavlink_msg_wind_cov_get_wind_alt(msg
);
406 wind_cov
->horiz_accuracy
= mavlink_msg_wind_cov_get_horiz_accuracy(msg
);
407 wind_cov
->vert_accuracy
= mavlink_msg_wind_cov_get_vert_accuracy(msg
);
409 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_WIND_COV_LEN
? msg
->len
: MAVLINK_MSG_ID_WIND_COV_LEN
;
410 memset(wind_cov
, 0, MAVLINK_MSG_ID_WIND_COV_LEN
);
411 memcpy(wind_cov
, _MAV_PAYLOAD(msg
), len
);