mavlink_msg_wind_cov.h 22 KB

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