You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

263 lines
9.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE AOA_SSA PACKING
  3. #define MAVLINK_MSG_ID_AOA_SSA 11020
  4. MAVPACKED(
  5. typedef struct __mavlink_aoa_ssa_t {
  6. uint64_t time_usec; /*< [us] Timestamp (since boot or Unix epoch).*/
  7. float AOA; /*< [deg] Angle of Attack.*/
  8. float SSA; /*< [deg] Side Slip Angle.*/
  9. }) mavlink_aoa_ssa_t;
  10. #define MAVLINK_MSG_ID_AOA_SSA_LEN 16
  11. #define MAVLINK_MSG_ID_AOA_SSA_MIN_LEN 16
  12. #define MAVLINK_MSG_ID_11020_LEN 16
  13. #define MAVLINK_MSG_ID_11020_MIN_LEN 16
  14. #define MAVLINK_MSG_ID_AOA_SSA_CRC 205
  15. #define MAVLINK_MSG_ID_11020_CRC 205
  16. #if MAVLINK_COMMAND_24BIT
  17. #define MAVLINK_MESSAGE_INFO_AOA_SSA { \
  18. 11020, \
  19. "AOA_SSA", \
  20. 3, \
  21. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aoa_ssa_t, time_usec) }, \
  22. { "AOA", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aoa_ssa_t, AOA) }, \
  23. { "SSA", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aoa_ssa_t, SSA) }, \
  24. } \
  25. }
  26. #else
  27. #define MAVLINK_MESSAGE_INFO_AOA_SSA { \
  28. "AOA_SSA", \
  29. 3, \
  30. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_aoa_ssa_t, time_usec) }, \
  31. { "AOA", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aoa_ssa_t, AOA) }, \
  32. { "SSA", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aoa_ssa_t, SSA) }, \
  33. } \
  34. }
  35. #endif
  36. /**
  37. * @brief Pack a aoa_ssa message
  38. * @param system_id ID of this system
  39. * @param component_id ID of this component (e.g. 200 for IMU)
  40. * @param msg The MAVLink message to compress the data into
  41. *
  42. * @param time_usec [us] Timestamp (since boot or Unix epoch).
  43. * @param AOA [deg] Angle of Attack.
  44. * @param SSA [deg] Side Slip Angle.
  45. * @return length of the message in bytes (excluding serial stream start sign)
  46. */
  47. static inline uint16_t mavlink_msg_aoa_ssa_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  48. uint64_t time_usec, float AOA, float SSA)
  49. {
  50. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  51. char buf[MAVLINK_MSG_ID_AOA_SSA_LEN];
  52. _mav_put_uint64_t(buf, 0, time_usec);
  53. _mav_put_float(buf, 8, AOA);
  54. _mav_put_float(buf, 12, SSA);
  55. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AOA_SSA_LEN);
  56. #else
  57. mavlink_aoa_ssa_t packet;
  58. packet.time_usec = time_usec;
  59. packet.AOA = AOA;
  60. packet.SSA = SSA;
  61. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AOA_SSA_LEN);
  62. #endif
  63. msg->msgid = MAVLINK_MSG_ID_AOA_SSA;
  64. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  65. }
  66. /**
  67. * @brief Pack a aoa_ssa message on a channel
  68. * @param system_id ID of this system
  69. * @param component_id ID of this component (e.g. 200 for IMU)
  70. * @param chan The MAVLink channel this message will be sent over
  71. * @param msg The MAVLink message to compress the data into
  72. * @param time_usec [us] Timestamp (since boot or Unix epoch).
  73. * @param AOA [deg] Angle of Attack.
  74. * @param SSA [deg] Side Slip Angle.
  75. * @return length of the message in bytes (excluding serial stream start sign)
  76. */
  77. static inline uint16_t mavlink_msg_aoa_ssa_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  78. mavlink_message_t* msg,
  79. uint64_t time_usec,float AOA,float SSA)
  80. {
  81. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  82. char buf[MAVLINK_MSG_ID_AOA_SSA_LEN];
  83. _mav_put_uint64_t(buf, 0, time_usec);
  84. _mav_put_float(buf, 8, AOA);
  85. _mav_put_float(buf, 12, SSA);
  86. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AOA_SSA_LEN);
  87. #else
  88. mavlink_aoa_ssa_t packet;
  89. packet.time_usec = time_usec;
  90. packet.AOA = AOA;
  91. packet.SSA = SSA;
  92. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AOA_SSA_LEN);
  93. #endif
  94. msg->msgid = MAVLINK_MSG_ID_AOA_SSA;
  95. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  96. }
  97. /**
  98. * @brief Encode a aoa_ssa struct
  99. *
  100. * @param system_id ID of this system
  101. * @param component_id ID of this component (e.g. 200 for IMU)
  102. * @param msg The MAVLink message to compress the data into
  103. * @param aoa_ssa C-struct to read the message contents from
  104. */
  105. static inline uint16_t mavlink_msg_aoa_ssa_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aoa_ssa_t* aoa_ssa)
  106. {
  107. return mavlink_msg_aoa_ssa_pack(system_id, component_id, msg, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA);
  108. }
  109. /**
  110. * @brief Encode a aoa_ssa struct on a channel
  111. *
  112. * @param system_id ID of this system
  113. * @param component_id ID of this component (e.g. 200 for IMU)
  114. * @param chan The MAVLink channel this message will be sent over
  115. * @param msg The MAVLink message to compress the data into
  116. * @param aoa_ssa C-struct to read the message contents from
  117. */
  118. static inline uint16_t mavlink_msg_aoa_ssa_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_aoa_ssa_t* aoa_ssa)
  119. {
  120. return mavlink_msg_aoa_ssa_pack_chan(system_id, component_id, chan, msg, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA);
  121. }
  122. /**
  123. * @brief Send a aoa_ssa message
  124. * @param chan MAVLink channel to send the message
  125. *
  126. * @param time_usec [us] Timestamp (since boot or Unix epoch).
  127. * @param AOA [deg] Angle of Attack.
  128. * @param SSA [deg] Side Slip Angle.
  129. */
  130. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  131. static inline void mavlink_msg_aoa_ssa_send(mavlink_channel_t chan, uint64_t time_usec, float AOA, float SSA)
  132. {
  133. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  134. char buf[MAVLINK_MSG_ID_AOA_SSA_LEN];
  135. _mav_put_uint64_t(buf, 0, time_usec);
  136. _mav_put_float(buf, 8, AOA);
  137. _mav_put_float(buf, 12, SSA);
  138. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, buf, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  139. #else
  140. mavlink_aoa_ssa_t packet;
  141. packet.time_usec = time_usec;
  142. packet.AOA = AOA;
  143. packet.SSA = SSA;
  144. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)&packet, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  145. #endif
  146. }
  147. /**
  148. * @brief Send a aoa_ssa message
  149. * @param chan MAVLink channel to send the message
  150. * @param struct The MAVLink struct to serialize
  151. */
  152. static inline void mavlink_msg_aoa_ssa_send_struct(mavlink_channel_t chan, const mavlink_aoa_ssa_t* aoa_ssa)
  153. {
  154. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  155. mavlink_msg_aoa_ssa_send(chan, aoa_ssa->time_usec, aoa_ssa->AOA, aoa_ssa->SSA);
  156. #else
  157. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)aoa_ssa, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  158. #endif
  159. }
  160. #if MAVLINK_MSG_ID_AOA_SSA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  161. /*
  162. This varient of _send() can be used to save stack space by re-using
  163. memory from the receive buffer. The caller provides a
  164. mavlink_message_t which is the size of a full mavlink message. This
  165. is usually the receive buffer for the channel, and allows a reply to an
  166. incoming message with minimum stack space usage.
  167. */
  168. static inline void mavlink_msg_aoa_ssa_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float AOA, float SSA)
  169. {
  170. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  171. char *buf = (char *)msgbuf;
  172. _mav_put_uint64_t(buf, 0, time_usec);
  173. _mav_put_float(buf, 8, AOA);
  174. _mav_put_float(buf, 12, SSA);
  175. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, buf, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  176. #else
  177. mavlink_aoa_ssa_t *packet = (mavlink_aoa_ssa_t *)msgbuf;
  178. packet->time_usec = time_usec;
  179. packet->AOA = AOA;
  180. packet->SSA = SSA;
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AOA_SSA, (const char *)packet, MAVLINK_MSG_ID_AOA_SSA_MIN_LEN, MAVLINK_MSG_ID_AOA_SSA_LEN, MAVLINK_MSG_ID_AOA_SSA_CRC);
  182. #endif
  183. }
  184. #endif
  185. #endif
  186. // MESSAGE AOA_SSA UNPACKING
  187. /**
  188. * @brief Get field time_usec from aoa_ssa message
  189. *
  190. * @return [us] Timestamp (since boot or Unix epoch).
  191. */
  192. static inline uint64_t mavlink_msg_aoa_ssa_get_time_usec(const mavlink_message_t* msg)
  193. {
  194. return _MAV_RETURN_uint64_t(msg, 0);
  195. }
  196. /**
  197. * @brief Get field AOA from aoa_ssa message
  198. *
  199. * @return [deg] Angle of Attack.
  200. */
  201. static inline float mavlink_msg_aoa_ssa_get_AOA(const mavlink_message_t* msg)
  202. {
  203. return _MAV_RETURN_float(msg, 8);
  204. }
  205. /**
  206. * @brief Get field SSA from aoa_ssa message
  207. *
  208. * @return [deg] Side Slip Angle.
  209. */
  210. static inline float mavlink_msg_aoa_ssa_get_SSA(const mavlink_message_t* msg)
  211. {
  212. return _MAV_RETURN_float(msg, 12);
  213. }
  214. /**
  215. * @brief Decode a aoa_ssa message into a struct
  216. *
  217. * @param msg The message to decode
  218. * @param aoa_ssa C-struct to decode the message contents into
  219. */
  220. static inline void mavlink_msg_aoa_ssa_decode(const mavlink_message_t* msg, mavlink_aoa_ssa_t* aoa_ssa)
  221. {
  222. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  223. aoa_ssa->time_usec = mavlink_msg_aoa_ssa_get_time_usec(msg);
  224. aoa_ssa->AOA = mavlink_msg_aoa_ssa_get_AOA(msg);
  225. aoa_ssa->SSA = mavlink_msg_aoa_ssa_get_SSA(msg);
  226. #else
  227. uint8_t len = msg->len < MAVLINK_MSG_ID_AOA_SSA_LEN? msg->len : MAVLINK_MSG_ID_AOA_SSA_LEN;
  228. memset(aoa_ssa, 0, MAVLINK_MSG_ID_AOA_SSA_LEN);
  229. memcpy(aoa_ssa, _MAV_PAYLOAD(msg), len);
  230. #endif
  231. }