mavlink_msg_position_target_global_int.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. #pragma once
  2. // MESSAGE POSITION_TARGET_GLOBAL_INT PACKING
  3. #define MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT 87
  4. typedef struct __mavlink_position_target_global_int_t {
  5. uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.*/
  6. int32_t lat_int; /*< [degE7] X Position in WGS84 frame*/
  7. int32_t lon_int; /*< [degE7] Y Position in WGS84 frame*/
  8. float alt; /*< [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)*/
  9. float vx; /*< [m/s] X velocity in NED frame*/
  10. float vy; /*< [m/s] Y velocity in NED frame*/
  11. float vz; /*< [m/s] Z velocity in NED frame*/
  12. float afx; /*< [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
  13. float afy; /*< [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
  14. float afz; /*< [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
  15. float yaw; /*< [rad] yaw setpoint*/
  16. float yaw_rate; /*< [rad/s] yaw rate setpoint*/
  17. uint16_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/
  18. uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11*/
  19. } mavlink_position_target_global_int_t;
  20. #define MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN 51
  21. #define MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN 51
  22. #define MAVLINK_MSG_ID_87_LEN 51
  23. #define MAVLINK_MSG_ID_87_MIN_LEN 51
  24. #define MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC 150
  25. #define MAVLINK_MSG_ID_87_CRC 150
  26. #if MAVLINK_COMMAND_24BIT
  27. #define MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT { \
  28. 87, \
  29. "POSITION_TARGET_GLOBAL_INT", \
  30. 14, \
  31. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_position_target_global_int_t, time_boot_ms) }, \
  32. { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_position_target_global_int_t, coordinate_frame) }, \
  33. { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_position_target_global_int_t, type_mask) }, \
  34. { "lat_int", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_position_target_global_int_t, lat_int) }, \
  35. { "lon_int", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_position_target_global_int_t, lon_int) }, \
  36. { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_position_target_global_int_t, alt) }, \
  37. { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_position_target_global_int_t, vx) }, \
  38. { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_position_target_global_int_t, vy) }, \
  39. { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_position_target_global_int_t, vz) }, \
  40. { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_position_target_global_int_t, afx) }, \
  41. { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_position_target_global_int_t, afy) }, \
  42. { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_position_target_global_int_t, afz) }, \
  43. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_position_target_global_int_t, yaw) }, \
  44. { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_position_target_global_int_t, yaw_rate) }, \
  45. } \
  46. }
  47. #else
  48. #define MAVLINK_MESSAGE_INFO_POSITION_TARGET_GLOBAL_INT { \
  49. "POSITION_TARGET_GLOBAL_INT", \
  50. 14, \
  51. { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_position_target_global_int_t, time_boot_ms) }, \
  52. { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_position_target_global_int_t, coordinate_frame) }, \
  53. { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_position_target_global_int_t, type_mask) }, \
  54. { "lat_int", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_position_target_global_int_t, lat_int) }, \
  55. { "lon_int", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_position_target_global_int_t, lon_int) }, \
  56. { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_position_target_global_int_t, alt) }, \
  57. { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_position_target_global_int_t, vx) }, \
  58. { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_position_target_global_int_t, vy) }, \
  59. { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_position_target_global_int_t, vz) }, \
  60. { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_position_target_global_int_t, afx) }, \
  61. { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_position_target_global_int_t, afy) }, \
  62. { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_position_target_global_int_t, afz) }, \
  63. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_position_target_global_int_t, yaw) }, \
  64. { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_position_target_global_int_t, yaw_rate) }, \
  65. } \
  66. }
  67. #endif
  68. /**
  69. * @brief Pack a position_target_global_int message
  70. * @param system_id ID of this system
  71. * @param component_id ID of this component (e.g. 200 for IMU)
  72. * @param msg The MAVLink message to compress the data into
  73. *
  74. * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.
  75. * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11
  76. * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
  77. * @param lat_int [degE7] X Position in WGS84 frame
  78. * @param lon_int [degE7] Y Position in WGS84 frame
  79. * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)
  80. * @param vx [m/s] X velocity in NED frame
  81. * @param vy [m/s] Y velocity in NED frame
  82. * @param vz [m/s] Z velocity in NED frame
  83. * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  84. * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  85. * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  86. * @param yaw [rad] yaw setpoint
  87. * @param yaw_rate [rad/s] yaw rate setpoint
  88. * @return length of the message in bytes (excluding serial stream start sign)
  89. */
  90. static inline uint16_t mavlink_msg_position_target_global_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  91. uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
  92. {
  93. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  94. char buf[MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN];
  95. _mav_put_uint32_t(buf, 0, time_boot_ms);
  96. _mav_put_int32_t(buf, 4, lat_int);
  97. _mav_put_int32_t(buf, 8, lon_int);
  98. _mav_put_float(buf, 12, alt);
  99. _mav_put_float(buf, 16, vx);
  100. _mav_put_float(buf, 20, vy);
  101. _mav_put_float(buf, 24, vz);
  102. _mav_put_float(buf, 28, afx);
  103. _mav_put_float(buf, 32, afy);
  104. _mav_put_float(buf, 36, afz);
  105. _mav_put_float(buf, 40, yaw);
  106. _mav_put_float(buf, 44, yaw_rate);
  107. _mav_put_uint16_t(buf, 48, type_mask);
  108. _mav_put_uint8_t(buf, 50, coordinate_frame);
  109. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  110. #else
  111. mavlink_position_target_global_int_t packet;
  112. packet.time_boot_ms = time_boot_ms;
  113. packet.lat_int = lat_int;
  114. packet.lon_int = lon_int;
  115. packet.alt = alt;
  116. packet.vx = vx;
  117. packet.vy = vy;
  118. packet.vz = vz;
  119. packet.afx = afx;
  120. packet.afy = afy;
  121. packet.afz = afz;
  122. packet.yaw = yaw;
  123. packet.yaw_rate = yaw_rate;
  124. packet.type_mask = type_mask;
  125. packet.coordinate_frame = coordinate_frame;
  126. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  127. #endif
  128. msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT;
  129. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  130. }
  131. /**
  132. * @brief Pack a position_target_global_int message
  133. * @param system_id ID of this system
  134. * @param component_id ID of this component (e.g. 200 for IMU)
  135. * @param status MAVLink status structure
  136. * @param msg The MAVLink message to compress the data into
  137. *
  138. * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.
  139. * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11
  140. * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
  141. * @param lat_int [degE7] X Position in WGS84 frame
  142. * @param lon_int [degE7] Y Position in WGS84 frame
  143. * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)
  144. * @param vx [m/s] X velocity in NED frame
  145. * @param vy [m/s] Y velocity in NED frame
  146. * @param vz [m/s] Z velocity in NED frame
  147. * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  148. * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  149. * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  150. * @param yaw [rad] yaw setpoint
  151. * @param yaw_rate [rad/s] yaw rate setpoint
  152. * @return length of the message in bytes (excluding serial stream start sign)
  153. */
  154. static inline uint16_t mavlink_msg_position_target_global_int_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  155. uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
  156. {
  157. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  158. char buf[MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN];
  159. _mav_put_uint32_t(buf, 0, time_boot_ms);
  160. _mav_put_int32_t(buf, 4, lat_int);
  161. _mav_put_int32_t(buf, 8, lon_int);
  162. _mav_put_float(buf, 12, alt);
  163. _mav_put_float(buf, 16, vx);
  164. _mav_put_float(buf, 20, vy);
  165. _mav_put_float(buf, 24, vz);
  166. _mav_put_float(buf, 28, afx);
  167. _mav_put_float(buf, 32, afy);
  168. _mav_put_float(buf, 36, afz);
  169. _mav_put_float(buf, 40, yaw);
  170. _mav_put_float(buf, 44, yaw_rate);
  171. _mav_put_uint16_t(buf, 48, type_mask);
  172. _mav_put_uint8_t(buf, 50, coordinate_frame);
  173. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  174. #else
  175. mavlink_position_target_global_int_t packet;
  176. packet.time_boot_ms = time_boot_ms;
  177. packet.lat_int = lat_int;
  178. packet.lon_int = lon_int;
  179. packet.alt = alt;
  180. packet.vx = vx;
  181. packet.vy = vy;
  182. packet.vz = vz;
  183. packet.afx = afx;
  184. packet.afy = afy;
  185. packet.afz = afz;
  186. packet.yaw = yaw;
  187. packet.yaw_rate = yaw_rate;
  188. packet.type_mask = type_mask;
  189. packet.coordinate_frame = coordinate_frame;
  190. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  191. #endif
  192. msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT;
  193. #if MAVLINK_CRC_EXTRA
  194. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  195. #else
  196. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  197. #endif
  198. }
  199. /**
  200. * @brief Pack a position_target_global_int message on a channel
  201. * @param system_id ID of this system
  202. * @param component_id ID of this component (e.g. 200 for IMU)
  203. * @param chan The MAVLink channel this message will be sent over
  204. * @param msg The MAVLink message to compress the data into
  205. * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.
  206. * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11
  207. * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
  208. * @param lat_int [degE7] X Position in WGS84 frame
  209. * @param lon_int [degE7] Y Position in WGS84 frame
  210. * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)
  211. * @param vx [m/s] X velocity in NED frame
  212. * @param vy [m/s] Y velocity in NED frame
  213. * @param vz [m/s] Z velocity in NED frame
  214. * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  215. * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  216. * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  217. * @param yaw [rad] yaw setpoint
  218. * @param yaw_rate [rad/s] yaw rate setpoint
  219. * @return length of the message in bytes (excluding serial stream start sign)
  220. */
  221. static inline uint16_t mavlink_msg_position_target_global_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  222. mavlink_message_t* msg,
  223. uint32_t time_boot_ms,uint8_t coordinate_frame,uint16_t type_mask,int32_t lat_int,int32_t lon_int,float alt,float vx,float vy,float vz,float afx,float afy,float afz,float yaw,float yaw_rate)
  224. {
  225. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  226. char buf[MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN];
  227. _mav_put_uint32_t(buf, 0, time_boot_ms);
  228. _mav_put_int32_t(buf, 4, lat_int);
  229. _mav_put_int32_t(buf, 8, lon_int);
  230. _mav_put_float(buf, 12, alt);
  231. _mav_put_float(buf, 16, vx);
  232. _mav_put_float(buf, 20, vy);
  233. _mav_put_float(buf, 24, vz);
  234. _mav_put_float(buf, 28, afx);
  235. _mav_put_float(buf, 32, afy);
  236. _mav_put_float(buf, 36, afz);
  237. _mav_put_float(buf, 40, yaw);
  238. _mav_put_float(buf, 44, yaw_rate);
  239. _mav_put_uint16_t(buf, 48, type_mask);
  240. _mav_put_uint8_t(buf, 50, coordinate_frame);
  241. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  242. #else
  243. mavlink_position_target_global_int_t packet;
  244. packet.time_boot_ms = time_boot_ms;
  245. packet.lat_int = lat_int;
  246. packet.lon_int = lon_int;
  247. packet.alt = alt;
  248. packet.vx = vx;
  249. packet.vy = vy;
  250. packet.vz = vz;
  251. packet.afx = afx;
  252. packet.afy = afy;
  253. packet.afz = afz;
  254. packet.yaw = yaw;
  255. packet.yaw_rate = yaw_rate;
  256. packet.type_mask = type_mask;
  257. packet.coordinate_frame = coordinate_frame;
  258. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  259. #endif
  260. msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT;
  261. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  262. }
  263. /**
  264. * @brief Encode a position_target_global_int struct
  265. *
  266. * @param system_id ID of this system
  267. * @param component_id ID of this component (e.g. 200 for IMU)
  268. * @param msg The MAVLink message to compress the data into
  269. * @param position_target_global_int C-struct to read the message contents from
  270. */
  271. static inline uint16_t mavlink_msg_position_target_global_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_position_target_global_int_t* position_target_global_int)
  272. {
  273. return mavlink_msg_position_target_global_int_pack(system_id, component_id, msg, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate);
  274. }
  275. /**
  276. * @brief Encode a position_target_global_int struct on a channel
  277. *
  278. * @param system_id ID of this system
  279. * @param component_id ID of this component (e.g. 200 for IMU)
  280. * @param chan The MAVLink channel this message will be sent over
  281. * @param msg The MAVLink message to compress the data into
  282. * @param position_target_global_int C-struct to read the message contents from
  283. */
  284. static inline uint16_t mavlink_msg_position_target_global_int_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_position_target_global_int_t* position_target_global_int)
  285. {
  286. return mavlink_msg_position_target_global_int_pack_chan(system_id, component_id, chan, msg, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate);
  287. }
  288. /**
  289. * @brief Encode a position_target_global_int struct with provided status structure
  290. *
  291. * @param system_id ID of this system
  292. * @param component_id ID of this component (e.g. 200 for IMU)
  293. * @param status MAVLink status structure
  294. * @param msg The MAVLink message to compress the data into
  295. * @param position_target_global_int C-struct to read the message contents from
  296. */
  297. static inline uint16_t mavlink_msg_position_target_global_int_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_position_target_global_int_t* position_target_global_int)
  298. {
  299. return mavlink_msg_position_target_global_int_pack_status(system_id, component_id, _status, msg, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate);
  300. }
  301. /**
  302. * @brief Send a position_target_global_int message
  303. * @param chan MAVLink channel to send the message
  304. *
  305. * @param time_boot_ms [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.
  306. * @param coordinate_frame Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11
  307. * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
  308. * @param lat_int [degE7] X Position in WGS84 frame
  309. * @param lon_int [degE7] Y Position in WGS84 frame
  310. * @param alt [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)
  311. * @param vx [m/s] X velocity in NED frame
  312. * @param vy [m/s] Y velocity in NED frame
  313. * @param vz [m/s] Z velocity in NED frame
  314. * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  315. * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  316. * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  317. * @param yaw [rad] yaw setpoint
  318. * @param yaw_rate [rad/s] yaw rate setpoint
  319. */
  320. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  321. static inline void mavlink_msg_position_target_global_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
  322. {
  323. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  324. char buf[MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN];
  325. _mav_put_uint32_t(buf, 0, time_boot_ms);
  326. _mav_put_int32_t(buf, 4, lat_int);
  327. _mav_put_int32_t(buf, 8, lon_int);
  328. _mav_put_float(buf, 12, alt);
  329. _mav_put_float(buf, 16, vx);
  330. _mav_put_float(buf, 20, vy);
  331. _mav_put_float(buf, 24, vz);
  332. _mav_put_float(buf, 28, afx);
  333. _mav_put_float(buf, 32, afy);
  334. _mav_put_float(buf, 36, afz);
  335. _mav_put_float(buf, 40, yaw);
  336. _mav_put_float(buf, 44, yaw_rate);
  337. _mav_put_uint16_t(buf, 48, type_mask);
  338. _mav_put_uint8_t(buf, 50, coordinate_frame);
  339. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT, buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  340. #else
  341. mavlink_position_target_global_int_t packet;
  342. packet.time_boot_ms = time_boot_ms;
  343. packet.lat_int = lat_int;
  344. packet.lon_int = lon_int;
  345. packet.alt = alt;
  346. packet.vx = vx;
  347. packet.vy = vy;
  348. packet.vz = vz;
  349. packet.afx = afx;
  350. packet.afy = afy;
  351. packet.afz = afz;
  352. packet.yaw = yaw;
  353. packet.yaw_rate = yaw_rate;
  354. packet.type_mask = type_mask;
  355. packet.coordinate_frame = coordinate_frame;
  356. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT, (const char *)&packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  357. #endif
  358. }
  359. /**
  360. * @brief Send a position_target_global_int message
  361. * @param chan MAVLink channel to send the message
  362. * @param struct The MAVLink struct to serialize
  363. */
  364. static inline void mavlink_msg_position_target_global_int_send_struct(mavlink_channel_t chan, const mavlink_position_target_global_int_t* position_target_global_int)
  365. {
  366. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  367. mavlink_msg_position_target_global_int_send(chan, position_target_global_int->time_boot_ms, position_target_global_int->coordinate_frame, position_target_global_int->type_mask, position_target_global_int->lat_int, position_target_global_int->lon_int, position_target_global_int->alt, position_target_global_int->vx, position_target_global_int->vy, position_target_global_int->vz, position_target_global_int->afx, position_target_global_int->afy, position_target_global_int->afz, position_target_global_int->yaw, position_target_global_int->yaw_rate);
  368. #else
  369. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT, (const char *)position_target_global_int, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  370. #endif
  371. }
  372. #if MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  373. /*
  374. This variant of _send() can be used to save stack space by re-using
  375. memory from the receive buffer. The caller provides a
  376. mavlink_message_t which is the size of a full mavlink message. This
  377. is usually the receive buffer for the channel, and allows a reply to an
  378. incoming message with minimum stack space usage.
  379. */
  380. static inline void mavlink_msg_position_target_global_int_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, int32_t lat_int, int32_t lon_int, float alt, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
  381. {
  382. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  383. char *buf = (char *)msgbuf;
  384. _mav_put_uint32_t(buf, 0, time_boot_ms);
  385. _mav_put_int32_t(buf, 4, lat_int);
  386. _mav_put_int32_t(buf, 8, lon_int);
  387. _mav_put_float(buf, 12, alt);
  388. _mav_put_float(buf, 16, vx);
  389. _mav_put_float(buf, 20, vy);
  390. _mav_put_float(buf, 24, vz);
  391. _mav_put_float(buf, 28, afx);
  392. _mav_put_float(buf, 32, afy);
  393. _mav_put_float(buf, 36, afz);
  394. _mav_put_float(buf, 40, yaw);
  395. _mav_put_float(buf, 44, yaw_rate);
  396. _mav_put_uint16_t(buf, 48, type_mask);
  397. _mav_put_uint8_t(buf, 50, coordinate_frame);
  398. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT, buf, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  399. #else
  400. mavlink_position_target_global_int_t *packet = (mavlink_position_target_global_int_t *)msgbuf;
  401. packet->time_boot_ms = time_boot_ms;
  402. packet->lat_int = lat_int;
  403. packet->lon_int = lon_int;
  404. packet->alt = alt;
  405. packet->vx = vx;
  406. packet->vy = vy;
  407. packet->vz = vz;
  408. packet->afx = afx;
  409. packet->afy = afy;
  410. packet->afz = afz;
  411. packet->yaw = yaw;
  412. packet->yaw_rate = yaw_rate;
  413. packet->type_mask = type_mask;
  414. packet->coordinate_frame = coordinate_frame;
  415. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT, (const char *)packet, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_CRC);
  416. #endif
  417. }
  418. #endif
  419. #endif
  420. // MESSAGE POSITION_TARGET_GLOBAL_INT UNPACKING
  421. /**
  422. * @brief Get field time_boot_ms from position_target_global_int message
  423. *
  424. * @return [ms] Timestamp (time since system boot). The rationale for the timestamp in the setpoint is to allow the system to compensate for the transport delay of the setpoint. This allows the system to compensate processing latency.
  425. */
  426. static inline uint32_t mavlink_msg_position_target_global_int_get_time_boot_ms(const mavlink_message_t* msg)
  427. {
  428. return _MAV_RETURN_uint32_t(msg, 0);
  429. }
  430. /**
  431. * @brief Get field coordinate_frame from position_target_global_int message
  432. *
  433. * @return Valid options are: MAV_FRAME_GLOBAL_INT = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT = 11
  434. */
  435. static inline uint8_t mavlink_msg_position_target_global_int_get_coordinate_frame(const mavlink_message_t* msg)
  436. {
  437. return _MAV_RETURN_uint8_t(msg, 50);
  438. }
  439. /**
  440. * @brief Get field type_mask from position_target_global_int message
  441. *
  442. * @return Bitmap to indicate which dimensions should be ignored by the vehicle.
  443. */
  444. static inline uint16_t mavlink_msg_position_target_global_int_get_type_mask(const mavlink_message_t* msg)
  445. {
  446. return _MAV_RETURN_uint16_t(msg, 48);
  447. }
  448. /**
  449. * @brief Get field lat_int from position_target_global_int message
  450. *
  451. * @return [degE7] X Position in WGS84 frame
  452. */
  453. static inline int32_t mavlink_msg_position_target_global_int_get_lat_int(const mavlink_message_t* msg)
  454. {
  455. return _MAV_RETURN_int32_t(msg, 4);
  456. }
  457. /**
  458. * @brief Get field lon_int from position_target_global_int message
  459. *
  460. * @return [degE7] Y Position in WGS84 frame
  461. */
  462. static inline int32_t mavlink_msg_position_target_global_int_get_lon_int(const mavlink_message_t* msg)
  463. {
  464. return _MAV_RETURN_int32_t(msg, 8);
  465. }
  466. /**
  467. * @brief Get field alt from position_target_global_int message
  468. *
  469. * @return [m] Altitude (MSL, AGL or relative to home altitude, depending on frame)
  470. */
  471. static inline float mavlink_msg_position_target_global_int_get_alt(const mavlink_message_t* msg)
  472. {
  473. return _MAV_RETURN_float(msg, 12);
  474. }
  475. /**
  476. * @brief Get field vx from position_target_global_int message
  477. *
  478. * @return [m/s] X velocity in NED frame
  479. */
  480. static inline float mavlink_msg_position_target_global_int_get_vx(const mavlink_message_t* msg)
  481. {
  482. return _MAV_RETURN_float(msg, 16);
  483. }
  484. /**
  485. * @brief Get field vy from position_target_global_int message
  486. *
  487. * @return [m/s] Y velocity in NED frame
  488. */
  489. static inline float mavlink_msg_position_target_global_int_get_vy(const mavlink_message_t* msg)
  490. {
  491. return _MAV_RETURN_float(msg, 20);
  492. }
  493. /**
  494. * @brief Get field vz from position_target_global_int message
  495. *
  496. * @return [m/s] Z velocity in NED frame
  497. */
  498. static inline float mavlink_msg_position_target_global_int_get_vz(const mavlink_message_t* msg)
  499. {
  500. return _MAV_RETURN_float(msg, 24);
  501. }
  502. /**
  503. * @brief Get field afx from position_target_global_int message
  504. *
  505. * @return [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  506. */
  507. static inline float mavlink_msg_position_target_global_int_get_afx(const mavlink_message_t* msg)
  508. {
  509. return _MAV_RETURN_float(msg, 28);
  510. }
  511. /**
  512. * @brief Get field afy from position_target_global_int message
  513. *
  514. * @return [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  515. */
  516. static inline float mavlink_msg_position_target_global_int_get_afy(const mavlink_message_t* msg)
  517. {
  518. return _MAV_RETURN_float(msg, 32);
  519. }
  520. /**
  521. * @brief Get field afz from position_target_global_int message
  522. *
  523. * @return [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
  524. */
  525. static inline float mavlink_msg_position_target_global_int_get_afz(const mavlink_message_t* msg)
  526. {
  527. return _MAV_RETURN_float(msg, 36);
  528. }
  529. /**
  530. * @brief Get field yaw from position_target_global_int message
  531. *
  532. * @return [rad] yaw setpoint
  533. */
  534. static inline float mavlink_msg_position_target_global_int_get_yaw(const mavlink_message_t* msg)
  535. {
  536. return _MAV_RETURN_float(msg, 40);
  537. }
  538. /**
  539. * @brief Get field yaw_rate from position_target_global_int message
  540. *
  541. * @return [rad/s] yaw rate setpoint
  542. */
  543. static inline float mavlink_msg_position_target_global_int_get_yaw_rate(const mavlink_message_t* msg)
  544. {
  545. return _MAV_RETURN_float(msg, 44);
  546. }
  547. /**
  548. * @brief Decode a position_target_global_int message into a struct
  549. *
  550. * @param msg The message to decode
  551. * @param position_target_global_int C-struct to decode the message contents into
  552. */
  553. static inline void mavlink_msg_position_target_global_int_decode(const mavlink_message_t* msg, mavlink_position_target_global_int_t* position_target_global_int)
  554. {
  555. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  556. position_target_global_int->time_boot_ms = mavlink_msg_position_target_global_int_get_time_boot_ms(msg);
  557. position_target_global_int->lat_int = mavlink_msg_position_target_global_int_get_lat_int(msg);
  558. position_target_global_int->lon_int = mavlink_msg_position_target_global_int_get_lon_int(msg);
  559. position_target_global_int->alt = mavlink_msg_position_target_global_int_get_alt(msg);
  560. position_target_global_int->vx = mavlink_msg_position_target_global_int_get_vx(msg);
  561. position_target_global_int->vy = mavlink_msg_position_target_global_int_get_vy(msg);
  562. position_target_global_int->vz = mavlink_msg_position_target_global_int_get_vz(msg);
  563. position_target_global_int->afx = mavlink_msg_position_target_global_int_get_afx(msg);
  564. position_target_global_int->afy = mavlink_msg_position_target_global_int_get_afy(msg);
  565. position_target_global_int->afz = mavlink_msg_position_target_global_int_get_afz(msg);
  566. position_target_global_int->yaw = mavlink_msg_position_target_global_int_get_yaw(msg);
  567. position_target_global_int->yaw_rate = mavlink_msg_position_target_global_int_get_yaw_rate(msg);
  568. position_target_global_int->type_mask = mavlink_msg_position_target_global_int_get_type_mask(msg);
  569. position_target_global_int->coordinate_frame = mavlink_msg_position_target_global_int_get_coordinate_frame(msg);
  570. #else
  571. uint8_t len = msg->len < MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN? msg->len : MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN;
  572. memset(position_target_global_int, 0, MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_LEN);
  573. memcpy(position_target_global_int, _MAV_PAYLOAD(msg), len);
  574. #endif
  575. }