mavlink_msg_trajectory_representation_bezier.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. #pragma once
  2. // MESSAGE TRAJECTORY_REPRESENTATION_BEZIER PACKING
  3. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER 333
  4. typedef struct __mavlink_trajectory_representation_bezier_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 pos_x[5]; /*< [m] X-coordinate of bezier control points. Set to NaN if not being used*/
  7. float pos_y[5]; /*< [m] Y-coordinate of bezier control points. Set to NaN if not being used*/
  8. float pos_z[5]; /*< [m] Z-coordinate of bezier control points. Set to NaN if not being used*/
  9. float delta[5]; /*< [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated*/
  10. float pos_yaw[5]; /*< [rad] Yaw. Set to NaN for unchanged*/
  11. uint8_t valid_points; /*< Number of valid control points (up-to 5 points are possible)*/
  12. } mavlink_trajectory_representation_bezier_t;
  13. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN 109
  14. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN 109
  15. #define MAVLINK_MSG_ID_333_LEN 109
  16. #define MAVLINK_MSG_ID_333_MIN_LEN 109
  17. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC 231
  18. #define MAVLINK_MSG_ID_333_CRC 231
  19. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_BEZIER_FIELD_POS_X_LEN 5
  20. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_BEZIER_FIELD_POS_Y_LEN 5
  21. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_BEZIER_FIELD_POS_Z_LEN 5
  22. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_BEZIER_FIELD_DELTA_LEN 5
  23. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_BEZIER_FIELD_POS_YAW_LEN 5
  24. #if MAVLINK_COMMAND_24BIT
  25. #define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER { \
  26. 333, \
  27. "TRAJECTORY_REPRESENTATION_BEZIER", \
  28. 7, \
  29. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_bezier_t, time_usec) }, \
  30. { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 108, offsetof(mavlink_trajectory_representation_bezier_t, valid_points) }, \
  31. { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_bezier_t, pos_x) }, \
  32. { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_bezier_t, pos_y) }, \
  33. { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_bezier_t, pos_z) }, \
  34. { "delta", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_bezier_t, delta) }, \
  35. { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_bezier_t, pos_yaw) }, \
  36. } \
  37. }
  38. #else
  39. #define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_BEZIER { \
  40. "TRAJECTORY_REPRESENTATION_BEZIER", \
  41. 7, \
  42. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_bezier_t, time_usec) }, \
  43. { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 108, offsetof(mavlink_trajectory_representation_bezier_t, valid_points) }, \
  44. { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_bezier_t, pos_x) }, \
  45. { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_bezier_t, pos_y) }, \
  46. { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_bezier_t, pos_z) }, \
  47. { "delta", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_bezier_t, delta) }, \
  48. { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_bezier_t, pos_yaw) }, \
  49. } \
  50. }
  51. #endif
  52. /**
  53. * @brief Pack a trajectory_representation_bezier message
  54. * @param system_id ID of this system
  55. * @param component_id ID of this component (e.g. 200 for IMU)
  56. * @param msg The MAVLink message to compress the data into
  57. *
  58. * @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.
  59. * @param valid_points Number of valid control points (up-to 5 points are possible)
  60. * @param pos_x [m] X-coordinate of bezier control points. Set to NaN if not being used
  61. * @param pos_y [m] Y-coordinate of bezier control points. Set to NaN if not being used
  62. * @param pos_z [m] Z-coordinate of bezier control points. Set to NaN if not being used
  63. * @param delta [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated
  64. * @param pos_yaw [rad] Yaw. Set to NaN for unchanged
  65. * @return length of the message in bytes (excluding serial stream start sign)
  66. */
  67. static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  68. uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw)
  69. {
  70. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  71. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN];
  72. _mav_put_uint64_t(buf, 0, time_usec);
  73. _mav_put_uint8_t(buf, 108, valid_points);
  74. _mav_put_float_array(buf, 8, pos_x, 5);
  75. _mav_put_float_array(buf, 28, pos_y, 5);
  76. _mav_put_float_array(buf, 48, pos_z, 5);
  77. _mav_put_float_array(buf, 68, delta, 5);
  78. _mav_put_float_array(buf, 88, pos_yaw, 5);
  79. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  80. #else
  81. mavlink_trajectory_representation_bezier_t packet;
  82. packet.time_usec = time_usec;
  83. packet.valid_points = valid_points;
  84. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  85. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  86. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  87. mav_array_memcpy(packet.delta, delta, sizeof(float)*5);
  88. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  89. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  90. #endif
  91. msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER;
  92. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  93. }
  94. /**
  95. * @brief Pack a trajectory_representation_bezier message
  96. * @param system_id ID of this system
  97. * @param component_id ID of this component (e.g. 200 for IMU)
  98. * @param status MAVLink status structure
  99. * @param msg The MAVLink message to compress the data into
  100. *
  101. * @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.
  102. * @param valid_points Number of valid control points (up-to 5 points are possible)
  103. * @param pos_x [m] X-coordinate of bezier control points. Set to NaN if not being used
  104. * @param pos_y [m] Y-coordinate of bezier control points. Set to NaN if not being used
  105. * @param pos_z [m] Z-coordinate of bezier control points. Set to NaN if not being used
  106. * @param delta [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated
  107. * @param pos_yaw [rad] Yaw. Set to NaN for unchanged
  108. * @return length of the message in bytes (excluding serial stream start sign)
  109. */
  110. static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  111. uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw)
  112. {
  113. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  114. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN];
  115. _mav_put_uint64_t(buf, 0, time_usec);
  116. _mav_put_uint8_t(buf, 108, valid_points);
  117. _mav_put_float_array(buf, 8, pos_x, 5);
  118. _mav_put_float_array(buf, 28, pos_y, 5);
  119. _mav_put_float_array(buf, 48, pos_z, 5);
  120. _mav_put_float_array(buf, 68, delta, 5);
  121. _mav_put_float_array(buf, 88, pos_yaw, 5);
  122. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  123. #else
  124. mavlink_trajectory_representation_bezier_t packet;
  125. packet.time_usec = time_usec;
  126. packet.valid_points = valid_points;
  127. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  128. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  129. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  130. mav_array_memcpy(packet.delta, delta, sizeof(float)*5);
  131. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  132. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  133. #endif
  134. msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER;
  135. #if MAVLINK_CRC_EXTRA
  136. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  137. #else
  138. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  139. #endif
  140. }
  141. /**
  142. * @brief Pack a trajectory_representation_bezier message on a channel
  143. * @param system_id ID of this system
  144. * @param component_id ID of this component (e.g. 200 for IMU)
  145. * @param chan The MAVLink channel this message will be sent over
  146. * @param msg The MAVLink message to compress the data into
  147. * @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.
  148. * @param valid_points Number of valid control points (up-to 5 points are possible)
  149. * @param pos_x [m] X-coordinate of bezier control points. Set to NaN if not being used
  150. * @param pos_y [m] Y-coordinate of bezier control points. Set to NaN if not being used
  151. * @param pos_z [m] Z-coordinate of bezier control points. Set to NaN if not being used
  152. * @param delta [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated
  153. * @param pos_yaw [rad] Yaw. Set to NaN for unchanged
  154. * @return length of the message in bytes (excluding serial stream start sign)
  155. */
  156. static inline uint16_t mavlink_msg_trajectory_representation_bezier_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  157. mavlink_message_t* msg,
  158. uint64_t time_usec,uint8_t valid_points,const float *pos_x,const float *pos_y,const float *pos_z,const float *delta,const float *pos_yaw)
  159. {
  160. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  161. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN];
  162. _mav_put_uint64_t(buf, 0, time_usec);
  163. _mav_put_uint8_t(buf, 108, valid_points);
  164. _mav_put_float_array(buf, 8, pos_x, 5);
  165. _mav_put_float_array(buf, 28, pos_y, 5);
  166. _mav_put_float_array(buf, 48, pos_z, 5);
  167. _mav_put_float_array(buf, 68, delta, 5);
  168. _mav_put_float_array(buf, 88, pos_yaw, 5);
  169. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  170. #else
  171. mavlink_trajectory_representation_bezier_t packet;
  172. packet.time_usec = time_usec;
  173. packet.valid_points = valid_points;
  174. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  175. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  176. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  177. mav_array_memcpy(packet.delta, delta, sizeof(float)*5);
  178. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  179. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  180. #endif
  181. msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER;
  182. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  183. }
  184. /**
  185. * @brief Encode a trajectory_representation_bezier struct
  186. *
  187. * @param system_id ID of this system
  188. * @param component_id ID of this component (e.g. 200 for IMU)
  189. * @param msg The MAVLink message to compress the data into
  190. * @param trajectory_representation_bezier C-struct to read the message contents from
  191. */
  192. static inline uint16_t mavlink_msg_trajectory_representation_bezier_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier)
  193. {
  194. return mavlink_msg_trajectory_representation_bezier_pack(system_id, component_id, msg, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw);
  195. }
  196. /**
  197. * @brief Encode a trajectory_representation_bezier struct on a channel
  198. *
  199. * @param system_id ID of this system
  200. * @param component_id ID of this component (e.g. 200 for IMU)
  201. * @param chan The MAVLink channel this message will be sent over
  202. * @param msg The MAVLink message to compress the data into
  203. * @param trajectory_representation_bezier C-struct to read the message contents from
  204. */
  205. static inline uint16_t mavlink_msg_trajectory_representation_bezier_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier)
  206. {
  207. return mavlink_msg_trajectory_representation_bezier_pack_chan(system_id, component_id, chan, msg, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw);
  208. }
  209. /**
  210. * @brief Encode a trajectory_representation_bezier struct with provided status structure
  211. *
  212. * @param system_id ID of this system
  213. * @param component_id ID of this component (e.g. 200 for IMU)
  214. * @param status MAVLink status structure
  215. * @param msg The MAVLink message to compress the data into
  216. * @param trajectory_representation_bezier C-struct to read the message contents from
  217. */
  218. static inline uint16_t mavlink_msg_trajectory_representation_bezier_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier)
  219. {
  220. return mavlink_msg_trajectory_representation_bezier_pack_status(system_id, component_id, _status, msg, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw);
  221. }
  222. /**
  223. * @brief Send a trajectory_representation_bezier message
  224. * @param chan MAVLink channel to send the message
  225. *
  226. * @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.
  227. * @param valid_points Number of valid control points (up-to 5 points are possible)
  228. * @param pos_x [m] X-coordinate of bezier control points. Set to NaN if not being used
  229. * @param pos_y [m] Y-coordinate of bezier control points. Set to NaN if not being used
  230. * @param pos_z [m] Z-coordinate of bezier control points. Set to NaN if not being used
  231. * @param delta [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated
  232. * @param pos_yaw [rad] Yaw. Set to NaN for unchanged
  233. */
  234. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  235. static inline void mavlink_msg_trajectory_representation_bezier_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw)
  236. {
  237. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  238. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN];
  239. _mav_put_uint64_t(buf, 0, time_usec);
  240. _mav_put_uint8_t(buf, 108, valid_points);
  241. _mav_put_float_array(buf, 8, pos_x, 5);
  242. _mav_put_float_array(buf, 28, pos_y, 5);
  243. _mav_put_float_array(buf, 48, pos_z, 5);
  244. _mav_put_float_array(buf, 68, delta, 5);
  245. _mav_put_float_array(buf, 88, pos_yaw, 5);
  246. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  247. #else
  248. mavlink_trajectory_representation_bezier_t packet;
  249. packet.time_usec = time_usec;
  250. packet.valid_points = valid_points;
  251. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  252. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  253. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  254. mav_array_memcpy(packet.delta, delta, sizeof(float)*5);
  255. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  256. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, (const char *)&packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  257. #endif
  258. }
  259. /**
  260. * @brief Send a trajectory_representation_bezier message
  261. * @param chan MAVLink channel to send the message
  262. * @param struct The MAVLink struct to serialize
  263. */
  264. static inline void mavlink_msg_trajectory_representation_bezier_send_struct(mavlink_channel_t chan, const mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier)
  265. {
  266. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  267. mavlink_msg_trajectory_representation_bezier_send(chan, trajectory_representation_bezier->time_usec, trajectory_representation_bezier->valid_points, trajectory_representation_bezier->pos_x, trajectory_representation_bezier->pos_y, trajectory_representation_bezier->pos_z, trajectory_representation_bezier->delta, trajectory_representation_bezier->pos_yaw);
  268. #else
  269. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, (const char *)trajectory_representation_bezier, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  270. #endif
  271. }
  272. #if MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  273. /*
  274. This variant of _send() can be used to save stack space by re-using
  275. memory from the receive buffer. The caller provides a
  276. mavlink_message_t which is the size of a full mavlink message. This
  277. is usually the receive buffer for the channel, and allows a reply to an
  278. incoming message with minimum stack space usage.
  279. */
  280. static inline void mavlink_msg_trajectory_representation_bezier_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *delta, const float *pos_yaw)
  281. {
  282. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  283. char *buf = (char *)msgbuf;
  284. _mav_put_uint64_t(buf, 0, time_usec);
  285. _mav_put_uint8_t(buf, 108, valid_points);
  286. _mav_put_float_array(buf, 8, pos_x, 5);
  287. _mav_put_float_array(buf, 28, pos_y, 5);
  288. _mav_put_float_array(buf, 48, pos_z, 5);
  289. _mav_put_float_array(buf, 68, delta, 5);
  290. _mav_put_float_array(buf, 88, pos_yaw, 5);
  291. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  292. #else
  293. mavlink_trajectory_representation_bezier_t *packet = (mavlink_trajectory_representation_bezier_t *)msgbuf;
  294. packet->time_usec = time_usec;
  295. packet->valid_points = valid_points;
  296. mav_array_memcpy(packet->pos_x, pos_x, sizeof(float)*5);
  297. mav_array_memcpy(packet->pos_y, pos_y, sizeof(float)*5);
  298. mav_array_memcpy(packet->pos_z, pos_z, sizeof(float)*5);
  299. mav_array_memcpy(packet->delta, delta, sizeof(float)*5);
  300. mav_array_memcpy(packet->pos_yaw, pos_yaw, sizeof(float)*5);
  301. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER, (const char *)packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_CRC);
  302. #endif
  303. }
  304. #endif
  305. #endif
  306. // MESSAGE TRAJECTORY_REPRESENTATION_BEZIER UNPACKING
  307. /**
  308. * @brief Get field time_usec from trajectory_representation_bezier message
  309. *
  310. * @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.
  311. */
  312. static inline uint64_t mavlink_msg_trajectory_representation_bezier_get_time_usec(const mavlink_message_t* msg)
  313. {
  314. return _MAV_RETURN_uint64_t(msg, 0);
  315. }
  316. /**
  317. * @brief Get field valid_points from trajectory_representation_bezier message
  318. *
  319. * @return Number of valid control points (up-to 5 points are possible)
  320. */
  321. static inline uint8_t mavlink_msg_trajectory_representation_bezier_get_valid_points(const mavlink_message_t* msg)
  322. {
  323. return _MAV_RETURN_uint8_t(msg, 108);
  324. }
  325. /**
  326. * @brief Get field pos_x from trajectory_representation_bezier message
  327. *
  328. * @return [m] X-coordinate of bezier control points. Set to NaN if not being used
  329. */
  330. static inline uint16_t mavlink_msg_trajectory_representation_bezier_get_pos_x(const mavlink_message_t* msg, float *pos_x)
  331. {
  332. return _MAV_RETURN_float_array(msg, pos_x, 5, 8);
  333. }
  334. /**
  335. * @brief Get field pos_y from trajectory_representation_bezier message
  336. *
  337. * @return [m] Y-coordinate of bezier control points. Set to NaN if not being used
  338. */
  339. static inline uint16_t mavlink_msg_trajectory_representation_bezier_get_pos_y(const mavlink_message_t* msg, float *pos_y)
  340. {
  341. return _MAV_RETURN_float_array(msg, pos_y, 5, 28);
  342. }
  343. /**
  344. * @brief Get field pos_z from trajectory_representation_bezier message
  345. *
  346. * @return [m] Z-coordinate of bezier control points. Set to NaN if not being used
  347. */
  348. static inline uint16_t mavlink_msg_trajectory_representation_bezier_get_pos_z(const mavlink_message_t* msg, float *pos_z)
  349. {
  350. return _MAV_RETURN_float_array(msg, pos_z, 5, 48);
  351. }
  352. /**
  353. * @brief Get field delta from trajectory_representation_bezier message
  354. *
  355. * @return [s] Bezier time horizon. Set to NaN if velocity/acceleration should not be incorporated
  356. */
  357. static inline uint16_t mavlink_msg_trajectory_representation_bezier_get_delta(const mavlink_message_t* msg, float *delta)
  358. {
  359. return _MAV_RETURN_float_array(msg, delta, 5, 68);
  360. }
  361. /**
  362. * @brief Get field pos_yaw from trajectory_representation_bezier message
  363. *
  364. * @return [rad] Yaw. Set to NaN for unchanged
  365. */
  366. static inline uint16_t mavlink_msg_trajectory_representation_bezier_get_pos_yaw(const mavlink_message_t* msg, float *pos_yaw)
  367. {
  368. return _MAV_RETURN_float_array(msg, pos_yaw, 5, 88);
  369. }
  370. /**
  371. * @brief Decode a trajectory_representation_bezier message into a struct
  372. *
  373. * @param msg The message to decode
  374. * @param trajectory_representation_bezier C-struct to decode the message contents into
  375. */
  376. static inline void mavlink_msg_trajectory_representation_bezier_decode(const mavlink_message_t* msg, mavlink_trajectory_representation_bezier_t* trajectory_representation_bezier)
  377. {
  378. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  379. trajectory_representation_bezier->time_usec = mavlink_msg_trajectory_representation_bezier_get_time_usec(msg);
  380. mavlink_msg_trajectory_representation_bezier_get_pos_x(msg, trajectory_representation_bezier->pos_x);
  381. mavlink_msg_trajectory_representation_bezier_get_pos_y(msg, trajectory_representation_bezier->pos_y);
  382. mavlink_msg_trajectory_representation_bezier_get_pos_z(msg, trajectory_representation_bezier->pos_z);
  383. mavlink_msg_trajectory_representation_bezier_get_delta(msg, trajectory_representation_bezier->delta);
  384. mavlink_msg_trajectory_representation_bezier_get_pos_yaw(msg, trajectory_representation_bezier->pos_yaw);
  385. trajectory_representation_bezier->valid_points = mavlink_msg_trajectory_representation_bezier_get_valid_points(msg);
  386. #else
  387. uint8_t len = msg->len < MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN? msg->len : MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN;
  388. memset(trajectory_representation_bezier, 0, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_BEZIER_LEN);
  389. memcpy(trajectory_representation_bezier, _MAV_PAYLOAD(msg), len);
  390. #endif
  391. }