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.

530 lines
25 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE LANDING_TARGET PACKING
  3. #define MAVLINK_MSG_ID_LANDING_TARGET 149
  4. MAVPACKED(
  5. typedef struct __mavlink_landing_target_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 angle_x; /*< [rad] X-axis angular offset of the target from the center of the image*/
  8. float angle_y; /*< [rad] Y-axis angular offset of the target from the center of the image*/
  9. float distance; /*< [m] Distance to the target from the vehicle*/
  10. float size_x; /*< [rad] Size of target along x-axis*/
  11. float size_y; /*< [rad] Size of target along y-axis*/
  12. uint8_t target_num; /*< The ID of the target if multiple targets are present*/
  13. uint8_t frame; /*< Coordinate frame used for following fields.*/
  14. float x; /*< [m] X Position of the landing target in MAV_FRAME*/
  15. float y; /*< [m] Y Position of the landing target in MAV_FRAME*/
  16. float z; /*< [m] Z Position of the landing target in MAV_FRAME*/
  17. float q[4]; /*< Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
  18. uint8_t type; /*< Type of landing target*/
  19. uint8_t position_valid; /*< Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).*/
  20. }) mavlink_landing_target_t;
  21. #define MAVLINK_MSG_ID_LANDING_TARGET_LEN 60
  22. #define MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN 30
  23. #define MAVLINK_MSG_ID_149_LEN 60
  24. #define MAVLINK_MSG_ID_149_MIN_LEN 30
  25. #define MAVLINK_MSG_ID_LANDING_TARGET_CRC 200
  26. #define MAVLINK_MSG_ID_149_CRC 200
  27. #define MAVLINK_MSG_LANDING_TARGET_FIELD_Q_LEN 4
  28. #if MAVLINK_COMMAND_24BIT
  29. #define MAVLINK_MESSAGE_INFO_LANDING_TARGET { \
  30. 149, \
  31. "LANDING_TARGET", \
  32. 14, \
  33. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) }, \
  34. { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) }, \
  35. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) }, \
  36. { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) }, \
  37. { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) }, \
  38. { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) }, \
  39. { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) }, \
  40. { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) }, \
  41. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_landing_target_t, x) }, \
  42. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_landing_target_t, y) }, \
  43. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_landing_target_t, z) }, \
  44. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 42, offsetof(mavlink_landing_target_t, q) }, \
  45. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_landing_target_t, type) }, \
  46. { "position_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 59, offsetof(mavlink_landing_target_t, position_valid) }, \
  47. } \
  48. }
  49. #else
  50. #define MAVLINK_MESSAGE_INFO_LANDING_TARGET { \
  51. "LANDING_TARGET", \
  52. 14, \
  53. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_landing_target_t, time_usec) }, \
  54. { "target_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_landing_target_t, target_num) }, \
  55. { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_landing_target_t, frame) }, \
  56. { "angle_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_landing_target_t, angle_x) }, \
  57. { "angle_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_landing_target_t, angle_y) }, \
  58. { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_landing_target_t, distance) }, \
  59. { "size_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_landing_target_t, size_x) }, \
  60. { "size_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_landing_target_t, size_y) }, \
  61. { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_landing_target_t, x) }, \
  62. { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_landing_target_t, y) }, \
  63. { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_landing_target_t, z) }, \
  64. { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 42, offsetof(mavlink_landing_target_t, q) }, \
  65. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_landing_target_t, type) }, \
  66. { "position_valid", NULL, MAVLINK_TYPE_UINT8_T, 0, 59, offsetof(mavlink_landing_target_t, position_valid) }, \
  67. } \
  68. }
  69. #endif
  70. /**
  71. * @brief Pack a landing_target message
  72. * @param system_id ID of this system
  73. * @param component_id ID of this component (e.g. 200 for IMU)
  74. * @param msg The MAVLink message to compress the data into
  75. *
  76. * @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.
  77. * @param target_num The ID of the target if multiple targets are present
  78. * @param frame Coordinate frame used for following fields.
  79. * @param angle_x [rad] X-axis angular offset of the target from the center of the image
  80. * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
  81. * @param distance [m] Distance to the target from the vehicle
  82. * @param size_x [rad] Size of target along x-axis
  83. * @param size_y [rad] Size of target along y-axis
  84. * @param x [m] X Position of the landing target in MAV_FRAME
  85. * @param y [m] Y Position of the landing target in MAV_FRAME
  86. * @param z [m] Z Position of the landing target in MAV_FRAME
  87. * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  88. * @param type Type of landing target
  89. * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).
  90. * @return length of the message in bytes (excluding serial stream start sign)
  91. */
  92. static inline uint16_t mavlink_msg_landing_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  93. uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
  94. {
  95. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  96. char buf[MAVLINK_MSG_ID_LANDING_TARGET_LEN];
  97. _mav_put_uint64_t(buf, 0, time_usec);
  98. _mav_put_float(buf, 8, angle_x);
  99. _mav_put_float(buf, 12, angle_y);
  100. _mav_put_float(buf, 16, distance);
  101. _mav_put_float(buf, 20, size_x);
  102. _mav_put_float(buf, 24, size_y);
  103. _mav_put_uint8_t(buf, 28, target_num);
  104. _mav_put_uint8_t(buf, 29, frame);
  105. _mav_put_float(buf, 30, x);
  106. _mav_put_float(buf, 34, y);
  107. _mav_put_float(buf, 38, z);
  108. _mav_put_uint8_t(buf, 58, type);
  109. _mav_put_uint8_t(buf, 59, position_valid);
  110. _mav_put_float_array(buf, 42, q, 4);
  111. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
  112. #else
  113. mavlink_landing_target_t packet;
  114. packet.time_usec = time_usec;
  115. packet.angle_x = angle_x;
  116. packet.angle_y = angle_y;
  117. packet.distance = distance;
  118. packet.size_x = size_x;
  119. packet.size_y = size_y;
  120. packet.target_num = target_num;
  121. packet.frame = frame;
  122. packet.x = x;
  123. packet.y = y;
  124. packet.z = z;
  125. packet.type = type;
  126. packet.position_valid = position_valid;
  127. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  128. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
  129. #endif
  130. msg->msgid = MAVLINK_MSG_ID_LANDING_TARGET;
  131. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  132. }
  133. /**
  134. * @brief Pack a landing_target message on a channel
  135. * @param system_id ID of this system
  136. * @param component_id ID of this component (e.g. 200 for IMU)
  137. * @param chan The MAVLink channel this message will be sent over
  138. * @param msg The MAVLink message to compress the data into
  139. * @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.
  140. * @param target_num The ID of the target if multiple targets are present
  141. * @param frame Coordinate frame used for following fields.
  142. * @param angle_x [rad] X-axis angular offset of the target from the center of the image
  143. * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
  144. * @param distance [m] Distance to the target from the vehicle
  145. * @param size_x [rad] Size of target along x-axis
  146. * @param size_y [rad] Size of target along y-axis
  147. * @param x [m] X Position of the landing target in MAV_FRAME
  148. * @param y [m] Y Position of the landing target in MAV_FRAME
  149. * @param z [m] Z Position of the landing target in MAV_FRAME
  150. * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  151. * @param type Type of landing target
  152. * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).
  153. * @return length of the message in bytes (excluding serial stream start sign)
  154. */
  155. static inline uint16_t mavlink_msg_landing_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  156. mavlink_message_t* msg,
  157. uint64_t time_usec,uint8_t target_num,uint8_t frame,float angle_x,float angle_y,float distance,float size_x,float size_y,float x,float y,float z,const float *q,uint8_t type,uint8_t position_valid)
  158. {
  159. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  160. char buf[MAVLINK_MSG_ID_LANDING_TARGET_LEN];
  161. _mav_put_uint64_t(buf, 0, time_usec);
  162. _mav_put_float(buf, 8, angle_x);
  163. _mav_put_float(buf, 12, angle_y);
  164. _mav_put_float(buf, 16, distance);
  165. _mav_put_float(buf, 20, size_x);
  166. _mav_put_float(buf, 24, size_y);
  167. _mav_put_uint8_t(buf, 28, target_num);
  168. _mav_put_uint8_t(buf, 29, frame);
  169. _mav_put_float(buf, 30, x);
  170. _mav_put_float(buf, 34, y);
  171. _mav_put_float(buf, 38, z);
  172. _mav_put_uint8_t(buf, 58, type);
  173. _mav_put_uint8_t(buf, 59, position_valid);
  174. _mav_put_float_array(buf, 42, q, 4);
  175. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
  176. #else
  177. mavlink_landing_target_t packet;
  178. packet.time_usec = time_usec;
  179. packet.angle_x = angle_x;
  180. packet.angle_y = angle_y;
  181. packet.distance = distance;
  182. packet.size_x = size_x;
  183. packet.size_y = size_y;
  184. packet.target_num = target_num;
  185. packet.frame = frame;
  186. packet.x = x;
  187. packet.y = y;
  188. packet.z = z;
  189. packet.type = type;
  190. packet.position_valid = position_valid;
  191. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  192. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
  193. #endif
  194. msg->msgid = MAVLINK_MSG_ID_LANDING_TARGET;
  195. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  196. }
  197. /**
  198. * @brief Encode a landing_target struct
  199. *
  200. * @param system_id ID of this system
  201. * @param component_id ID of this component (e.g. 200 for IMU)
  202. * @param msg The MAVLink message to compress the data into
  203. * @param landing_target C-struct to read the message contents from
  204. */
  205. static inline uint16_t mavlink_msg_landing_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target)
  206. {
  207. return mavlink_msg_landing_target_pack(system_id, component_id, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
  208. }
  209. /**
  210. * @brief Encode a landing_target struct on a channel
  211. *
  212. * @param system_id ID of this system
  213. * @param component_id ID of this component (e.g. 200 for IMU)
  214. * @param chan The MAVLink channel this message will be sent over
  215. * @param msg The MAVLink message to compress the data into
  216. * @param landing_target C-struct to read the message contents from
  217. */
  218. static inline uint16_t mavlink_msg_landing_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_landing_target_t* landing_target)
  219. {
  220. return mavlink_msg_landing_target_pack_chan(system_id, component_id, chan, msg, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
  221. }
  222. /**
  223. * @brief Send a landing_target 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 the number.
  227. * @param target_num The ID of the target if multiple targets are present
  228. * @param frame Coordinate frame used for following fields.
  229. * @param angle_x [rad] X-axis angular offset of the target from the center of the image
  230. * @param angle_y [rad] Y-axis angular offset of the target from the center of the image
  231. * @param distance [m] Distance to the target from the vehicle
  232. * @param size_x [rad] Size of target along x-axis
  233. * @param size_y [rad] Size of target along y-axis
  234. * @param x [m] X Position of the landing target in MAV_FRAME
  235. * @param y [m] Y Position of the landing target in MAV_FRAME
  236. * @param z [m] Z Position of the landing target in MAV_FRAME
  237. * @param q Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  238. * @param type Type of landing target
  239. * @param position_valid Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).
  240. */
  241. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  242. static inline void mavlink_msg_landing_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
  243. {
  244. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  245. char buf[MAVLINK_MSG_ID_LANDING_TARGET_LEN];
  246. _mav_put_uint64_t(buf, 0, time_usec);
  247. _mav_put_float(buf, 8, angle_x);
  248. _mav_put_float(buf, 12, angle_y);
  249. _mav_put_float(buf, 16, distance);
  250. _mav_put_float(buf, 20, size_x);
  251. _mav_put_float(buf, 24, size_y);
  252. _mav_put_uint8_t(buf, 28, target_num);
  253. _mav_put_uint8_t(buf, 29, frame);
  254. _mav_put_float(buf, 30, x);
  255. _mav_put_float(buf, 34, y);
  256. _mav_put_float(buf, 38, z);
  257. _mav_put_uint8_t(buf, 58, type);
  258. _mav_put_uint8_t(buf, 59, position_valid);
  259. _mav_put_float_array(buf, 42, q, 4);
  260. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, buf, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  261. #else
  262. mavlink_landing_target_t packet;
  263. packet.time_usec = time_usec;
  264. packet.angle_x = angle_x;
  265. packet.angle_y = angle_y;
  266. packet.distance = distance;
  267. packet.size_x = size_x;
  268. packet.size_y = size_y;
  269. packet.target_num = target_num;
  270. packet.frame = frame;
  271. packet.x = x;
  272. packet.y = y;
  273. packet.z = z;
  274. packet.type = type;
  275. packet.position_valid = position_valid;
  276. mav_array_memcpy(packet.q, q, sizeof(float)*4);
  277. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)&packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  278. #endif
  279. }
  280. /**
  281. * @brief Send a landing_target message
  282. * @param chan MAVLink channel to send the message
  283. * @param struct The MAVLink struct to serialize
  284. */
  285. static inline void mavlink_msg_landing_target_send_struct(mavlink_channel_t chan, const mavlink_landing_target_t* landing_target)
  286. {
  287. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  288. mavlink_msg_landing_target_send(chan, landing_target->time_usec, landing_target->target_num, landing_target->frame, landing_target->angle_x, landing_target->angle_y, landing_target->distance, landing_target->size_x, landing_target->size_y, landing_target->x, landing_target->y, landing_target->z, landing_target->q, landing_target->type, landing_target->position_valid);
  289. #else
  290. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)landing_target, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  291. #endif
  292. }
  293. #if MAVLINK_MSG_ID_LANDING_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  294. /*
  295. This varient of _send() can be used to save stack space by re-using
  296. memory from the receive buffer. The caller provides a
  297. mavlink_message_t which is the size of a full mavlink message. This
  298. is usually the receive buffer for the channel, and allows a reply to an
  299. incoming message with minimum stack space usage.
  300. */
  301. static inline void mavlink_msg_landing_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_num, uint8_t frame, float angle_x, float angle_y, float distance, float size_x, float size_y, float x, float y, float z, const float *q, uint8_t type, uint8_t position_valid)
  302. {
  303. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  304. char *buf = (char *)msgbuf;
  305. _mav_put_uint64_t(buf, 0, time_usec);
  306. _mav_put_float(buf, 8, angle_x);
  307. _mav_put_float(buf, 12, angle_y);
  308. _mav_put_float(buf, 16, distance);
  309. _mav_put_float(buf, 20, size_x);
  310. _mav_put_float(buf, 24, size_y);
  311. _mav_put_uint8_t(buf, 28, target_num);
  312. _mav_put_uint8_t(buf, 29, frame);
  313. _mav_put_float(buf, 30, x);
  314. _mav_put_float(buf, 34, y);
  315. _mav_put_float(buf, 38, z);
  316. _mav_put_uint8_t(buf, 58, type);
  317. _mav_put_uint8_t(buf, 59, position_valid);
  318. _mav_put_float_array(buf, 42, q, 4);
  319. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, buf, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  320. #else
  321. mavlink_landing_target_t *packet = (mavlink_landing_target_t *)msgbuf;
  322. packet->time_usec = time_usec;
  323. packet->angle_x = angle_x;
  324. packet->angle_y = angle_y;
  325. packet->distance = distance;
  326. packet->size_x = size_x;
  327. packet->size_y = size_y;
  328. packet->target_num = target_num;
  329. packet->frame = frame;
  330. packet->x = x;
  331. packet->y = y;
  332. packet->z = z;
  333. packet->type = type;
  334. packet->position_valid = position_valid;
  335. mav_array_memcpy(packet->q, q, sizeof(float)*4);
  336. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LANDING_TARGET, (const char *)packet, MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN, MAVLINK_MSG_ID_LANDING_TARGET_LEN, MAVLINK_MSG_ID_LANDING_TARGET_CRC);
  337. #endif
  338. }
  339. #endif
  340. #endif
  341. // MESSAGE LANDING_TARGET UNPACKING
  342. /**
  343. * @brief Get field time_usec from landing_target message
  344. *
  345. * @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.
  346. */
  347. static inline uint64_t mavlink_msg_landing_target_get_time_usec(const mavlink_message_t* msg)
  348. {
  349. return _MAV_RETURN_uint64_t(msg, 0);
  350. }
  351. /**
  352. * @brief Get field target_num from landing_target message
  353. *
  354. * @return The ID of the target if multiple targets are present
  355. */
  356. static inline uint8_t mavlink_msg_landing_target_get_target_num(const mavlink_message_t* msg)
  357. {
  358. return _MAV_RETURN_uint8_t(msg, 28);
  359. }
  360. /**
  361. * @brief Get field frame from landing_target message
  362. *
  363. * @return Coordinate frame used for following fields.
  364. */
  365. static inline uint8_t mavlink_msg_landing_target_get_frame(const mavlink_message_t* msg)
  366. {
  367. return _MAV_RETURN_uint8_t(msg, 29);
  368. }
  369. /**
  370. * @brief Get field angle_x from landing_target message
  371. *
  372. * @return [rad] X-axis angular offset of the target from the center of the image
  373. */
  374. static inline float mavlink_msg_landing_target_get_angle_x(const mavlink_message_t* msg)
  375. {
  376. return _MAV_RETURN_float(msg, 8);
  377. }
  378. /**
  379. * @brief Get field angle_y from landing_target message
  380. *
  381. * @return [rad] Y-axis angular offset of the target from the center of the image
  382. */
  383. static inline float mavlink_msg_landing_target_get_angle_y(const mavlink_message_t* msg)
  384. {
  385. return _MAV_RETURN_float(msg, 12);
  386. }
  387. /**
  388. * @brief Get field distance from landing_target message
  389. *
  390. * @return [m] Distance to the target from the vehicle
  391. */
  392. static inline float mavlink_msg_landing_target_get_distance(const mavlink_message_t* msg)
  393. {
  394. return _MAV_RETURN_float(msg, 16);
  395. }
  396. /**
  397. * @brief Get field size_x from landing_target message
  398. *
  399. * @return [rad] Size of target along x-axis
  400. */
  401. static inline float mavlink_msg_landing_target_get_size_x(const mavlink_message_t* msg)
  402. {
  403. return _MAV_RETURN_float(msg, 20);
  404. }
  405. /**
  406. * @brief Get field size_y from landing_target message
  407. *
  408. * @return [rad] Size of target along y-axis
  409. */
  410. static inline float mavlink_msg_landing_target_get_size_y(const mavlink_message_t* msg)
  411. {
  412. return _MAV_RETURN_float(msg, 24);
  413. }
  414. /**
  415. * @brief Get field x from landing_target message
  416. *
  417. * @return [m] X Position of the landing target in MAV_FRAME
  418. */
  419. static inline float mavlink_msg_landing_target_get_x(const mavlink_message_t* msg)
  420. {
  421. return _MAV_RETURN_float(msg, 30);
  422. }
  423. /**
  424. * @brief Get field y from landing_target message
  425. *
  426. * @return [m] Y Position of the landing target in MAV_FRAME
  427. */
  428. static inline float mavlink_msg_landing_target_get_y(const mavlink_message_t* msg)
  429. {
  430. return _MAV_RETURN_float(msg, 34);
  431. }
  432. /**
  433. * @brief Get field z from landing_target message
  434. *
  435. * @return [m] Z Position of the landing target in MAV_FRAME
  436. */
  437. static inline float mavlink_msg_landing_target_get_z(const mavlink_message_t* msg)
  438. {
  439. return _MAV_RETURN_float(msg, 38);
  440. }
  441. /**
  442. * @brief Get field q from landing_target message
  443. *
  444. * @return Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
  445. */
  446. static inline uint16_t mavlink_msg_landing_target_get_q(const mavlink_message_t* msg, float *q)
  447. {
  448. return _MAV_RETURN_float_array(msg, q, 4, 42);
  449. }
  450. /**
  451. * @brief Get field type from landing_target message
  452. *
  453. * @return Type of landing target
  454. */
  455. static inline uint8_t mavlink_msg_landing_target_get_type(const mavlink_message_t* msg)
  456. {
  457. return _MAV_RETURN_uint8_t(msg, 58);
  458. }
  459. /**
  460. * @brief Get field position_valid from landing_target message
  461. *
  462. * @return Boolean indicating whether the position fields (x, y, z, q, type) contain valid target position information (valid: 1, invalid: 0). Default is 0 (invalid).
  463. */
  464. static inline uint8_t mavlink_msg_landing_target_get_position_valid(const mavlink_message_t* msg)
  465. {
  466. return _MAV_RETURN_uint8_t(msg, 59);
  467. }
  468. /**
  469. * @brief Decode a landing_target message into a struct
  470. *
  471. * @param msg The message to decode
  472. * @param landing_target C-struct to decode the message contents into
  473. */
  474. static inline void mavlink_msg_landing_target_decode(const mavlink_message_t* msg, mavlink_landing_target_t* landing_target)
  475. {
  476. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  477. landing_target->time_usec = mavlink_msg_landing_target_get_time_usec(msg);
  478. landing_target->angle_x = mavlink_msg_landing_target_get_angle_x(msg);
  479. landing_target->angle_y = mavlink_msg_landing_target_get_angle_y(msg);
  480. landing_target->distance = mavlink_msg_landing_target_get_distance(msg);
  481. landing_target->size_x = mavlink_msg_landing_target_get_size_x(msg);
  482. landing_target->size_y = mavlink_msg_landing_target_get_size_y(msg);
  483. landing_target->target_num = mavlink_msg_landing_target_get_target_num(msg);
  484. landing_target->frame = mavlink_msg_landing_target_get_frame(msg);
  485. landing_target->x = mavlink_msg_landing_target_get_x(msg);
  486. landing_target->y = mavlink_msg_landing_target_get_y(msg);
  487. landing_target->z = mavlink_msg_landing_target_get_z(msg);
  488. mavlink_msg_landing_target_get_q(msg, landing_target->q);
  489. landing_target->type = mavlink_msg_landing_target_get_type(msg);
  490. landing_target->position_valid = mavlink_msg_landing_target_get_position_valid(msg);
  491. #else
  492. uint8_t len = msg->len < MAVLINK_MSG_ID_LANDING_TARGET_LEN? msg->len : MAVLINK_MSG_ID_LANDING_TARGET_LEN;
  493. memset(landing_target, 0, MAVLINK_MSG_ID_LANDING_TARGET_LEN);
  494. memcpy(landing_target, _MAV_PAYLOAD(msg), len);
  495. #endif
  496. }