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.

388 lines
15 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE ASL_OBCTRL PACKING
  3. #define MAVLINK_MSG_ID_ASL_OBCTRL 207
  4. MAVPACKED(
  5. typedef struct __mavlink_asl_obctrl_t {
  6. uint64_t timestamp; /*< [us] Time since system start*/
  7. float uElev; /*< Elevator command [~]*/
  8. float uThrot; /*< Throttle command [~]*/
  9. float uThrot2; /*< Throttle 2 command [~]*/
  10. float uAilL; /*< Left aileron command [~]*/
  11. float uAilR; /*< Right aileron command [~]*/
  12. float uRud; /*< Rudder command [~]*/
  13. uint8_t obctrl_status; /*< Off-board computer status*/
  14. }) mavlink_asl_obctrl_t;
  15. #define MAVLINK_MSG_ID_ASL_OBCTRL_LEN 33
  16. #define MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN 33
  17. #define MAVLINK_MSG_ID_207_LEN 33
  18. #define MAVLINK_MSG_ID_207_MIN_LEN 33
  19. #define MAVLINK_MSG_ID_ASL_OBCTRL_CRC 234
  20. #define MAVLINK_MSG_ID_207_CRC 234
  21. #if MAVLINK_COMMAND_24BIT
  22. #define MAVLINK_MESSAGE_INFO_ASL_OBCTRL { \
  23. 207, \
  24. "ASL_OBCTRL", \
  25. 8, \
  26. { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_asl_obctrl_t, timestamp) }, \
  27. { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_asl_obctrl_t, uElev) }, \
  28. { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_asl_obctrl_t, uThrot) }, \
  29. { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_asl_obctrl_t, uThrot2) }, \
  30. { "uAilL", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_asl_obctrl_t, uAilL) }, \
  31. { "uAilR", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_asl_obctrl_t, uAilR) }, \
  32. { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_asl_obctrl_t, uRud) }, \
  33. { "obctrl_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_asl_obctrl_t, obctrl_status) }, \
  34. } \
  35. }
  36. #else
  37. #define MAVLINK_MESSAGE_INFO_ASL_OBCTRL { \
  38. "ASL_OBCTRL", \
  39. 8, \
  40. { { "timestamp", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_asl_obctrl_t, timestamp) }, \
  41. { "uElev", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_asl_obctrl_t, uElev) }, \
  42. { "uThrot", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_asl_obctrl_t, uThrot) }, \
  43. { "uThrot2", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_asl_obctrl_t, uThrot2) }, \
  44. { "uAilL", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_asl_obctrl_t, uAilL) }, \
  45. { "uAilR", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_asl_obctrl_t, uAilR) }, \
  46. { "uRud", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_asl_obctrl_t, uRud) }, \
  47. { "obctrl_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_asl_obctrl_t, obctrl_status) }, \
  48. } \
  49. }
  50. #endif
  51. /**
  52. * @brief Pack a asl_obctrl message
  53. * @param system_id ID of this system
  54. * @param component_id ID of this component (e.g. 200 for IMU)
  55. * @param msg The MAVLink message to compress the data into
  56. *
  57. * @param timestamp [us] Time since system start
  58. * @param uElev Elevator command [~]
  59. * @param uThrot Throttle command [~]
  60. * @param uThrot2 Throttle 2 command [~]
  61. * @param uAilL Left aileron command [~]
  62. * @param uAilR Right aileron command [~]
  63. * @param uRud Rudder command [~]
  64. * @param obctrl_status Off-board computer status
  65. * @return length of the message in bytes (excluding serial stream start sign)
  66. */
  67. static inline uint16_t mavlink_msg_asl_obctrl_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  68. uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status)
  69. {
  70. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  71. char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN];
  72. _mav_put_uint64_t(buf, 0, timestamp);
  73. _mav_put_float(buf, 8, uElev);
  74. _mav_put_float(buf, 12, uThrot);
  75. _mav_put_float(buf, 16, uThrot2);
  76. _mav_put_float(buf, 20, uAilL);
  77. _mav_put_float(buf, 24, uAilR);
  78. _mav_put_float(buf, 28, uRud);
  79. _mav_put_uint8_t(buf, 32, obctrl_status);
  80. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASL_OBCTRL_LEN);
  81. #else
  82. mavlink_asl_obctrl_t packet;
  83. packet.timestamp = timestamp;
  84. packet.uElev = uElev;
  85. packet.uThrot = uThrot;
  86. packet.uThrot2 = uThrot2;
  87. packet.uAilL = uAilL;
  88. packet.uAilR = uAilR;
  89. packet.uRud = uRud;
  90. packet.obctrl_status = obctrl_status;
  91. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASL_OBCTRL_LEN);
  92. #endif
  93. msg->msgid = MAVLINK_MSG_ID_ASL_OBCTRL;
  94. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  95. }
  96. /**
  97. * @brief Pack a asl_obctrl message on a channel
  98. * @param system_id ID of this system
  99. * @param component_id ID of this component (e.g. 200 for IMU)
  100. * @param chan The MAVLink channel this message will be sent over
  101. * @param msg The MAVLink message to compress the data into
  102. * @param timestamp [us] Time since system start
  103. * @param uElev Elevator command [~]
  104. * @param uThrot Throttle command [~]
  105. * @param uThrot2 Throttle 2 command [~]
  106. * @param uAilL Left aileron command [~]
  107. * @param uAilR Right aileron command [~]
  108. * @param uRud Rudder command [~]
  109. * @param obctrl_status Off-board computer status
  110. * @return length of the message in bytes (excluding serial stream start sign)
  111. */
  112. static inline uint16_t mavlink_msg_asl_obctrl_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  113. mavlink_message_t* msg,
  114. uint64_t timestamp,float uElev,float uThrot,float uThrot2,float uAilL,float uAilR,float uRud,uint8_t obctrl_status)
  115. {
  116. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  117. char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN];
  118. _mav_put_uint64_t(buf, 0, timestamp);
  119. _mav_put_float(buf, 8, uElev);
  120. _mav_put_float(buf, 12, uThrot);
  121. _mav_put_float(buf, 16, uThrot2);
  122. _mav_put_float(buf, 20, uAilL);
  123. _mav_put_float(buf, 24, uAilR);
  124. _mav_put_float(buf, 28, uRud);
  125. _mav_put_uint8_t(buf, 32, obctrl_status);
  126. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ASL_OBCTRL_LEN);
  127. #else
  128. mavlink_asl_obctrl_t packet;
  129. packet.timestamp = timestamp;
  130. packet.uElev = uElev;
  131. packet.uThrot = uThrot;
  132. packet.uThrot2 = uThrot2;
  133. packet.uAilL = uAilL;
  134. packet.uAilR = uAilR;
  135. packet.uRud = uRud;
  136. packet.obctrl_status = obctrl_status;
  137. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ASL_OBCTRL_LEN);
  138. #endif
  139. msg->msgid = MAVLINK_MSG_ID_ASL_OBCTRL;
  140. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  141. }
  142. /**
  143. * @brief Encode a asl_obctrl struct
  144. *
  145. * @param system_id ID of this system
  146. * @param component_id ID of this component (e.g. 200 for IMU)
  147. * @param msg The MAVLink message to compress the data into
  148. * @param asl_obctrl C-struct to read the message contents from
  149. */
  150. static inline uint16_t mavlink_msg_asl_obctrl_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_asl_obctrl_t* asl_obctrl)
  151. {
  152. return mavlink_msg_asl_obctrl_pack(system_id, component_id, msg, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status);
  153. }
  154. /**
  155. * @brief Encode a asl_obctrl struct on a channel
  156. *
  157. * @param system_id ID of this system
  158. * @param component_id ID of this component (e.g. 200 for IMU)
  159. * @param chan The MAVLink channel this message will be sent over
  160. * @param msg The MAVLink message to compress the data into
  161. * @param asl_obctrl C-struct to read the message contents from
  162. */
  163. static inline uint16_t mavlink_msg_asl_obctrl_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_asl_obctrl_t* asl_obctrl)
  164. {
  165. return mavlink_msg_asl_obctrl_pack_chan(system_id, component_id, chan, msg, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status);
  166. }
  167. /**
  168. * @brief Send a asl_obctrl message
  169. * @param chan MAVLink channel to send the message
  170. *
  171. * @param timestamp [us] Time since system start
  172. * @param uElev Elevator command [~]
  173. * @param uThrot Throttle command [~]
  174. * @param uThrot2 Throttle 2 command [~]
  175. * @param uAilL Left aileron command [~]
  176. * @param uAilR Right aileron command [~]
  177. * @param uRud Rudder command [~]
  178. * @param obctrl_status Off-board computer status
  179. */
  180. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  181. static inline void mavlink_msg_asl_obctrl_send(mavlink_channel_t chan, uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status)
  182. {
  183. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  184. char buf[MAVLINK_MSG_ID_ASL_OBCTRL_LEN];
  185. _mav_put_uint64_t(buf, 0, timestamp);
  186. _mav_put_float(buf, 8, uElev);
  187. _mav_put_float(buf, 12, uThrot);
  188. _mav_put_float(buf, 16, uThrot2);
  189. _mav_put_float(buf, 20, uAilL);
  190. _mav_put_float(buf, 24, uAilR);
  191. _mav_put_float(buf, 28, uRud);
  192. _mav_put_uint8_t(buf, 32, obctrl_status);
  193. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, buf, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  194. #else
  195. mavlink_asl_obctrl_t packet;
  196. packet.timestamp = timestamp;
  197. packet.uElev = uElev;
  198. packet.uThrot = uThrot;
  199. packet.uThrot2 = uThrot2;
  200. packet.uAilL = uAilL;
  201. packet.uAilR = uAilR;
  202. packet.uRud = uRud;
  203. packet.obctrl_status = obctrl_status;
  204. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)&packet, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  205. #endif
  206. }
  207. /**
  208. * @brief Send a asl_obctrl message
  209. * @param chan MAVLink channel to send the message
  210. * @param struct The MAVLink struct to serialize
  211. */
  212. static inline void mavlink_msg_asl_obctrl_send_struct(mavlink_channel_t chan, const mavlink_asl_obctrl_t* asl_obctrl)
  213. {
  214. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  215. mavlink_msg_asl_obctrl_send(chan, asl_obctrl->timestamp, asl_obctrl->uElev, asl_obctrl->uThrot, asl_obctrl->uThrot2, asl_obctrl->uAilL, asl_obctrl->uAilR, asl_obctrl->uRud, asl_obctrl->obctrl_status);
  216. #else
  217. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)asl_obctrl, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  218. #endif
  219. }
  220. #if MAVLINK_MSG_ID_ASL_OBCTRL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  221. /*
  222. This varient of _send() can be used to save stack space by re-using
  223. memory from the receive buffer. The caller provides a
  224. mavlink_message_t which is the size of a full mavlink message. This
  225. is usually the receive buffer for the channel, and allows a reply to an
  226. incoming message with minimum stack space usage.
  227. */
  228. static inline void mavlink_msg_asl_obctrl_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t timestamp, float uElev, float uThrot, float uThrot2, float uAilL, float uAilR, float uRud, uint8_t obctrl_status)
  229. {
  230. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  231. char *buf = (char *)msgbuf;
  232. _mav_put_uint64_t(buf, 0, timestamp);
  233. _mav_put_float(buf, 8, uElev);
  234. _mav_put_float(buf, 12, uThrot);
  235. _mav_put_float(buf, 16, uThrot2);
  236. _mav_put_float(buf, 20, uAilL);
  237. _mav_put_float(buf, 24, uAilR);
  238. _mav_put_float(buf, 28, uRud);
  239. _mav_put_uint8_t(buf, 32, obctrl_status);
  240. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, buf, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  241. #else
  242. mavlink_asl_obctrl_t *packet = (mavlink_asl_obctrl_t *)msgbuf;
  243. packet->timestamp = timestamp;
  244. packet->uElev = uElev;
  245. packet->uThrot = uThrot;
  246. packet->uThrot2 = uThrot2;
  247. packet->uAilL = uAilL;
  248. packet->uAilR = uAilR;
  249. packet->uRud = uRud;
  250. packet->obctrl_status = obctrl_status;
  251. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ASL_OBCTRL, (const char *)packet, MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_LEN, MAVLINK_MSG_ID_ASL_OBCTRL_CRC);
  252. #endif
  253. }
  254. #endif
  255. #endif
  256. // MESSAGE ASL_OBCTRL UNPACKING
  257. /**
  258. * @brief Get field timestamp from asl_obctrl message
  259. *
  260. * @return [us] Time since system start
  261. */
  262. static inline uint64_t mavlink_msg_asl_obctrl_get_timestamp(const mavlink_message_t* msg)
  263. {
  264. return _MAV_RETURN_uint64_t(msg, 0);
  265. }
  266. /**
  267. * @brief Get field uElev from asl_obctrl message
  268. *
  269. * @return Elevator command [~]
  270. */
  271. static inline float mavlink_msg_asl_obctrl_get_uElev(const mavlink_message_t* msg)
  272. {
  273. return _MAV_RETURN_float(msg, 8);
  274. }
  275. /**
  276. * @brief Get field uThrot from asl_obctrl message
  277. *
  278. * @return Throttle command [~]
  279. */
  280. static inline float mavlink_msg_asl_obctrl_get_uThrot(const mavlink_message_t* msg)
  281. {
  282. return _MAV_RETURN_float(msg, 12);
  283. }
  284. /**
  285. * @brief Get field uThrot2 from asl_obctrl message
  286. *
  287. * @return Throttle 2 command [~]
  288. */
  289. static inline float mavlink_msg_asl_obctrl_get_uThrot2(const mavlink_message_t* msg)
  290. {
  291. return _MAV_RETURN_float(msg, 16);
  292. }
  293. /**
  294. * @brief Get field uAilL from asl_obctrl message
  295. *
  296. * @return Left aileron command [~]
  297. */
  298. static inline float mavlink_msg_asl_obctrl_get_uAilL(const mavlink_message_t* msg)
  299. {
  300. return _MAV_RETURN_float(msg, 20);
  301. }
  302. /**
  303. * @brief Get field uAilR from asl_obctrl message
  304. *
  305. * @return Right aileron command [~]
  306. */
  307. static inline float mavlink_msg_asl_obctrl_get_uAilR(const mavlink_message_t* msg)
  308. {
  309. return _MAV_RETURN_float(msg, 24);
  310. }
  311. /**
  312. * @brief Get field uRud from asl_obctrl message
  313. *
  314. * @return Rudder command [~]
  315. */
  316. static inline float mavlink_msg_asl_obctrl_get_uRud(const mavlink_message_t* msg)
  317. {
  318. return _MAV_RETURN_float(msg, 28);
  319. }
  320. /**
  321. * @brief Get field obctrl_status from asl_obctrl message
  322. *
  323. * @return Off-board computer status
  324. */
  325. static inline uint8_t mavlink_msg_asl_obctrl_get_obctrl_status(const mavlink_message_t* msg)
  326. {
  327. return _MAV_RETURN_uint8_t(msg, 32);
  328. }
  329. /**
  330. * @brief Decode a asl_obctrl message into a struct
  331. *
  332. * @param msg The message to decode
  333. * @param asl_obctrl C-struct to decode the message contents into
  334. */
  335. static inline void mavlink_msg_asl_obctrl_decode(const mavlink_message_t* msg, mavlink_asl_obctrl_t* asl_obctrl)
  336. {
  337. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  338. asl_obctrl->timestamp = mavlink_msg_asl_obctrl_get_timestamp(msg);
  339. asl_obctrl->uElev = mavlink_msg_asl_obctrl_get_uElev(msg);
  340. asl_obctrl->uThrot = mavlink_msg_asl_obctrl_get_uThrot(msg);
  341. asl_obctrl->uThrot2 = mavlink_msg_asl_obctrl_get_uThrot2(msg);
  342. asl_obctrl->uAilL = mavlink_msg_asl_obctrl_get_uAilL(msg);
  343. asl_obctrl->uAilR = mavlink_msg_asl_obctrl_get_uAilR(msg);
  344. asl_obctrl->uRud = mavlink_msg_asl_obctrl_get_uRud(msg);
  345. asl_obctrl->obctrl_status = mavlink_msg_asl_obctrl_get_obctrl_status(msg);
  346. #else
  347. uint8_t len = msg->len < MAVLINK_MSG_ID_ASL_OBCTRL_LEN? msg->len : MAVLINK_MSG_ID_ASL_OBCTRL_LEN;
  348. memset(asl_obctrl, 0, MAVLINK_MSG_ID_ASL_OBCTRL_LEN);
  349. memcpy(asl_obctrl, _MAV_PAYLOAD(msg), len);
  350. #endif
  351. }