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.

313 lines
13 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE MOUNT_STATUS PACKING
  3. #define MAVLINK_MSG_ID_MOUNT_STATUS 158
  4. MAVPACKED(
  5. typedef struct __mavlink_mount_status_t {
  6. int32_t pointing_a; /*< [cdeg] Pitch.*/
  7. int32_t pointing_b; /*< [cdeg] Roll.*/
  8. int32_t pointing_c; /*< [cdeg] Yaw.*/
  9. uint8_t target_system; /*< System ID.*/
  10. uint8_t target_component; /*< Component ID.*/
  11. }) mavlink_mount_status_t;
  12. #define MAVLINK_MSG_ID_MOUNT_STATUS_LEN 14
  13. #define MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN 14
  14. #define MAVLINK_MSG_ID_158_LEN 14
  15. #define MAVLINK_MSG_ID_158_MIN_LEN 14
  16. #define MAVLINK_MSG_ID_MOUNT_STATUS_CRC 134
  17. #define MAVLINK_MSG_ID_158_CRC 134
  18. #if MAVLINK_COMMAND_24BIT
  19. #define MAVLINK_MESSAGE_INFO_MOUNT_STATUS { \
  20. 158, \
  21. "MOUNT_STATUS", \
  22. 5, \
  23. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_status_t, target_system) }, \
  24. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_status_t, target_component) }, \
  25. { "pointing_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_status_t, pointing_a) }, \
  26. { "pointing_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_status_t, pointing_b) }, \
  27. { "pointing_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_status_t, pointing_c) }, \
  28. } \
  29. }
  30. #else
  31. #define MAVLINK_MESSAGE_INFO_MOUNT_STATUS { \
  32. "MOUNT_STATUS", \
  33. 5, \
  34. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_status_t, target_system) }, \
  35. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_status_t, target_component) }, \
  36. { "pointing_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_status_t, pointing_a) }, \
  37. { "pointing_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_status_t, pointing_b) }, \
  38. { "pointing_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_status_t, pointing_c) }, \
  39. } \
  40. }
  41. #endif
  42. /**
  43. * @brief Pack a mount_status message
  44. * @param system_id ID of this system
  45. * @param component_id ID of this component (e.g. 200 for IMU)
  46. * @param msg The MAVLink message to compress the data into
  47. *
  48. * @param target_system System ID.
  49. * @param target_component Component ID.
  50. * @param pointing_a [cdeg] Pitch.
  51. * @param pointing_b [cdeg] Roll.
  52. * @param pointing_c [cdeg] Yaw.
  53. * @return length of the message in bytes (excluding serial stream start sign)
  54. */
  55. static inline uint16_t mavlink_msg_mount_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  56. uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c)
  57. {
  58. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  59. char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN];
  60. _mav_put_int32_t(buf, 0, pointing_a);
  61. _mav_put_int32_t(buf, 4, pointing_b);
  62. _mav_put_int32_t(buf, 8, pointing_c);
  63. _mav_put_uint8_t(buf, 12, target_system);
  64. _mav_put_uint8_t(buf, 13, target_component);
  65. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_STATUS_LEN);
  66. #else
  67. mavlink_mount_status_t packet;
  68. packet.pointing_a = pointing_a;
  69. packet.pointing_b = pointing_b;
  70. packet.pointing_c = pointing_c;
  71. packet.target_system = target_system;
  72. packet.target_component = target_component;
  73. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_STATUS_LEN);
  74. #endif
  75. msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS;
  76. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  77. }
  78. /**
  79. * @brief Pack a mount_status message on a channel
  80. * @param system_id ID of this system
  81. * @param component_id ID of this component (e.g. 200 for IMU)
  82. * @param chan The MAVLink channel this message will be sent over
  83. * @param msg The MAVLink message to compress the data into
  84. * @param target_system System ID.
  85. * @param target_component Component ID.
  86. * @param pointing_a [cdeg] Pitch.
  87. * @param pointing_b [cdeg] Roll.
  88. * @param pointing_c [cdeg] Yaw.
  89. * @return length of the message in bytes (excluding serial stream start sign)
  90. */
  91. static inline uint16_t mavlink_msg_mount_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  92. mavlink_message_t* msg,
  93. uint8_t target_system,uint8_t target_component,int32_t pointing_a,int32_t pointing_b,int32_t pointing_c)
  94. {
  95. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  96. char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN];
  97. _mav_put_int32_t(buf, 0, pointing_a);
  98. _mav_put_int32_t(buf, 4, pointing_b);
  99. _mav_put_int32_t(buf, 8, pointing_c);
  100. _mav_put_uint8_t(buf, 12, target_system);
  101. _mav_put_uint8_t(buf, 13, target_component);
  102. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_STATUS_LEN);
  103. #else
  104. mavlink_mount_status_t packet;
  105. packet.pointing_a = pointing_a;
  106. packet.pointing_b = pointing_b;
  107. packet.pointing_c = pointing_c;
  108. packet.target_system = target_system;
  109. packet.target_component = target_component;
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_STATUS_LEN);
  111. #endif
  112. msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS;
  113. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  114. }
  115. /**
  116. * @brief Encode a mount_status struct
  117. *
  118. * @param system_id ID of this system
  119. * @param component_id ID of this component (e.g. 200 for IMU)
  120. * @param msg The MAVLink message to compress the data into
  121. * @param mount_status C-struct to read the message contents from
  122. */
  123. static inline uint16_t mavlink_msg_mount_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_status_t* mount_status)
  124. {
  125. return mavlink_msg_mount_status_pack(system_id, component_id, msg, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c);
  126. }
  127. /**
  128. * @brief Encode a mount_status struct on a channel
  129. *
  130. * @param system_id ID of this system
  131. * @param component_id ID of this component (e.g. 200 for IMU)
  132. * @param chan The MAVLink channel this message will be sent over
  133. * @param msg The MAVLink message to compress the data into
  134. * @param mount_status C-struct to read the message contents from
  135. */
  136. static inline uint16_t mavlink_msg_mount_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_status_t* mount_status)
  137. {
  138. return mavlink_msg_mount_status_pack_chan(system_id, component_id, chan, msg, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c);
  139. }
  140. /**
  141. * @brief Send a mount_status message
  142. * @param chan MAVLink channel to send the message
  143. *
  144. * @param target_system System ID.
  145. * @param target_component Component ID.
  146. * @param pointing_a [cdeg] Pitch.
  147. * @param pointing_b [cdeg] Roll.
  148. * @param pointing_c [cdeg] Yaw.
  149. */
  150. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  151. static inline void mavlink_msg_mount_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c)
  152. {
  153. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  154. char buf[MAVLINK_MSG_ID_MOUNT_STATUS_LEN];
  155. _mav_put_int32_t(buf, 0, pointing_a);
  156. _mav_put_int32_t(buf, 4, pointing_b);
  157. _mav_put_int32_t(buf, 8, pointing_c);
  158. _mav_put_uint8_t(buf, 12, target_system);
  159. _mav_put_uint8_t(buf, 13, target_component);
  160. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, buf, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  161. #else
  162. mavlink_mount_status_t packet;
  163. packet.pointing_a = pointing_a;
  164. packet.pointing_b = pointing_b;
  165. packet.pointing_c = pointing_c;
  166. packet.target_system = target_system;
  167. packet.target_component = target_component;
  168. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  169. #endif
  170. }
  171. /**
  172. * @brief Send a mount_status message
  173. * @param chan MAVLink channel to send the message
  174. * @param struct The MAVLink struct to serialize
  175. */
  176. static inline void mavlink_msg_mount_status_send_struct(mavlink_channel_t chan, const mavlink_mount_status_t* mount_status)
  177. {
  178. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  179. mavlink_msg_mount_status_send(chan, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c);
  180. #else
  181. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)mount_status, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  182. #endif
  183. }
  184. #if MAVLINK_MSG_ID_MOUNT_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  185. /*
  186. This varient of _send() can be used to save stack space by re-using
  187. memory from the receive buffer. The caller provides a
  188. mavlink_message_t which is the size of a full mavlink message. This
  189. is usually the receive buffer for the channel, and allows a reply to an
  190. incoming message with minimum stack space usage.
  191. */
  192. static inline void mavlink_msg_mount_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c)
  193. {
  194. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  195. char *buf = (char *)msgbuf;
  196. _mav_put_int32_t(buf, 0, pointing_a);
  197. _mav_put_int32_t(buf, 4, pointing_b);
  198. _mav_put_int32_t(buf, 8, pointing_c);
  199. _mav_put_uint8_t(buf, 12, target_system);
  200. _mav_put_uint8_t(buf, 13, target_component);
  201. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, buf, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  202. #else
  203. mavlink_mount_status_t *packet = (mavlink_mount_status_t *)msgbuf;
  204. packet->pointing_a = pointing_a;
  205. packet->pointing_b = pointing_b;
  206. packet->pointing_c = pointing_c;
  207. packet->target_system = target_system;
  208. packet->target_component = target_component;
  209. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)packet, MAVLINK_MSG_ID_MOUNT_STATUS_MIN_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_LEN, MAVLINK_MSG_ID_MOUNT_STATUS_CRC);
  210. #endif
  211. }
  212. #endif
  213. #endif
  214. // MESSAGE MOUNT_STATUS UNPACKING
  215. /**
  216. * @brief Get field target_system from mount_status message
  217. *
  218. * @return System ID.
  219. */
  220. static inline uint8_t mavlink_msg_mount_status_get_target_system(const mavlink_message_t* msg)
  221. {
  222. return _MAV_RETURN_uint8_t(msg, 12);
  223. }
  224. /**
  225. * @brief Get field target_component from mount_status message
  226. *
  227. * @return Component ID.
  228. */
  229. static inline uint8_t mavlink_msg_mount_status_get_target_component(const mavlink_message_t* msg)
  230. {
  231. return _MAV_RETURN_uint8_t(msg, 13);
  232. }
  233. /**
  234. * @brief Get field pointing_a from mount_status message
  235. *
  236. * @return [cdeg] Pitch.
  237. */
  238. static inline int32_t mavlink_msg_mount_status_get_pointing_a(const mavlink_message_t* msg)
  239. {
  240. return _MAV_RETURN_int32_t(msg, 0);
  241. }
  242. /**
  243. * @brief Get field pointing_b from mount_status message
  244. *
  245. * @return [cdeg] Roll.
  246. */
  247. static inline int32_t mavlink_msg_mount_status_get_pointing_b(const mavlink_message_t* msg)
  248. {
  249. return _MAV_RETURN_int32_t(msg, 4);
  250. }
  251. /**
  252. * @brief Get field pointing_c from mount_status message
  253. *
  254. * @return [cdeg] Yaw.
  255. */
  256. static inline int32_t mavlink_msg_mount_status_get_pointing_c(const mavlink_message_t* msg)
  257. {
  258. return _MAV_RETURN_int32_t(msg, 8);
  259. }
  260. /**
  261. * @brief Decode a mount_status message into a struct
  262. *
  263. * @param msg The message to decode
  264. * @param mount_status C-struct to decode the message contents into
  265. */
  266. static inline void mavlink_msg_mount_status_decode(const mavlink_message_t* msg, mavlink_mount_status_t* mount_status)
  267. {
  268. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  269. mount_status->pointing_a = mavlink_msg_mount_status_get_pointing_a(msg);
  270. mount_status->pointing_b = mavlink_msg_mount_status_get_pointing_b(msg);
  271. mount_status->pointing_c = mavlink_msg_mount_status_get_pointing_c(msg);
  272. mount_status->target_system = mavlink_msg_mount_status_get_target_system(msg);
  273. mount_status->target_component = mavlink_msg_mount_status_get_target_component(msg);
  274. #else
  275. uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_STATUS_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_STATUS_LEN;
  276. memset(mount_status, 0, MAVLINK_MSG_ID_MOUNT_STATUS_LEN);
  277. memcpy(mount_status, _MAV_PAYLOAD(msg), len);
  278. #endif
  279. }