mavlink_msg_camera_feedback.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. #pragma once
  2. // MESSAGE CAMERA_FEEDBACK PACKING
  3. #define MAVLINK_MSG_ID_CAMERA_FEEDBACK 180
  4. MAVPACKED(
  5. typedef struct __mavlink_camera_feedback_t {
  6. uint64_t time_usec; /*< [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).*/
  7. int32_t lat; /*< [degE7] Latitude.*/
  8. int32_t lng; /*< [degE7] Longitude.*/
  9. float alt_msl; /*< [m] Altitude (MSL).*/
  10. float alt_rel; /*< [m] Altitude (Relative to HOME location).*/
  11. float roll; /*< [deg] Camera Roll angle (earth frame, +-180).*/
  12. float pitch; /*< [deg] Camera Pitch angle (earth frame, +-180).*/
  13. float yaw; /*< [deg] Camera Yaw (earth frame, 0-360, true).*/
  14. float foc_len; /*< [mm] Focal Length.*/
  15. uint16_t img_idx; /*< Image index.*/
  16. uint8_t target_system; /*< System ID.*/
  17. uint8_t cam_idx; /*< Camera ID.*/
  18. uint8_t flags; /*< Feedback flags.*/
  19. uint16_t completed_captures; /*< Completed image captures.*/
  20. }) mavlink_camera_feedback_t;
  21. #define MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN 47
  22. #define MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN 45
  23. #define MAVLINK_MSG_ID_180_LEN 47
  24. #define MAVLINK_MSG_ID_180_MIN_LEN 45
  25. #define MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC 52
  26. #define MAVLINK_MSG_ID_180_CRC 52
  27. #if MAVLINK_COMMAND_24BIT
  28. #define MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK { \
  29. 180, \
  30. "CAMERA_FEEDBACK", \
  31. 14, \
  32. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_feedback_t, time_usec) }, \
  33. { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_camera_feedback_t, target_system) }, \
  34. { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_camera_feedback_t, cam_idx) }, \
  35. { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_camera_feedback_t, img_idx) }, \
  36. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_feedback_t, lat) }, \
  37. { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_feedback_t, lng) }, \
  38. { "alt_msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_feedback_t, alt_msl) }, \
  39. { "alt_rel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_feedback_t, alt_rel) }, \
  40. { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_feedback_t, roll) }, \
  41. { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_camera_feedback_t, pitch) }, \
  42. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_camera_feedback_t, yaw) }, \
  43. { "foc_len", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_feedback_t, foc_len) }, \
  44. { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_camera_feedback_t, flags) }, \
  45. { "completed_captures", NULL, MAVLINK_TYPE_UINT16_T, 0, 45, offsetof(mavlink_camera_feedback_t, completed_captures) }, \
  46. } \
  47. }
  48. #else
  49. #define MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK { \
  50. "CAMERA_FEEDBACK", \
  51. 14, \
  52. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_feedback_t, time_usec) }, \
  53. { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_camera_feedback_t, target_system) }, \
  54. { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_camera_feedback_t, cam_idx) }, \
  55. { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_camera_feedback_t, img_idx) }, \
  56. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_feedback_t, lat) }, \
  57. { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_feedback_t, lng) }, \
  58. { "alt_msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_feedback_t, alt_msl) }, \
  59. { "alt_rel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_feedback_t, alt_rel) }, \
  60. { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_feedback_t, roll) }, \
  61. { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_camera_feedback_t, pitch) }, \
  62. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_camera_feedback_t, yaw) }, \
  63. { "foc_len", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_feedback_t, foc_len) }, \
  64. { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_camera_feedback_t, flags) }, \
  65. { "completed_captures", NULL, MAVLINK_TYPE_UINT16_T, 0, 45, offsetof(mavlink_camera_feedback_t, completed_captures) }, \
  66. } \
  67. }
  68. #endif
  69. /**
  70. * @brief Pack a camera_feedback message
  71. * @param system_id ID of this system
  72. * @param component_id ID of this component (e.g. 200 for IMU)
  73. * @param msg The MAVLink message to compress the data into
  74. *
  75. * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).
  76. * @param target_system System ID.
  77. * @param cam_idx Camera ID.
  78. * @param img_idx Image index.
  79. * @param lat [degE7] Latitude.
  80. * @param lng [degE7] Longitude.
  81. * @param alt_msl [m] Altitude (MSL).
  82. * @param alt_rel [m] Altitude (Relative to HOME location).
  83. * @param roll [deg] Camera Roll angle (earth frame, +-180).
  84. * @param pitch [deg] Camera Pitch angle (earth frame, +-180).
  85. * @param yaw [deg] Camera Yaw (earth frame, 0-360, true).
  86. * @param foc_len [mm] Focal Length.
  87. * @param flags Feedback flags.
  88. * @param completed_captures Completed image captures.
  89. * @return length of the message in bytes (excluding serial stream start sign)
  90. */
  91. static inline uint16_t mavlink_msg_camera_feedback_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  92. uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures)
  93. {
  94. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  95. char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN];
  96. _mav_put_uint64_t(buf, 0, time_usec);
  97. _mav_put_int32_t(buf, 8, lat);
  98. _mav_put_int32_t(buf, 12, lng);
  99. _mav_put_float(buf, 16, alt_msl);
  100. _mav_put_float(buf, 20, alt_rel);
  101. _mav_put_float(buf, 24, roll);
  102. _mav_put_float(buf, 28, pitch);
  103. _mav_put_float(buf, 32, yaw);
  104. _mav_put_float(buf, 36, foc_len);
  105. _mav_put_uint16_t(buf, 40, img_idx);
  106. _mav_put_uint8_t(buf, 42, target_system);
  107. _mav_put_uint8_t(buf, 43, cam_idx);
  108. _mav_put_uint8_t(buf, 44, flags);
  109. _mav_put_uint16_t(buf, 45, completed_captures);
  110. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
  111. #else
  112. mavlink_camera_feedback_t packet;
  113. packet.time_usec = time_usec;
  114. packet.lat = lat;
  115. packet.lng = lng;
  116. packet.alt_msl = alt_msl;
  117. packet.alt_rel = alt_rel;
  118. packet.roll = roll;
  119. packet.pitch = pitch;
  120. packet.yaw = yaw;
  121. packet.foc_len = foc_len;
  122. packet.img_idx = img_idx;
  123. packet.target_system = target_system;
  124. packet.cam_idx = cam_idx;
  125. packet.flags = flags;
  126. packet.completed_captures = completed_captures;
  127. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
  128. #endif
  129. msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK;
  130. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  131. }
  132. /**
  133. * @brief Pack a camera_feedback message on a channel
  134. * @param system_id ID of this system
  135. * @param component_id ID of this component (e.g. 200 for IMU)
  136. * @param chan The MAVLink channel this message will be sent over
  137. * @param msg The MAVLink message to compress the data into
  138. * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).
  139. * @param target_system System ID.
  140. * @param cam_idx Camera ID.
  141. * @param img_idx Image index.
  142. * @param lat [degE7] Latitude.
  143. * @param lng [degE7] Longitude.
  144. * @param alt_msl [m] Altitude (MSL).
  145. * @param alt_rel [m] Altitude (Relative to HOME location).
  146. * @param roll [deg] Camera Roll angle (earth frame, +-180).
  147. * @param pitch [deg] Camera Pitch angle (earth frame, +-180).
  148. * @param yaw [deg] Camera Yaw (earth frame, 0-360, true).
  149. * @param foc_len [mm] Focal Length.
  150. * @param flags Feedback flags.
  151. * @param completed_captures Completed image captures.
  152. * @return length of the message in bytes (excluding serial stream start sign)
  153. */
  154. static inline uint16_t mavlink_msg_camera_feedback_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  155. mavlink_message_t* msg,
  156. uint64_t time_usec,uint8_t target_system,uint8_t cam_idx,uint16_t img_idx,int32_t lat,int32_t lng,float alt_msl,float alt_rel,float roll,float pitch,float yaw,float foc_len,uint8_t flags,uint16_t completed_captures)
  157. {
  158. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  159. char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN];
  160. _mav_put_uint64_t(buf, 0, time_usec);
  161. _mav_put_int32_t(buf, 8, lat);
  162. _mav_put_int32_t(buf, 12, lng);
  163. _mav_put_float(buf, 16, alt_msl);
  164. _mav_put_float(buf, 20, alt_rel);
  165. _mav_put_float(buf, 24, roll);
  166. _mav_put_float(buf, 28, pitch);
  167. _mav_put_float(buf, 32, yaw);
  168. _mav_put_float(buf, 36, foc_len);
  169. _mav_put_uint16_t(buf, 40, img_idx);
  170. _mav_put_uint8_t(buf, 42, target_system);
  171. _mav_put_uint8_t(buf, 43, cam_idx);
  172. _mav_put_uint8_t(buf, 44, flags);
  173. _mav_put_uint16_t(buf, 45, completed_captures);
  174. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
  175. #else
  176. mavlink_camera_feedback_t packet;
  177. packet.time_usec = time_usec;
  178. packet.lat = lat;
  179. packet.lng = lng;
  180. packet.alt_msl = alt_msl;
  181. packet.alt_rel = alt_rel;
  182. packet.roll = roll;
  183. packet.pitch = pitch;
  184. packet.yaw = yaw;
  185. packet.foc_len = foc_len;
  186. packet.img_idx = img_idx;
  187. packet.target_system = target_system;
  188. packet.cam_idx = cam_idx;
  189. packet.flags = flags;
  190. packet.completed_captures = completed_captures;
  191. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
  192. #endif
  193. msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK;
  194. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  195. }
  196. /**
  197. * @brief Encode a camera_feedback struct
  198. *
  199. * @param system_id ID of this system
  200. * @param component_id ID of this component (e.g. 200 for IMU)
  201. * @param msg The MAVLink message to compress the data into
  202. * @param camera_feedback C-struct to read the message contents from
  203. */
  204. static inline uint16_t mavlink_msg_camera_feedback_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback)
  205. {
  206. return mavlink_msg_camera_feedback_pack(system_id, component_id, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures);
  207. }
  208. /**
  209. * @brief Encode a camera_feedback struct on a channel
  210. *
  211. * @param system_id ID of this system
  212. * @param component_id ID of this component (e.g. 200 for IMU)
  213. * @param chan The MAVLink channel this message will be sent over
  214. * @param msg The MAVLink message to compress the data into
  215. * @param camera_feedback C-struct to read the message contents from
  216. */
  217. static inline uint16_t mavlink_msg_camera_feedback_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback)
  218. {
  219. return mavlink_msg_camera_feedback_pack_chan(system_id, component_id, chan, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures);
  220. }
  221. /**
  222. * @brief Send a camera_feedback message
  223. * @param chan MAVLink channel to send the message
  224. *
  225. * @param time_usec [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).
  226. * @param target_system System ID.
  227. * @param cam_idx Camera ID.
  228. * @param img_idx Image index.
  229. * @param lat [degE7] Latitude.
  230. * @param lng [degE7] Longitude.
  231. * @param alt_msl [m] Altitude (MSL).
  232. * @param alt_rel [m] Altitude (Relative to HOME location).
  233. * @param roll [deg] Camera Roll angle (earth frame, +-180).
  234. * @param pitch [deg] Camera Pitch angle (earth frame, +-180).
  235. * @param yaw [deg] Camera Yaw (earth frame, 0-360, true).
  236. * @param foc_len [mm] Focal Length.
  237. * @param flags Feedback flags.
  238. * @param completed_captures Completed image captures.
  239. */
  240. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  241. static inline void mavlink_msg_camera_feedback_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures)
  242. {
  243. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  244. char buf[MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN];
  245. _mav_put_uint64_t(buf, 0, time_usec);
  246. _mav_put_int32_t(buf, 8, lat);
  247. _mav_put_int32_t(buf, 12, lng);
  248. _mav_put_float(buf, 16, alt_msl);
  249. _mav_put_float(buf, 20, alt_rel);
  250. _mav_put_float(buf, 24, roll);
  251. _mav_put_float(buf, 28, pitch);
  252. _mav_put_float(buf, 32, yaw);
  253. _mav_put_float(buf, 36, foc_len);
  254. _mav_put_uint16_t(buf, 40, img_idx);
  255. _mav_put_uint8_t(buf, 42, target_system);
  256. _mav_put_uint8_t(buf, 43, cam_idx);
  257. _mav_put_uint8_t(buf, 44, flags);
  258. _mav_put_uint16_t(buf, 45, completed_captures);
  259. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  260. #else
  261. mavlink_camera_feedback_t packet;
  262. packet.time_usec = time_usec;
  263. packet.lat = lat;
  264. packet.lng = lng;
  265. packet.alt_msl = alt_msl;
  266. packet.alt_rel = alt_rel;
  267. packet.roll = roll;
  268. packet.pitch = pitch;
  269. packet.yaw = yaw;
  270. packet.foc_len = foc_len;
  271. packet.img_idx = img_idx;
  272. packet.target_system = target_system;
  273. packet.cam_idx = cam_idx;
  274. packet.flags = flags;
  275. packet.completed_captures = completed_captures;
  276. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  277. #endif
  278. }
  279. /**
  280. * @brief Send a camera_feedback message
  281. * @param chan MAVLink channel to send the message
  282. * @param struct The MAVLink struct to serialize
  283. */
  284. static inline void mavlink_msg_camera_feedback_send_struct(mavlink_channel_t chan, const mavlink_camera_feedback_t* camera_feedback)
  285. {
  286. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  287. mavlink_msg_camera_feedback_send(chan, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags, camera_feedback->completed_captures);
  288. #else
  289. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)camera_feedback, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  290. #endif
  291. }
  292. #if MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  293. /*
  294. This varient of _send() can be used to save stack space by re-using
  295. memory from the receive buffer. The caller provides a
  296. mavlink_message_t which is the size of a full mavlink message. This
  297. is usually the receive buffer for the channel, and allows a reply to an
  298. incoming message with minimum stack space usage.
  299. */
  300. static inline void mavlink_msg_camera_feedback_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags, uint16_t completed_captures)
  301. {
  302. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  303. char *buf = (char *)msgbuf;
  304. _mav_put_uint64_t(buf, 0, time_usec);
  305. _mav_put_int32_t(buf, 8, lat);
  306. _mav_put_int32_t(buf, 12, lng);
  307. _mav_put_float(buf, 16, alt_msl);
  308. _mav_put_float(buf, 20, alt_rel);
  309. _mav_put_float(buf, 24, roll);
  310. _mav_put_float(buf, 28, pitch);
  311. _mav_put_float(buf, 32, yaw);
  312. _mav_put_float(buf, 36, foc_len);
  313. _mav_put_uint16_t(buf, 40, img_idx);
  314. _mav_put_uint8_t(buf, 42, target_system);
  315. _mav_put_uint8_t(buf, 43, cam_idx);
  316. _mav_put_uint8_t(buf, 44, flags);
  317. _mav_put_uint16_t(buf, 45, completed_captures);
  318. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  319. #else
  320. mavlink_camera_feedback_t *packet = (mavlink_camera_feedback_t *)msgbuf;
  321. packet->time_usec = time_usec;
  322. packet->lat = lat;
  323. packet->lng = lng;
  324. packet->alt_msl = alt_msl;
  325. packet->alt_rel = alt_rel;
  326. packet->roll = roll;
  327. packet->pitch = pitch;
  328. packet->yaw = yaw;
  329. packet->foc_len = foc_len;
  330. packet->img_idx = img_idx;
  331. packet->target_system = target_system;
  332. packet->cam_idx = cam_idx;
  333. packet->flags = flags;
  334. packet->completed_captures = completed_captures;
  335. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_MIN_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
  336. #endif
  337. }
  338. #endif
  339. #endif
  340. // MESSAGE CAMERA_FEEDBACK UNPACKING
  341. /**
  342. * @brief Get field time_usec from camera_feedback message
  343. *
  344. * @return [us] Image timestamp (since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB).
  345. */
  346. static inline uint64_t mavlink_msg_camera_feedback_get_time_usec(const mavlink_message_t* msg)
  347. {
  348. return _MAV_RETURN_uint64_t(msg, 0);
  349. }
  350. /**
  351. * @brief Get field target_system from camera_feedback message
  352. *
  353. * @return System ID.
  354. */
  355. static inline uint8_t mavlink_msg_camera_feedback_get_target_system(const mavlink_message_t* msg)
  356. {
  357. return _MAV_RETURN_uint8_t(msg, 42);
  358. }
  359. /**
  360. * @brief Get field cam_idx from camera_feedback message
  361. *
  362. * @return Camera ID.
  363. */
  364. static inline uint8_t mavlink_msg_camera_feedback_get_cam_idx(const mavlink_message_t* msg)
  365. {
  366. return _MAV_RETURN_uint8_t(msg, 43);
  367. }
  368. /**
  369. * @brief Get field img_idx from camera_feedback message
  370. *
  371. * @return Image index.
  372. */
  373. static inline uint16_t mavlink_msg_camera_feedback_get_img_idx(const mavlink_message_t* msg)
  374. {
  375. return _MAV_RETURN_uint16_t(msg, 40);
  376. }
  377. /**
  378. * @brief Get field lat from camera_feedback message
  379. *
  380. * @return [degE7] Latitude.
  381. */
  382. static inline int32_t mavlink_msg_camera_feedback_get_lat(const mavlink_message_t* msg)
  383. {
  384. return _MAV_RETURN_int32_t(msg, 8);
  385. }
  386. /**
  387. * @brief Get field lng from camera_feedback message
  388. *
  389. * @return [degE7] Longitude.
  390. */
  391. static inline int32_t mavlink_msg_camera_feedback_get_lng(const mavlink_message_t* msg)
  392. {
  393. return _MAV_RETURN_int32_t(msg, 12);
  394. }
  395. /**
  396. * @brief Get field alt_msl from camera_feedback message
  397. *
  398. * @return [m] Altitude (MSL).
  399. */
  400. static inline float mavlink_msg_camera_feedback_get_alt_msl(const mavlink_message_t* msg)
  401. {
  402. return _MAV_RETURN_float(msg, 16);
  403. }
  404. /**
  405. * @brief Get field alt_rel from camera_feedback message
  406. *
  407. * @return [m] Altitude (Relative to HOME location).
  408. */
  409. static inline float mavlink_msg_camera_feedback_get_alt_rel(const mavlink_message_t* msg)
  410. {
  411. return _MAV_RETURN_float(msg, 20);
  412. }
  413. /**
  414. * @brief Get field roll from camera_feedback message
  415. *
  416. * @return [deg] Camera Roll angle (earth frame, +-180).
  417. */
  418. static inline float mavlink_msg_camera_feedback_get_roll(const mavlink_message_t* msg)
  419. {
  420. return _MAV_RETURN_float(msg, 24);
  421. }
  422. /**
  423. * @brief Get field pitch from camera_feedback message
  424. *
  425. * @return [deg] Camera Pitch angle (earth frame, +-180).
  426. */
  427. static inline float mavlink_msg_camera_feedback_get_pitch(const mavlink_message_t* msg)
  428. {
  429. return _MAV_RETURN_float(msg, 28);
  430. }
  431. /**
  432. * @brief Get field yaw from camera_feedback message
  433. *
  434. * @return [deg] Camera Yaw (earth frame, 0-360, true).
  435. */
  436. static inline float mavlink_msg_camera_feedback_get_yaw(const mavlink_message_t* msg)
  437. {
  438. return _MAV_RETURN_float(msg, 32);
  439. }
  440. /**
  441. * @brief Get field foc_len from camera_feedback message
  442. *
  443. * @return [mm] Focal Length.
  444. */
  445. static inline float mavlink_msg_camera_feedback_get_foc_len(const mavlink_message_t* msg)
  446. {
  447. return _MAV_RETURN_float(msg, 36);
  448. }
  449. /**
  450. * @brief Get field flags from camera_feedback message
  451. *
  452. * @return Feedback flags.
  453. */
  454. static inline uint8_t mavlink_msg_camera_feedback_get_flags(const mavlink_message_t* msg)
  455. {
  456. return _MAV_RETURN_uint8_t(msg, 44);
  457. }
  458. /**
  459. * @brief Get field completed_captures from camera_feedback message
  460. *
  461. * @return Completed image captures.
  462. */
  463. static inline uint16_t mavlink_msg_camera_feedback_get_completed_captures(const mavlink_message_t* msg)
  464. {
  465. return _MAV_RETURN_uint16_t(msg, 45);
  466. }
  467. /**
  468. * @brief Decode a camera_feedback message into a struct
  469. *
  470. * @param msg The message to decode
  471. * @param camera_feedback C-struct to decode the message contents into
  472. */
  473. static inline void mavlink_msg_camera_feedback_decode(const mavlink_message_t* msg, mavlink_camera_feedback_t* camera_feedback)
  474. {
  475. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  476. camera_feedback->time_usec = mavlink_msg_camera_feedback_get_time_usec(msg);
  477. camera_feedback->lat = mavlink_msg_camera_feedback_get_lat(msg);
  478. camera_feedback->lng = mavlink_msg_camera_feedback_get_lng(msg);
  479. camera_feedback->alt_msl = mavlink_msg_camera_feedback_get_alt_msl(msg);
  480. camera_feedback->alt_rel = mavlink_msg_camera_feedback_get_alt_rel(msg);
  481. camera_feedback->roll = mavlink_msg_camera_feedback_get_roll(msg);
  482. camera_feedback->pitch = mavlink_msg_camera_feedback_get_pitch(msg);
  483. camera_feedback->yaw = mavlink_msg_camera_feedback_get_yaw(msg);
  484. camera_feedback->foc_len = mavlink_msg_camera_feedback_get_foc_len(msg);
  485. camera_feedback->img_idx = mavlink_msg_camera_feedback_get_img_idx(msg);
  486. camera_feedback->target_system = mavlink_msg_camera_feedback_get_target_system(msg);
  487. camera_feedback->cam_idx = mavlink_msg_camera_feedback_get_cam_idx(msg);
  488. camera_feedback->flags = mavlink_msg_camera_feedback_get_flags(msg);
  489. camera_feedback->completed_captures = mavlink_msg_camera_feedback_get_completed_captures(msg);
  490. #else
  491. uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN;
  492. memset(camera_feedback, 0, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
  493. memcpy(camera_feedback, _MAV_PAYLOAD(msg), len);
  494. #endif
  495. }