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.

305 lines
12 KiB

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