mavlink_msg_trajectory_representation_waypoints.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. #pragma once
  2. // MESSAGE TRAJECTORY_REPRESENTATION_WAYPOINTS PACKING
  3. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS 332
  4. typedef struct __mavlink_trajectory_representation_waypoints_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 waypoint, set to NaN if not being used*/
  7. float pos_y[5]; /*< [m] Y-coordinate of waypoint, set to NaN if not being used*/
  8. float pos_z[5]; /*< [m] Z-coordinate of waypoint, set to NaN if not being used*/
  9. float vel_x[5]; /*< [m/s] X-velocity of waypoint, set to NaN if not being used*/
  10. float vel_y[5]; /*< [m/s] Y-velocity of waypoint, set to NaN if not being used*/
  11. float vel_z[5]; /*< [m/s] Z-velocity of waypoint, set to NaN if not being used*/
  12. float acc_x[5]; /*< [m/s/s] X-acceleration of waypoint, set to NaN if not being used*/
  13. float acc_y[5]; /*< [m/s/s] Y-acceleration of waypoint, set to NaN if not being used*/
  14. float acc_z[5]; /*< [m/s/s] Z-acceleration of waypoint, set to NaN if not being used*/
  15. float pos_yaw[5]; /*< [rad] Yaw angle, set to NaN if not being used*/
  16. float vel_yaw[5]; /*< [rad/s] Yaw rate, set to NaN if not being used*/
  17. uint16_t command[5]; /*< MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.*/
  18. uint8_t valid_points; /*< Number of valid points (up-to 5 waypoints are possible)*/
  19. } mavlink_trajectory_representation_waypoints_t;
  20. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN 239
  21. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN 239
  22. #define MAVLINK_MSG_ID_332_LEN 239
  23. #define MAVLINK_MSG_ID_332_MIN_LEN 239
  24. #define MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC 236
  25. #define MAVLINK_MSG_ID_332_CRC 236
  26. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_X_LEN 5
  27. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_Y_LEN 5
  28. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_Z_LEN 5
  29. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_X_LEN 5
  30. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_Y_LEN 5
  31. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_Z_LEN 5
  32. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_X_LEN 5
  33. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_Y_LEN 5
  34. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_ACC_Z_LEN 5
  35. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_POS_YAW_LEN 5
  36. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_VEL_YAW_LEN 5
  37. #define MAVLINK_MSG_TRAJECTORY_REPRESENTATION_WAYPOINTS_FIELD_COMMAND_LEN 5
  38. #if MAVLINK_COMMAND_24BIT
  39. #define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS { \
  40. 332, \
  41. "TRAJECTORY_REPRESENTATION_WAYPOINTS", \
  42. 14, \
  43. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_waypoints_t, time_usec) }, \
  44. { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 238, offsetof(mavlink_trajectory_representation_waypoints_t, valid_points) }, \
  45. { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_waypoints_t, pos_x) }, \
  46. { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_waypoints_t, pos_y) }, \
  47. { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_waypoints_t, pos_z) }, \
  48. { "vel_x", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_waypoints_t, vel_x) }, \
  49. { "vel_y", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_waypoints_t, vel_y) }, \
  50. { "vel_z", NULL, MAVLINK_TYPE_FLOAT, 5, 108, offsetof(mavlink_trajectory_representation_waypoints_t, vel_z) }, \
  51. { "acc_x", NULL, MAVLINK_TYPE_FLOAT, 5, 128, offsetof(mavlink_trajectory_representation_waypoints_t, acc_x) }, \
  52. { "acc_y", NULL, MAVLINK_TYPE_FLOAT, 5, 148, offsetof(mavlink_trajectory_representation_waypoints_t, acc_y) }, \
  53. { "acc_z", NULL, MAVLINK_TYPE_FLOAT, 5, 168, offsetof(mavlink_trajectory_representation_waypoints_t, acc_z) }, \
  54. { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 188, offsetof(mavlink_trajectory_representation_waypoints_t, pos_yaw) }, \
  55. { "vel_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 208, offsetof(mavlink_trajectory_representation_waypoints_t, vel_yaw) }, \
  56. { "command", NULL, MAVLINK_TYPE_UINT16_T, 5, 228, offsetof(mavlink_trajectory_representation_waypoints_t, command) }, \
  57. } \
  58. }
  59. #else
  60. #define MAVLINK_MESSAGE_INFO_TRAJECTORY_REPRESENTATION_WAYPOINTS { \
  61. "TRAJECTORY_REPRESENTATION_WAYPOINTS", \
  62. 14, \
  63. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_trajectory_representation_waypoints_t, time_usec) }, \
  64. { "valid_points", NULL, MAVLINK_TYPE_UINT8_T, 0, 238, offsetof(mavlink_trajectory_representation_waypoints_t, valid_points) }, \
  65. { "pos_x", NULL, MAVLINK_TYPE_FLOAT, 5, 8, offsetof(mavlink_trajectory_representation_waypoints_t, pos_x) }, \
  66. { "pos_y", NULL, MAVLINK_TYPE_FLOAT, 5, 28, offsetof(mavlink_trajectory_representation_waypoints_t, pos_y) }, \
  67. { "pos_z", NULL, MAVLINK_TYPE_FLOAT, 5, 48, offsetof(mavlink_trajectory_representation_waypoints_t, pos_z) }, \
  68. { "vel_x", NULL, MAVLINK_TYPE_FLOAT, 5, 68, offsetof(mavlink_trajectory_representation_waypoints_t, vel_x) }, \
  69. { "vel_y", NULL, MAVLINK_TYPE_FLOAT, 5, 88, offsetof(mavlink_trajectory_representation_waypoints_t, vel_y) }, \
  70. { "vel_z", NULL, MAVLINK_TYPE_FLOAT, 5, 108, offsetof(mavlink_trajectory_representation_waypoints_t, vel_z) }, \
  71. { "acc_x", NULL, MAVLINK_TYPE_FLOAT, 5, 128, offsetof(mavlink_trajectory_representation_waypoints_t, acc_x) }, \
  72. { "acc_y", NULL, MAVLINK_TYPE_FLOAT, 5, 148, offsetof(mavlink_trajectory_representation_waypoints_t, acc_y) }, \
  73. { "acc_z", NULL, MAVLINK_TYPE_FLOAT, 5, 168, offsetof(mavlink_trajectory_representation_waypoints_t, acc_z) }, \
  74. { "pos_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 188, offsetof(mavlink_trajectory_representation_waypoints_t, pos_yaw) }, \
  75. { "vel_yaw", NULL, MAVLINK_TYPE_FLOAT, 5, 208, offsetof(mavlink_trajectory_representation_waypoints_t, vel_yaw) }, \
  76. { "command", NULL, MAVLINK_TYPE_UINT16_T, 5, 228, offsetof(mavlink_trajectory_representation_waypoints_t, command) }, \
  77. } \
  78. }
  79. #endif
  80. /**
  81. * @brief Pack a trajectory_representation_waypoints message
  82. * @param system_id ID of this system
  83. * @param component_id ID of this component (e.g. 200 for IMU)
  84. * @param msg The MAVLink message to compress the data into
  85. *
  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 of the number.
  87. * @param valid_points Number of valid points (up-to 5 waypoints are possible)
  88. * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
  89. * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
  90. * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
  91. * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
  92. * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
  93. * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
  94. * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
  95. * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
  96. * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
  97. * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
  98. * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
  99. * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
  100. * @return length of the message in bytes (excluding serial stream start sign)
  101. */
  102. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  103. uint64_t time_usec, uint8_t valid_points, const float *pos_x, const float *pos_y, const float *pos_z, const float *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
  104. {
  105. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  106. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN];
  107. _mav_put_uint64_t(buf, 0, time_usec);
  108. _mav_put_uint8_t(buf, 238, valid_points);
  109. _mav_put_float_array(buf, 8, pos_x, 5);
  110. _mav_put_float_array(buf, 28, pos_y, 5);
  111. _mav_put_float_array(buf, 48, pos_z, 5);
  112. _mav_put_float_array(buf, 68, vel_x, 5);
  113. _mav_put_float_array(buf, 88, vel_y, 5);
  114. _mav_put_float_array(buf, 108, vel_z, 5);
  115. _mav_put_float_array(buf, 128, acc_x, 5);
  116. _mav_put_float_array(buf, 148, acc_y, 5);
  117. _mav_put_float_array(buf, 168, acc_z, 5);
  118. _mav_put_float_array(buf, 188, pos_yaw, 5);
  119. _mav_put_float_array(buf, 208, vel_yaw, 5);
  120. _mav_put_uint16_t_array(buf, 228, command, 5);
  121. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
  122. #else
  123. mavlink_trajectory_representation_waypoints_t packet;
  124. packet.time_usec = time_usec;
  125. packet.valid_points = valid_points;
  126. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  127. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  128. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  129. mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
  130. mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
  131. mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
  132. mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
  133. mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
  134. mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
  135. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  136. mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
  137. mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
  138. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
  139. #endif
  140. msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS;
  141. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  142. }
  143. /**
  144. * @brief Pack a trajectory_representation_waypoints message on a channel
  145. * @param system_id ID of this system
  146. * @param component_id ID of this component (e.g. 200 for IMU)
  147. * @param chan The MAVLink channel this message will be sent over
  148. * @param msg The MAVLink message to compress the data into
  149. * @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.
  150. * @param valid_points Number of valid points (up-to 5 waypoints are possible)
  151. * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
  152. * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
  153. * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
  154. * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
  155. * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
  156. * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
  157. * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
  158. * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
  159. * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
  160. * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
  161. * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
  162. * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
  163. * @return length of the message in bytes (excluding serial stream start sign)
  164. */
  165. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  166. mavlink_message_t* msg,
  167. uint64_t time_usec,uint8_t valid_points,const float *pos_x,const float *pos_y,const float *pos_z,const float *vel_x,const float *vel_y,const float *vel_z,const float *acc_x,const float *acc_y,const float *acc_z,const float *pos_yaw,const float *vel_yaw,const uint16_t *command)
  168. {
  169. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  170. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN];
  171. _mav_put_uint64_t(buf, 0, time_usec);
  172. _mav_put_uint8_t(buf, 238, valid_points);
  173. _mav_put_float_array(buf, 8, pos_x, 5);
  174. _mav_put_float_array(buf, 28, pos_y, 5);
  175. _mav_put_float_array(buf, 48, pos_z, 5);
  176. _mav_put_float_array(buf, 68, vel_x, 5);
  177. _mav_put_float_array(buf, 88, vel_y, 5);
  178. _mav_put_float_array(buf, 108, vel_z, 5);
  179. _mav_put_float_array(buf, 128, acc_x, 5);
  180. _mav_put_float_array(buf, 148, acc_y, 5);
  181. _mav_put_float_array(buf, 168, acc_z, 5);
  182. _mav_put_float_array(buf, 188, pos_yaw, 5);
  183. _mav_put_float_array(buf, 208, vel_yaw, 5);
  184. _mav_put_uint16_t_array(buf, 228, command, 5);
  185. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
  186. #else
  187. mavlink_trajectory_representation_waypoints_t packet;
  188. packet.time_usec = time_usec;
  189. packet.valid_points = valid_points;
  190. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  191. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  192. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  193. mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
  194. mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
  195. mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
  196. mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
  197. mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
  198. mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
  199. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  200. mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
  201. mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
  202. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
  203. #endif
  204. msg->msgid = MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS;
  205. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  206. }
  207. /**
  208. * @brief Encode a trajectory_representation_waypoints struct
  209. *
  210. * @param system_id ID of this system
  211. * @param component_id ID of this component (e.g. 200 for IMU)
  212. * @param msg The MAVLink message to compress the data into
  213. * @param trajectory_representation_waypoints C-struct to read the message contents from
  214. */
  215. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
  216. {
  217. return mavlink_msg_trajectory_representation_waypoints_pack(system_id, component_id, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
  218. }
  219. /**
  220. * @brief Encode a trajectory_representation_waypoints struct on a channel
  221. *
  222. * @param system_id ID of this system
  223. * @param component_id ID of this component (e.g. 200 for IMU)
  224. * @param chan The MAVLink channel this message will be sent over
  225. * @param msg The MAVLink message to compress the data into
  226. * @param trajectory_representation_waypoints C-struct to read the message contents from
  227. */
  228. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
  229. {
  230. return mavlink_msg_trajectory_representation_waypoints_pack_chan(system_id, component_id, chan, msg, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
  231. }
  232. /**
  233. * @brief Send a trajectory_representation_waypoints message
  234. * @param chan MAVLink channel to send the message
  235. *
  236. * @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.
  237. * @param valid_points Number of valid points (up-to 5 waypoints are possible)
  238. * @param pos_x [m] X-coordinate of waypoint, set to NaN if not being used
  239. * @param pos_y [m] Y-coordinate of waypoint, set to NaN if not being used
  240. * @param pos_z [m] Z-coordinate of waypoint, set to NaN if not being used
  241. * @param vel_x [m/s] X-velocity of waypoint, set to NaN if not being used
  242. * @param vel_y [m/s] Y-velocity of waypoint, set to NaN if not being used
  243. * @param vel_z [m/s] Z-velocity of waypoint, set to NaN if not being used
  244. * @param acc_x [m/s/s] X-acceleration of waypoint, set to NaN if not being used
  245. * @param acc_y [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
  246. * @param acc_z [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
  247. * @param pos_yaw [rad] Yaw angle, set to NaN if not being used
  248. * @param vel_yaw [rad/s] Yaw rate, set to NaN if not being used
  249. * @param command MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
  250. */
  251. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  252. static inline void mavlink_msg_trajectory_representation_waypoints_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 *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
  253. {
  254. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  255. char buf[MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN];
  256. _mav_put_uint64_t(buf, 0, time_usec);
  257. _mav_put_uint8_t(buf, 238, valid_points);
  258. _mav_put_float_array(buf, 8, pos_x, 5);
  259. _mav_put_float_array(buf, 28, pos_y, 5);
  260. _mav_put_float_array(buf, 48, pos_z, 5);
  261. _mav_put_float_array(buf, 68, vel_x, 5);
  262. _mav_put_float_array(buf, 88, vel_y, 5);
  263. _mav_put_float_array(buf, 108, vel_z, 5);
  264. _mav_put_float_array(buf, 128, acc_x, 5);
  265. _mav_put_float_array(buf, 148, acc_y, 5);
  266. _mav_put_float_array(buf, 168, acc_z, 5);
  267. _mav_put_float_array(buf, 188, pos_yaw, 5);
  268. _mav_put_float_array(buf, 208, vel_yaw, 5);
  269. _mav_put_uint16_t_array(buf, 228, command, 5);
  270. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  271. #else
  272. mavlink_trajectory_representation_waypoints_t packet;
  273. packet.time_usec = time_usec;
  274. packet.valid_points = valid_points;
  275. mav_array_memcpy(packet.pos_x, pos_x, sizeof(float)*5);
  276. mav_array_memcpy(packet.pos_y, pos_y, sizeof(float)*5);
  277. mav_array_memcpy(packet.pos_z, pos_z, sizeof(float)*5);
  278. mav_array_memcpy(packet.vel_x, vel_x, sizeof(float)*5);
  279. mav_array_memcpy(packet.vel_y, vel_y, sizeof(float)*5);
  280. mav_array_memcpy(packet.vel_z, vel_z, sizeof(float)*5);
  281. mav_array_memcpy(packet.acc_x, acc_x, sizeof(float)*5);
  282. mav_array_memcpy(packet.acc_y, acc_y, sizeof(float)*5);
  283. mav_array_memcpy(packet.acc_z, acc_z, sizeof(float)*5);
  284. mav_array_memcpy(packet.pos_yaw, pos_yaw, sizeof(float)*5);
  285. mav_array_memcpy(packet.vel_yaw, vel_yaw, sizeof(float)*5);
  286. mav_array_memcpy(packet.command, command, sizeof(uint16_t)*5);
  287. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)&packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  288. #endif
  289. }
  290. /**
  291. * @brief Send a trajectory_representation_waypoints message
  292. * @param chan MAVLink channel to send the message
  293. * @param struct The MAVLink struct to serialize
  294. */
  295. static inline void mavlink_msg_trajectory_representation_waypoints_send_struct(mavlink_channel_t chan, const mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
  296. {
  297. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  298. mavlink_msg_trajectory_representation_waypoints_send(chan, trajectory_representation_waypoints->time_usec, trajectory_representation_waypoints->valid_points, trajectory_representation_waypoints->pos_x, trajectory_representation_waypoints->pos_y, trajectory_representation_waypoints->pos_z, trajectory_representation_waypoints->vel_x, trajectory_representation_waypoints->vel_y, trajectory_representation_waypoints->vel_z, trajectory_representation_waypoints->acc_x, trajectory_representation_waypoints->acc_y, trajectory_representation_waypoints->acc_z, trajectory_representation_waypoints->pos_yaw, trajectory_representation_waypoints->vel_yaw, trajectory_representation_waypoints->command);
  299. #else
  300. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)trajectory_representation_waypoints, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  301. #endif
  302. }
  303. #if MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  304. /*
  305. This variant of _send() can be used to save stack space by re-using
  306. memory from the receive buffer. The caller provides a
  307. mavlink_message_t which is the size of a full mavlink message. This
  308. is usually the receive buffer for the channel, and allows a reply to an
  309. incoming message with minimum stack space usage.
  310. */
  311. static inline void mavlink_msg_trajectory_representation_waypoints_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 *vel_x, const float *vel_y, const float *vel_z, const float *acc_x, const float *acc_y, const float *acc_z, const float *pos_yaw, const float *vel_yaw, const uint16_t *command)
  312. {
  313. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  314. char *buf = (char *)msgbuf;
  315. _mav_put_uint64_t(buf, 0, time_usec);
  316. _mav_put_uint8_t(buf, 238, valid_points);
  317. _mav_put_float_array(buf, 8, pos_x, 5);
  318. _mav_put_float_array(buf, 28, pos_y, 5);
  319. _mav_put_float_array(buf, 48, pos_z, 5);
  320. _mav_put_float_array(buf, 68, vel_x, 5);
  321. _mav_put_float_array(buf, 88, vel_y, 5);
  322. _mav_put_float_array(buf, 108, vel_z, 5);
  323. _mav_put_float_array(buf, 128, acc_x, 5);
  324. _mav_put_float_array(buf, 148, acc_y, 5);
  325. _mav_put_float_array(buf, 168, acc_z, 5);
  326. _mav_put_float_array(buf, 188, pos_yaw, 5);
  327. _mav_put_float_array(buf, 208, vel_yaw, 5);
  328. _mav_put_uint16_t_array(buf, 228, command, 5);
  329. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, buf, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  330. #else
  331. mavlink_trajectory_representation_waypoints_t *packet = (mavlink_trajectory_representation_waypoints_t *)msgbuf;
  332. packet->time_usec = time_usec;
  333. packet->valid_points = valid_points;
  334. mav_array_memcpy(packet->pos_x, pos_x, sizeof(float)*5);
  335. mav_array_memcpy(packet->pos_y, pos_y, sizeof(float)*5);
  336. mav_array_memcpy(packet->pos_z, pos_z, sizeof(float)*5);
  337. mav_array_memcpy(packet->vel_x, vel_x, sizeof(float)*5);
  338. mav_array_memcpy(packet->vel_y, vel_y, sizeof(float)*5);
  339. mav_array_memcpy(packet->vel_z, vel_z, sizeof(float)*5);
  340. mav_array_memcpy(packet->acc_x, acc_x, sizeof(float)*5);
  341. mav_array_memcpy(packet->acc_y, acc_y, sizeof(float)*5);
  342. mav_array_memcpy(packet->acc_z, acc_z, sizeof(float)*5);
  343. mav_array_memcpy(packet->pos_yaw, pos_yaw, sizeof(float)*5);
  344. mav_array_memcpy(packet->vel_yaw, vel_yaw, sizeof(float)*5);
  345. mav_array_memcpy(packet->command, command, sizeof(uint16_t)*5);
  346. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS, (const char *)packet, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_MIN_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_CRC);
  347. #endif
  348. }
  349. #endif
  350. #endif
  351. // MESSAGE TRAJECTORY_REPRESENTATION_WAYPOINTS UNPACKING
  352. /**
  353. * @brief Get field time_usec from trajectory_representation_waypoints message
  354. *
  355. * @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.
  356. */
  357. static inline uint64_t mavlink_msg_trajectory_representation_waypoints_get_time_usec(const mavlink_message_t* msg)
  358. {
  359. return _MAV_RETURN_uint64_t(msg, 0);
  360. }
  361. /**
  362. * @brief Get field valid_points from trajectory_representation_waypoints message
  363. *
  364. * @return Number of valid points (up-to 5 waypoints are possible)
  365. */
  366. static inline uint8_t mavlink_msg_trajectory_representation_waypoints_get_valid_points(const mavlink_message_t* msg)
  367. {
  368. return _MAV_RETURN_uint8_t(msg, 238);
  369. }
  370. /**
  371. * @brief Get field pos_x from trajectory_representation_waypoints message
  372. *
  373. * @return [m] X-coordinate of waypoint, set to NaN if not being used
  374. */
  375. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_x(const mavlink_message_t* msg, float *pos_x)
  376. {
  377. return _MAV_RETURN_float_array(msg, pos_x, 5, 8);
  378. }
  379. /**
  380. * @brief Get field pos_y from trajectory_representation_waypoints message
  381. *
  382. * @return [m] Y-coordinate of waypoint, set to NaN if not being used
  383. */
  384. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_y(const mavlink_message_t* msg, float *pos_y)
  385. {
  386. return _MAV_RETURN_float_array(msg, pos_y, 5, 28);
  387. }
  388. /**
  389. * @brief Get field pos_z from trajectory_representation_waypoints message
  390. *
  391. * @return [m] Z-coordinate of waypoint, set to NaN if not being used
  392. */
  393. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_z(const mavlink_message_t* msg, float *pos_z)
  394. {
  395. return _MAV_RETURN_float_array(msg, pos_z, 5, 48);
  396. }
  397. /**
  398. * @brief Get field vel_x from trajectory_representation_waypoints message
  399. *
  400. * @return [m/s] X-velocity of waypoint, set to NaN if not being used
  401. */
  402. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_x(const mavlink_message_t* msg, float *vel_x)
  403. {
  404. return _MAV_RETURN_float_array(msg, vel_x, 5, 68);
  405. }
  406. /**
  407. * @brief Get field vel_y from trajectory_representation_waypoints message
  408. *
  409. * @return [m/s] Y-velocity of waypoint, set to NaN if not being used
  410. */
  411. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_y(const mavlink_message_t* msg, float *vel_y)
  412. {
  413. return _MAV_RETURN_float_array(msg, vel_y, 5, 88);
  414. }
  415. /**
  416. * @brief Get field vel_z from trajectory_representation_waypoints message
  417. *
  418. * @return [m/s] Z-velocity of waypoint, set to NaN if not being used
  419. */
  420. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_z(const mavlink_message_t* msg, float *vel_z)
  421. {
  422. return _MAV_RETURN_float_array(msg, vel_z, 5, 108);
  423. }
  424. /**
  425. * @brief Get field acc_x from trajectory_representation_waypoints message
  426. *
  427. * @return [m/s/s] X-acceleration of waypoint, set to NaN if not being used
  428. */
  429. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_x(const mavlink_message_t* msg, float *acc_x)
  430. {
  431. return _MAV_RETURN_float_array(msg, acc_x, 5, 128);
  432. }
  433. /**
  434. * @brief Get field acc_y from trajectory_representation_waypoints message
  435. *
  436. * @return [m/s/s] Y-acceleration of waypoint, set to NaN if not being used
  437. */
  438. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_y(const mavlink_message_t* msg, float *acc_y)
  439. {
  440. return _MAV_RETURN_float_array(msg, acc_y, 5, 148);
  441. }
  442. /**
  443. * @brief Get field acc_z from trajectory_representation_waypoints message
  444. *
  445. * @return [m/s/s] Z-acceleration of waypoint, set to NaN if not being used
  446. */
  447. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_acc_z(const mavlink_message_t* msg, float *acc_z)
  448. {
  449. return _MAV_RETURN_float_array(msg, acc_z, 5, 168);
  450. }
  451. /**
  452. * @brief Get field pos_yaw from trajectory_representation_waypoints message
  453. *
  454. * @return [rad] Yaw angle, set to NaN if not being used
  455. */
  456. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_pos_yaw(const mavlink_message_t* msg, float *pos_yaw)
  457. {
  458. return _MAV_RETURN_float_array(msg, pos_yaw, 5, 188);
  459. }
  460. /**
  461. * @brief Get field vel_yaw from trajectory_representation_waypoints message
  462. *
  463. * @return [rad/s] Yaw rate, set to NaN if not being used
  464. */
  465. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_vel_yaw(const mavlink_message_t* msg, float *vel_yaw)
  466. {
  467. return _MAV_RETURN_float_array(msg, vel_yaw, 5, 208);
  468. }
  469. /**
  470. * @brief Get field command from trajectory_representation_waypoints message
  471. *
  472. * @return MAV_CMD command id of waypoint, set to UINT16_MAX if not being used.
  473. */
  474. static inline uint16_t mavlink_msg_trajectory_representation_waypoints_get_command(const mavlink_message_t* msg, uint16_t *command)
  475. {
  476. return _MAV_RETURN_uint16_t_array(msg, command, 5, 228);
  477. }
  478. /**
  479. * @brief Decode a trajectory_representation_waypoints message into a struct
  480. *
  481. * @param msg The message to decode
  482. * @param trajectory_representation_waypoints C-struct to decode the message contents into
  483. */
  484. static inline void mavlink_msg_trajectory_representation_waypoints_decode(const mavlink_message_t* msg, mavlink_trajectory_representation_waypoints_t* trajectory_representation_waypoints)
  485. {
  486. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  487. trajectory_representation_waypoints->time_usec = mavlink_msg_trajectory_representation_waypoints_get_time_usec(msg);
  488. mavlink_msg_trajectory_representation_waypoints_get_pos_x(msg, trajectory_representation_waypoints->pos_x);
  489. mavlink_msg_trajectory_representation_waypoints_get_pos_y(msg, trajectory_representation_waypoints->pos_y);
  490. mavlink_msg_trajectory_representation_waypoints_get_pos_z(msg, trajectory_representation_waypoints->pos_z);
  491. mavlink_msg_trajectory_representation_waypoints_get_vel_x(msg, trajectory_representation_waypoints->vel_x);
  492. mavlink_msg_trajectory_representation_waypoints_get_vel_y(msg, trajectory_representation_waypoints->vel_y);
  493. mavlink_msg_trajectory_representation_waypoints_get_vel_z(msg, trajectory_representation_waypoints->vel_z);
  494. mavlink_msg_trajectory_representation_waypoints_get_acc_x(msg, trajectory_representation_waypoints->acc_x);
  495. mavlink_msg_trajectory_representation_waypoints_get_acc_y(msg, trajectory_representation_waypoints->acc_y);
  496. mavlink_msg_trajectory_representation_waypoints_get_acc_z(msg, trajectory_representation_waypoints->acc_z);
  497. mavlink_msg_trajectory_representation_waypoints_get_pos_yaw(msg, trajectory_representation_waypoints->pos_yaw);
  498. mavlink_msg_trajectory_representation_waypoints_get_vel_yaw(msg, trajectory_representation_waypoints->vel_yaw);
  499. mavlink_msg_trajectory_representation_waypoints_get_command(msg, trajectory_representation_waypoints->command);
  500. trajectory_representation_waypoints->valid_points = mavlink_msg_trajectory_representation_waypoints_get_valid_points(msg);
  501. #else
  502. uint8_t len = msg->len < MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN? msg->len : MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN;
  503. memset(trajectory_representation_waypoints, 0, MAVLINK_MSG_ID_TRAJECTORY_REPRESENTATION_WAYPOINTS_LEN);
  504. memcpy(trajectory_representation_waypoints, _MAV_PAYLOAD(msg), len);
  505. #endif
  506. }