source: flair-src/trunk/tools/Controller/Mavlink/src/include/common/mavlink_msg_wind_cov.h @ 88

Last change on this file since 88 was 88, checked in by Sanahuja Guillaume, 5 years ago

m

File size: 16.6 KB
Line 
1// MESSAGE WIND_COV PACKING
2
3#define MAVLINK_MSG_ID_WIND_COV 231
4
5typedef struct MAVLINK_PACKED __mavlink_wind_cov_t
6{
7 uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
8 float wind_x; /*< Wind in X (NED) direction in m/s*/
9 float wind_y; /*< Wind in Y (NED) direction in m/s*/
10 float wind_z; /*< Wind in Z (NED) direction in m/s*/
11 float var_horiz; /*< Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.*/
12 float var_vert; /*< Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.*/
13 float wind_alt; /*< AMSL altitude (m) this measurement was taken at*/
14 float horiz_accuracy; /*< Horizontal speed 1-STD accuracy*/
15 float vert_accuracy; /*< Vertical speed 1-STD accuracy*/
16} mavlink_wind_cov_t;
17
18#define MAVLINK_MSG_ID_WIND_COV_LEN 40
19#define MAVLINK_MSG_ID_WIND_COV_MIN_LEN 40
20#define MAVLINK_MSG_ID_231_LEN 40
21#define MAVLINK_MSG_ID_231_MIN_LEN 40
22
23#define MAVLINK_MSG_ID_WIND_COV_CRC 105
24#define MAVLINK_MSG_ID_231_CRC 105
25
26
27
28#if MAVLINK_COMMAND_24BIT
29#define MAVLINK_MESSAGE_INFO_WIND_COV { \
30        231, \
31        "WIND_COV", \
32        9, \
33        {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_cov_t, time_usec) }, \
34         { "wind_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_cov_t, wind_x) }, \
35         { "wind_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_cov_t, wind_y) }, \
36         { "wind_z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_wind_cov_t, wind_z) }, \
37         { "var_horiz", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_wind_cov_t, var_horiz) }, \
38         { "var_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_wind_cov_t, var_vert) }, \
39         { "wind_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_wind_cov_t, wind_alt) }, \
40         { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_wind_cov_t, horiz_accuracy) }, \
41         { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_wind_cov_t, vert_accuracy) }, \
42         } \
43}
44#else
45#define MAVLINK_MESSAGE_INFO_WIND_COV { \
46        "WIND_COV", \
47        9, \
48        {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_wind_cov_t, time_usec) }, \
49         { "wind_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_wind_cov_t, wind_x) }, \
50         { "wind_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_wind_cov_t, wind_y) }, \
51         { "wind_z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_wind_cov_t, wind_z) }, \
52         { "var_horiz", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_wind_cov_t, var_horiz) }, \
53         { "var_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_wind_cov_t, var_vert) }, \
54         { "wind_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_wind_cov_t, wind_alt) }, \
55         { "horiz_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_wind_cov_t, horiz_accuracy) }, \
56         { "vert_accuracy", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_wind_cov_t, vert_accuracy) }, \
57         } \
58}
59#endif
60
61/**
62 * @brief Pack a wind_cov message
63 * @param system_id ID of this system
64 * @param component_id ID of this component (e.g. 200 for IMU)
65 * @param msg The MAVLink message to compress the data into
66 *
67 * @param time_usec Timestamp (micros since boot or Unix epoch)
68 * @param wind_x Wind in X (NED) direction in m/s
69 * @param wind_y Wind in Y (NED) direction in m/s
70 * @param wind_z Wind in Z (NED) direction in m/s
71 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
72 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
73 * @param wind_alt AMSL altitude (m) this measurement was taken at
74 * @param horiz_accuracy Horizontal speed 1-STD accuracy
75 * @param vert_accuracy Vertical speed 1-STD accuracy
76 * @return length of the message in bytes (excluding serial stream start sign)
77 */
78static inline uint16_t mavlink_msg_wind_cov_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
79                                                       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)
80{
81#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82        char buf[MAVLINK_MSG_ID_WIND_COV_LEN];
83        _mav_put_uint64_t(buf, 0, time_usec);
84        _mav_put_float(buf, 8, wind_x);
85        _mav_put_float(buf, 12, wind_y);
86        _mav_put_float(buf, 16, wind_z);
87        _mav_put_float(buf, 20, var_horiz);
88        _mav_put_float(buf, 24, var_vert);
89        _mav_put_float(buf, 28, wind_alt);
90        _mav_put_float(buf, 32, horiz_accuracy);
91        _mav_put_float(buf, 36, vert_accuracy);
92
93        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_COV_LEN);
94#else
95        mavlink_wind_cov_t packet;
96        packet.time_usec = time_usec;
97        packet.wind_x = wind_x;
98        packet.wind_y = wind_y;
99        packet.wind_z = wind_z;
100        packet.var_horiz = var_horiz;
101        packet.var_vert = var_vert;
102        packet.wind_alt = wind_alt;
103        packet.horiz_accuracy = horiz_accuracy;
104        packet.vert_accuracy = vert_accuracy;
105
106        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_COV_LEN);
107#endif
108
109        msg->msgid = MAVLINK_MSG_ID_WIND_COV;
110    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);
111}
112
113/**
114 * @brief Pack a wind_cov message on a channel
115 * @param system_id ID of this system
116 * @param component_id ID of this component (e.g. 200 for IMU)
117 * @param chan The MAVLink channel this message will be sent over
118 * @param msg The MAVLink message to compress the data into
119 * @param time_usec Timestamp (micros since boot or Unix epoch)
120 * @param wind_x Wind in X (NED) direction in m/s
121 * @param wind_y Wind in Y (NED) direction in m/s
122 * @param wind_z Wind in Z (NED) direction in m/s
123 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
124 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
125 * @param wind_alt AMSL altitude (m) this measurement was taken at
126 * @param horiz_accuracy Horizontal speed 1-STD accuracy
127 * @param vert_accuracy Vertical speed 1-STD accuracy
128 * @return length of the message in bytes (excluding serial stream start sign)
129 */
130static inline uint16_t mavlink_msg_wind_cov_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
131                                                           mavlink_message_t* msg,
132                                                           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)
133{
134#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
135        char buf[MAVLINK_MSG_ID_WIND_COV_LEN];
136        _mav_put_uint64_t(buf, 0, time_usec);
137        _mav_put_float(buf, 8, wind_x);
138        _mav_put_float(buf, 12, wind_y);
139        _mav_put_float(buf, 16, wind_z);
140        _mav_put_float(buf, 20, var_horiz);
141        _mav_put_float(buf, 24, var_vert);
142        _mav_put_float(buf, 28, wind_alt);
143        _mav_put_float(buf, 32, horiz_accuracy);
144        _mav_put_float(buf, 36, vert_accuracy);
145
146        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_WIND_COV_LEN);
147#else
148        mavlink_wind_cov_t packet;
149        packet.time_usec = time_usec;
150        packet.wind_x = wind_x;
151        packet.wind_y = wind_y;
152        packet.wind_z = wind_z;
153        packet.var_horiz = var_horiz;
154        packet.var_vert = var_vert;
155        packet.wind_alt = wind_alt;
156        packet.horiz_accuracy = horiz_accuracy;
157        packet.vert_accuracy = vert_accuracy;
158
159        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_WIND_COV_LEN);
160#endif
161
162        msg->msgid = MAVLINK_MSG_ID_WIND_COV;
163    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);
164}
165
166/**
167 * @brief Encode a wind_cov struct
168 *
169 * @param system_id ID of this system
170 * @param component_id ID of this component (e.g. 200 for IMU)
171 * @param msg The MAVLink message to compress the data into
172 * @param wind_cov C-struct to read the message contents from
173 */
174static 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)
175{
176        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);
177}
178
179/**
180 * @brief Encode a wind_cov struct on a channel
181 *
182 * @param system_id ID of this system
183 * @param component_id ID of this component (e.g. 200 for IMU)
184 * @param chan The MAVLink channel this message will be sent over
185 * @param msg The MAVLink message to compress the data into
186 * @param wind_cov C-struct to read the message contents from
187 */
188static 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)
189{
190        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);
191}
192
193/**
194 * @brief Send a wind_cov message
195 * @param chan MAVLink channel to send the message
196 *
197 * @param time_usec Timestamp (micros since boot or Unix epoch)
198 * @param wind_x Wind in X (NED) direction in m/s
199 * @param wind_y Wind in Y (NED) direction in m/s
200 * @param wind_z Wind in Z (NED) direction in m/s
201 * @param var_horiz Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
202 * @param var_vert Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
203 * @param wind_alt AMSL altitude (m) this measurement was taken at
204 * @param horiz_accuracy Horizontal speed 1-STD accuracy
205 * @param vert_accuracy Vertical speed 1-STD accuracy
206 */
207#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
208
209static 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)
210{
211#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
212        char buf[MAVLINK_MSG_ID_WIND_COV_LEN];
213        _mav_put_uint64_t(buf, 0, time_usec);
214        _mav_put_float(buf, 8, wind_x);
215        _mav_put_float(buf, 12, wind_y);
216        _mav_put_float(buf, 16, wind_z);
217        _mav_put_float(buf, 20, var_horiz);
218        _mav_put_float(buf, 24, var_vert);
219        _mav_put_float(buf, 28, wind_alt);
220        _mav_put_float(buf, 32, horiz_accuracy);
221        _mav_put_float(buf, 36, vert_accuracy);
222
223    _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);
224#else
225        mavlink_wind_cov_t packet;
226        packet.time_usec = time_usec;
227        packet.wind_x = wind_x;
228        packet.wind_y = wind_y;
229        packet.wind_z = wind_z;
230        packet.var_horiz = var_horiz;
231        packet.var_vert = var_vert;
232        packet.wind_alt = wind_alt;
233        packet.horiz_accuracy = horiz_accuracy;
234        packet.vert_accuracy = vert_accuracy;
235
236    _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);
237#endif
238}
239
240/**
241 * @brief Send a wind_cov message
242 * @param chan MAVLink channel to send the message
243 * @param struct The MAVLink struct to serialize
244 */
245static inline void mavlink_msg_wind_cov_send_struct(mavlink_channel_t chan, const mavlink_wind_cov_t* wind_cov)
246{
247#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
248    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);
249#else
250    _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);
251#endif
252}
253
254#if MAVLINK_MSG_ID_WIND_COV_LEN <= MAVLINK_MAX_PAYLOAD_LEN
255/*
256  This varient of _send() can be used to save stack space by re-using
257  memory from the receive buffer.  The caller provides a
258  mavlink_message_t which is the size of a full mavlink message. This
259  is usually the receive buffer for the channel, and allows a reply to an
260  incoming message with minimum stack space usage.
261 */
262static 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)
263{
264#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
265        char *buf = (char *)msgbuf;
266        _mav_put_uint64_t(buf, 0, time_usec);
267        _mav_put_float(buf, 8, wind_x);
268        _mav_put_float(buf, 12, wind_y);
269        _mav_put_float(buf, 16, wind_z);
270        _mav_put_float(buf, 20, var_horiz);
271        _mav_put_float(buf, 24, var_vert);
272        _mav_put_float(buf, 28, wind_alt);
273        _mav_put_float(buf, 32, horiz_accuracy);
274        _mav_put_float(buf, 36, vert_accuracy);
275
276    _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);
277#else
278        mavlink_wind_cov_t *packet = (mavlink_wind_cov_t *)msgbuf;
279        packet->time_usec = time_usec;
280        packet->wind_x = wind_x;
281        packet->wind_y = wind_y;
282        packet->wind_z = wind_z;
283        packet->var_horiz = var_horiz;
284        packet->var_vert = var_vert;
285        packet->wind_alt = wind_alt;
286        packet->horiz_accuracy = horiz_accuracy;
287        packet->vert_accuracy = vert_accuracy;
288
289    _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);
290#endif
291}
292#endif
293
294#endif
295
296// MESSAGE WIND_COV UNPACKING
297
298
299/**
300 * @brief Get field time_usec from wind_cov message
301 *
302 * @return Timestamp (micros since boot or Unix epoch)
303 */
304static inline uint64_t mavlink_msg_wind_cov_get_time_usec(const mavlink_message_t* msg)
305{
306        return _MAV_RETURN_uint64_t(msg,  0);
307}
308
309/**
310 * @brief Get field wind_x from wind_cov message
311 *
312 * @return Wind in X (NED) direction in m/s
313 */
314static inline float mavlink_msg_wind_cov_get_wind_x(const mavlink_message_t* msg)
315{
316        return _MAV_RETURN_float(msg,  8);
317}
318
319/**
320 * @brief Get field wind_y from wind_cov message
321 *
322 * @return Wind in Y (NED) direction in m/s
323 */
324static inline float mavlink_msg_wind_cov_get_wind_y(const mavlink_message_t* msg)
325{
326        return _MAV_RETURN_float(msg,  12);
327}
328
329/**
330 * @brief Get field wind_z from wind_cov message
331 *
332 * @return Wind in Z (NED) direction in m/s
333 */
334static inline float mavlink_msg_wind_cov_get_wind_z(const mavlink_message_t* msg)
335{
336        return _MAV_RETURN_float(msg,  16);
337}
338
339/**
340 * @brief Get field var_horiz from wind_cov message
341 *
342 * @return Variability of the wind in XY. RMS of a 1 Hz lowpassed wind estimate.
343 */
344static inline float mavlink_msg_wind_cov_get_var_horiz(const mavlink_message_t* msg)
345{
346        return _MAV_RETURN_float(msg,  20);
347}
348
349/**
350 * @brief Get field var_vert from wind_cov message
351 *
352 * @return Variability of the wind in Z. RMS of a 1 Hz lowpassed wind estimate.
353 */
354static inline float mavlink_msg_wind_cov_get_var_vert(const mavlink_message_t* msg)
355{
356        return _MAV_RETURN_float(msg,  24);
357}
358
359/**
360 * @brief Get field wind_alt from wind_cov message
361 *
362 * @return AMSL altitude (m) this measurement was taken at
363 */
364static inline float mavlink_msg_wind_cov_get_wind_alt(const mavlink_message_t* msg)
365{
366        return _MAV_RETURN_float(msg,  28);
367}
368
369/**
370 * @brief Get field horiz_accuracy from wind_cov message
371 *
372 * @return Horizontal speed 1-STD accuracy
373 */
374static inline float mavlink_msg_wind_cov_get_horiz_accuracy(const mavlink_message_t* msg)
375{
376        return _MAV_RETURN_float(msg,  32);
377}
378
379/**
380 * @brief Get field vert_accuracy from wind_cov message
381 *
382 * @return Vertical speed 1-STD accuracy
383 */
384static inline float mavlink_msg_wind_cov_get_vert_accuracy(const mavlink_message_t* msg)
385{
386        return _MAV_RETURN_float(msg,  36);
387}
388
389/**
390 * @brief Decode a wind_cov message into a struct
391 *
392 * @param msg The message to decode
393 * @param wind_cov C-struct to decode the message contents into
394 */
395static inline void mavlink_msg_wind_cov_decode(const mavlink_message_t* msg, mavlink_wind_cov_t* wind_cov)
396{
397#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
398        wind_cov->time_usec = mavlink_msg_wind_cov_get_time_usec(msg);
399        wind_cov->wind_x = mavlink_msg_wind_cov_get_wind_x(msg);
400        wind_cov->wind_y = mavlink_msg_wind_cov_get_wind_y(msg);
401        wind_cov->wind_z = mavlink_msg_wind_cov_get_wind_z(msg);
402        wind_cov->var_horiz = mavlink_msg_wind_cov_get_var_horiz(msg);
403        wind_cov->var_vert = mavlink_msg_wind_cov_get_var_vert(msg);
404        wind_cov->wind_alt = mavlink_msg_wind_cov_get_wind_alt(msg);
405        wind_cov->horiz_accuracy = mavlink_msg_wind_cov_get_horiz_accuracy(msg);
406        wind_cov->vert_accuracy = mavlink_msg_wind_cov_get_vert_accuracy(msg);
407#else
408        uint8_t len = msg->len < MAVLINK_MSG_ID_WIND_COV_LEN? msg->len : MAVLINK_MSG_ID_WIND_COV_LEN;
409        memset(wind_cov, 0, MAVLINK_MSG_ID_WIND_COV_LEN);
410        memcpy(wind_cov, _MAV_PAYLOAD(msg), len);
411#endif
412}
Note: See TracBrowser for help on using the repository browser.