mavlink_msg_high_latency2.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988
  1. #pragma once
  2. // MESSAGE HIGH_LATENCY2 PACKING
  3. #define MAVLINK_MSG_ID_HIGH_LATENCY2 235
  4. typedef struct __mavlink_high_latency2_t {
  5. uint32_t timestamp; /*< [ms] Timestamp (milliseconds since boot or Unix epoch)*/
  6. int32_t latitude; /*< [degE7] Latitude*/
  7. int32_t longitude; /*< [degE7] Longitude*/
  8. uint16_t custom_mode; /*< A bitfield for use for autopilot-specific flags (2 byte version).*/
  9. int16_t altitude; /*< [m] Altitude above mean sea level*/
  10. int16_t target_altitude; /*< [m] Altitude setpoint*/
  11. uint16_t target_distance; /*< [dam] Distance to target waypoint or position*/
  12. uint16_t wp_num; /*< Current waypoint number*/
  13. uint16_t failure_flags; /*< Bitmap of failure flags.*/
  14. uint8_t type; /*< Type of the MAV (quadrotor, helicopter, etc.)*/
  15. uint8_t autopilot; /*< Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.*/
  16. uint8_t heading; /*< [deg/2] Heading*/
  17. uint8_t target_heading; /*< [deg/2] Heading setpoint*/
  18. uint8_t throttle; /*< [%] Throttle*/
  19. uint8_t airspeed; /*< [m/s*5] Airspeed*/
  20. uint8_t airspeed_sp; /*< [m/s*5] Airspeed setpoint*/
  21. uint8_t groundspeed; /*< [m/s*5] Groundspeed*/
  22. uint8_t windspeed; /*< [m/s*5] Windspeed*/
  23. uint8_t wind_heading; /*< [deg/2] Wind heading*/
  24. uint8_t eph; /*< [dm] Maximum error horizontal position since last message*/
  25. uint8_t epv; /*< [dm] Maximum error vertical position since last message*/
  26. int8_t temperature_air; /*< [degC] Air temperature from airspeed sensor*/
  27. int8_t climb_rate; /*< [dm/s] Maximum climb rate magnitude since last message*/
  28. int8_t battery; /*< [%] Battery level (-1 if field not provided).*/
  29. int8_t custom0; /*< Field for custom payload.*/
  30. int8_t custom1; /*< Field for custom payload.*/
  31. int8_t custom2; /*< Field for custom payload.*/
  32. } mavlink_high_latency2_t;
  33. #define MAVLINK_MSG_ID_HIGH_LATENCY2_LEN 42
  34. #define MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN 42
  35. #define MAVLINK_MSG_ID_235_LEN 42
  36. #define MAVLINK_MSG_ID_235_MIN_LEN 42
  37. #define MAVLINK_MSG_ID_HIGH_LATENCY2_CRC 179
  38. #define MAVLINK_MSG_ID_235_CRC 179
  39. #if MAVLINK_COMMAND_24BIT
  40. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 { \
  41. 235, \
  42. "HIGH_LATENCY2", \
  43. 27, \
  44. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
  45. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
  46. { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
  47. { "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
  48. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
  49. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
  50. { "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
  51. { "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
  52. { "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
  53. { "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
  54. { "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
  55. { "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
  56. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
  57. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
  58. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
  59. { "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
  60. { "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
  61. { "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
  62. { "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
  63. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
  64. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
  65. { "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
  66. { "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
  67. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
  68. { "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
  69. { "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
  70. { "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
  71. } \
  72. }
  73. #else
  74. #define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 { \
  75. "HIGH_LATENCY2", \
  76. 27, \
  77. { { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
  78. { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
  79. { "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
  80. { "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
  81. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
  82. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
  83. { "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
  84. { "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
  85. { "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
  86. { "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
  87. { "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
  88. { "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
  89. { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
  90. { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
  91. { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
  92. { "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
  93. { "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
  94. { "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
  95. { "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
  96. { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
  97. { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
  98. { "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
  99. { "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
  100. { "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
  101. { "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
  102. { "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
  103. { "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
  104. } \
  105. }
  106. #endif
  107. /**
  108. * @brief Pack a high_latency2 message
  109. * @param system_id ID of this system
  110. * @param component_id ID of this component (e.g. 200 for IMU)
  111. * @param msg The MAVLink message to compress the data into
  112. *
  113. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  114. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  115. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  116. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  117. * @param latitude [degE7] Latitude
  118. * @param longitude [degE7] Longitude
  119. * @param altitude [m] Altitude above mean sea level
  120. * @param target_altitude [m] Altitude setpoint
  121. * @param heading [deg/2] Heading
  122. * @param target_heading [deg/2] Heading setpoint
  123. * @param target_distance [dam] Distance to target waypoint or position
  124. * @param throttle [%] Throttle
  125. * @param airspeed [m/s*5] Airspeed
  126. * @param airspeed_sp [m/s*5] Airspeed setpoint
  127. * @param groundspeed [m/s*5] Groundspeed
  128. * @param windspeed [m/s*5] Windspeed
  129. * @param wind_heading [deg/2] Wind heading
  130. * @param eph [dm] Maximum error horizontal position since last message
  131. * @param epv [dm] Maximum error vertical position since last message
  132. * @param temperature_air [degC] Air temperature from airspeed sensor
  133. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  134. * @param battery [%] Battery level (-1 if field not provided).
  135. * @param wp_num Current waypoint number
  136. * @param failure_flags Bitmap of failure flags.
  137. * @param custom0 Field for custom payload.
  138. * @param custom1 Field for custom payload.
  139. * @param custom2 Field for custom payload.
  140. * @return length of the message in bytes (excluding serial stream start sign)
  141. */
  142. static inline uint16_t mavlink_msg_high_latency2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  143. uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  144. {
  145. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  146. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  147. _mav_put_uint32_t(buf, 0, timestamp);
  148. _mav_put_int32_t(buf, 4, latitude);
  149. _mav_put_int32_t(buf, 8, longitude);
  150. _mav_put_uint16_t(buf, 12, custom_mode);
  151. _mav_put_int16_t(buf, 14, altitude);
  152. _mav_put_int16_t(buf, 16, target_altitude);
  153. _mav_put_uint16_t(buf, 18, target_distance);
  154. _mav_put_uint16_t(buf, 20, wp_num);
  155. _mav_put_uint16_t(buf, 22, failure_flags);
  156. _mav_put_uint8_t(buf, 24, type);
  157. _mav_put_uint8_t(buf, 25, autopilot);
  158. _mav_put_uint8_t(buf, 26, heading);
  159. _mav_put_uint8_t(buf, 27, target_heading);
  160. _mav_put_uint8_t(buf, 28, throttle);
  161. _mav_put_uint8_t(buf, 29, airspeed);
  162. _mav_put_uint8_t(buf, 30, airspeed_sp);
  163. _mav_put_uint8_t(buf, 31, groundspeed);
  164. _mav_put_uint8_t(buf, 32, windspeed);
  165. _mav_put_uint8_t(buf, 33, wind_heading);
  166. _mav_put_uint8_t(buf, 34, eph);
  167. _mav_put_uint8_t(buf, 35, epv);
  168. _mav_put_int8_t(buf, 36, temperature_air);
  169. _mav_put_int8_t(buf, 37, climb_rate);
  170. _mav_put_int8_t(buf, 38, battery);
  171. _mav_put_int8_t(buf, 39, custom0);
  172. _mav_put_int8_t(buf, 40, custom1);
  173. _mav_put_int8_t(buf, 41, custom2);
  174. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  175. #else
  176. mavlink_high_latency2_t packet;
  177. packet.timestamp = timestamp;
  178. packet.latitude = latitude;
  179. packet.longitude = longitude;
  180. packet.custom_mode = custom_mode;
  181. packet.altitude = altitude;
  182. packet.target_altitude = target_altitude;
  183. packet.target_distance = target_distance;
  184. packet.wp_num = wp_num;
  185. packet.failure_flags = failure_flags;
  186. packet.type = type;
  187. packet.autopilot = autopilot;
  188. packet.heading = heading;
  189. packet.target_heading = target_heading;
  190. packet.throttle = throttle;
  191. packet.airspeed = airspeed;
  192. packet.airspeed_sp = airspeed_sp;
  193. packet.groundspeed = groundspeed;
  194. packet.windspeed = windspeed;
  195. packet.wind_heading = wind_heading;
  196. packet.eph = eph;
  197. packet.epv = epv;
  198. packet.temperature_air = temperature_air;
  199. packet.climb_rate = climb_rate;
  200. packet.battery = battery;
  201. packet.custom0 = custom0;
  202. packet.custom1 = custom1;
  203. packet.custom2 = custom2;
  204. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  205. #endif
  206. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
  207. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  208. }
  209. /**
  210. * @brief Pack a high_latency2 message
  211. * @param system_id ID of this system
  212. * @param component_id ID of this component (e.g. 200 for IMU)
  213. * @param status MAVLink status structure
  214. * @param msg The MAVLink message to compress the data into
  215. *
  216. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  217. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  218. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  219. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  220. * @param latitude [degE7] Latitude
  221. * @param longitude [degE7] Longitude
  222. * @param altitude [m] Altitude above mean sea level
  223. * @param target_altitude [m] Altitude setpoint
  224. * @param heading [deg/2] Heading
  225. * @param target_heading [deg/2] Heading setpoint
  226. * @param target_distance [dam] Distance to target waypoint or position
  227. * @param throttle [%] Throttle
  228. * @param airspeed [m/s*5] Airspeed
  229. * @param airspeed_sp [m/s*5] Airspeed setpoint
  230. * @param groundspeed [m/s*5] Groundspeed
  231. * @param windspeed [m/s*5] Windspeed
  232. * @param wind_heading [deg/2] Wind heading
  233. * @param eph [dm] Maximum error horizontal position since last message
  234. * @param epv [dm] Maximum error vertical position since last message
  235. * @param temperature_air [degC] Air temperature from airspeed sensor
  236. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  237. * @param battery [%] Battery level (-1 if field not provided).
  238. * @param wp_num Current waypoint number
  239. * @param failure_flags Bitmap of failure flags.
  240. * @param custom0 Field for custom payload.
  241. * @param custom1 Field for custom payload.
  242. * @param custom2 Field for custom payload.
  243. * @return length of the message in bytes (excluding serial stream start sign)
  244. */
  245. static inline uint16_t mavlink_msg_high_latency2_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  246. uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  247. {
  248. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  249. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  250. _mav_put_uint32_t(buf, 0, timestamp);
  251. _mav_put_int32_t(buf, 4, latitude);
  252. _mav_put_int32_t(buf, 8, longitude);
  253. _mav_put_uint16_t(buf, 12, custom_mode);
  254. _mav_put_int16_t(buf, 14, altitude);
  255. _mav_put_int16_t(buf, 16, target_altitude);
  256. _mav_put_uint16_t(buf, 18, target_distance);
  257. _mav_put_uint16_t(buf, 20, wp_num);
  258. _mav_put_uint16_t(buf, 22, failure_flags);
  259. _mav_put_uint8_t(buf, 24, type);
  260. _mav_put_uint8_t(buf, 25, autopilot);
  261. _mav_put_uint8_t(buf, 26, heading);
  262. _mav_put_uint8_t(buf, 27, target_heading);
  263. _mav_put_uint8_t(buf, 28, throttle);
  264. _mav_put_uint8_t(buf, 29, airspeed);
  265. _mav_put_uint8_t(buf, 30, airspeed_sp);
  266. _mav_put_uint8_t(buf, 31, groundspeed);
  267. _mav_put_uint8_t(buf, 32, windspeed);
  268. _mav_put_uint8_t(buf, 33, wind_heading);
  269. _mav_put_uint8_t(buf, 34, eph);
  270. _mav_put_uint8_t(buf, 35, epv);
  271. _mav_put_int8_t(buf, 36, temperature_air);
  272. _mav_put_int8_t(buf, 37, climb_rate);
  273. _mav_put_int8_t(buf, 38, battery);
  274. _mav_put_int8_t(buf, 39, custom0);
  275. _mav_put_int8_t(buf, 40, custom1);
  276. _mav_put_int8_t(buf, 41, custom2);
  277. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  278. #else
  279. mavlink_high_latency2_t packet;
  280. packet.timestamp = timestamp;
  281. packet.latitude = latitude;
  282. packet.longitude = longitude;
  283. packet.custom_mode = custom_mode;
  284. packet.altitude = altitude;
  285. packet.target_altitude = target_altitude;
  286. packet.target_distance = target_distance;
  287. packet.wp_num = wp_num;
  288. packet.failure_flags = failure_flags;
  289. packet.type = type;
  290. packet.autopilot = autopilot;
  291. packet.heading = heading;
  292. packet.target_heading = target_heading;
  293. packet.throttle = throttle;
  294. packet.airspeed = airspeed;
  295. packet.airspeed_sp = airspeed_sp;
  296. packet.groundspeed = groundspeed;
  297. packet.windspeed = windspeed;
  298. packet.wind_heading = wind_heading;
  299. packet.eph = eph;
  300. packet.epv = epv;
  301. packet.temperature_air = temperature_air;
  302. packet.climb_rate = climb_rate;
  303. packet.battery = battery;
  304. packet.custom0 = custom0;
  305. packet.custom1 = custom1;
  306. packet.custom2 = custom2;
  307. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  308. #endif
  309. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
  310. #if MAVLINK_CRC_EXTRA
  311. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  312. #else
  313. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  314. #endif
  315. }
  316. /**
  317. * @brief Pack a high_latency2 message on a channel
  318. * @param system_id ID of this system
  319. * @param component_id ID of this component (e.g. 200 for IMU)
  320. * @param chan The MAVLink channel this message will be sent over
  321. * @param msg The MAVLink message to compress the data into
  322. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  323. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  324. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  325. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  326. * @param latitude [degE7] Latitude
  327. * @param longitude [degE7] Longitude
  328. * @param altitude [m] Altitude above mean sea level
  329. * @param target_altitude [m] Altitude setpoint
  330. * @param heading [deg/2] Heading
  331. * @param target_heading [deg/2] Heading setpoint
  332. * @param target_distance [dam] Distance to target waypoint or position
  333. * @param throttle [%] Throttle
  334. * @param airspeed [m/s*5] Airspeed
  335. * @param airspeed_sp [m/s*5] Airspeed setpoint
  336. * @param groundspeed [m/s*5] Groundspeed
  337. * @param windspeed [m/s*5] Windspeed
  338. * @param wind_heading [deg/2] Wind heading
  339. * @param eph [dm] Maximum error horizontal position since last message
  340. * @param epv [dm] Maximum error vertical position since last message
  341. * @param temperature_air [degC] Air temperature from airspeed sensor
  342. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  343. * @param battery [%] Battery level (-1 if field not provided).
  344. * @param wp_num Current waypoint number
  345. * @param failure_flags Bitmap of failure flags.
  346. * @param custom0 Field for custom payload.
  347. * @param custom1 Field for custom payload.
  348. * @param custom2 Field for custom payload.
  349. * @return length of the message in bytes (excluding serial stream start sign)
  350. */
  351. static inline uint16_t mavlink_msg_high_latency2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  352. mavlink_message_t* msg,
  353. uint32_t timestamp,uint8_t type,uint8_t autopilot,uint16_t custom_mode,int32_t latitude,int32_t longitude,int16_t altitude,int16_t target_altitude,uint8_t heading,uint8_t target_heading,uint16_t target_distance,uint8_t throttle,uint8_t airspeed,uint8_t airspeed_sp,uint8_t groundspeed,uint8_t windspeed,uint8_t wind_heading,uint8_t eph,uint8_t epv,int8_t temperature_air,int8_t climb_rate,int8_t battery,uint16_t wp_num,uint16_t failure_flags,int8_t custom0,int8_t custom1,int8_t custom2)
  354. {
  355. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  356. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  357. _mav_put_uint32_t(buf, 0, timestamp);
  358. _mav_put_int32_t(buf, 4, latitude);
  359. _mav_put_int32_t(buf, 8, longitude);
  360. _mav_put_uint16_t(buf, 12, custom_mode);
  361. _mav_put_int16_t(buf, 14, altitude);
  362. _mav_put_int16_t(buf, 16, target_altitude);
  363. _mav_put_uint16_t(buf, 18, target_distance);
  364. _mav_put_uint16_t(buf, 20, wp_num);
  365. _mav_put_uint16_t(buf, 22, failure_flags);
  366. _mav_put_uint8_t(buf, 24, type);
  367. _mav_put_uint8_t(buf, 25, autopilot);
  368. _mav_put_uint8_t(buf, 26, heading);
  369. _mav_put_uint8_t(buf, 27, target_heading);
  370. _mav_put_uint8_t(buf, 28, throttle);
  371. _mav_put_uint8_t(buf, 29, airspeed);
  372. _mav_put_uint8_t(buf, 30, airspeed_sp);
  373. _mav_put_uint8_t(buf, 31, groundspeed);
  374. _mav_put_uint8_t(buf, 32, windspeed);
  375. _mav_put_uint8_t(buf, 33, wind_heading);
  376. _mav_put_uint8_t(buf, 34, eph);
  377. _mav_put_uint8_t(buf, 35, epv);
  378. _mav_put_int8_t(buf, 36, temperature_air);
  379. _mav_put_int8_t(buf, 37, climb_rate);
  380. _mav_put_int8_t(buf, 38, battery);
  381. _mav_put_int8_t(buf, 39, custom0);
  382. _mav_put_int8_t(buf, 40, custom1);
  383. _mav_put_int8_t(buf, 41, custom2);
  384. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  385. #else
  386. mavlink_high_latency2_t packet;
  387. packet.timestamp = timestamp;
  388. packet.latitude = latitude;
  389. packet.longitude = longitude;
  390. packet.custom_mode = custom_mode;
  391. packet.altitude = altitude;
  392. packet.target_altitude = target_altitude;
  393. packet.target_distance = target_distance;
  394. packet.wp_num = wp_num;
  395. packet.failure_flags = failure_flags;
  396. packet.type = type;
  397. packet.autopilot = autopilot;
  398. packet.heading = heading;
  399. packet.target_heading = target_heading;
  400. packet.throttle = throttle;
  401. packet.airspeed = airspeed;
  402. packet.airspeed_sp = airspeed_sp;
  403. packet.groundspeed = groundspeed;
  404. packet.windspeed = windspeed;
  405. packet.wind_heading = wind_heading;
  406. packet.eph = eph;
  407. packet.epv = epv;
  408. packet.temperature_air = temperature_air;
  409. packet.climb_rate = climb_rate;
  410. packet.battery = battery;
  411. packet.custom0 = custom0;
  412. packet.custom1 = custom1;
  413. packet.custom2 = custom2;
  414. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  415. #endif
  416. msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
  417. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  418. }
  419. /**
  420. * @brief Encode a high_latency2 struct
  421. *
  422. * @param system_id ID of this system
  423. * @param component_id ID of this component (e.g. 200 for IMU)
  424. * @param msg The MAVLink message to compress the data into
  425. * @param high_latency2 C-struct to read the message contents from
  426. */
  427. static inline uint16_t mavlink_msg_high_latency2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
  428. {
  429. return mavlink_msg_high_latency2_pack(system_id, component_id, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  430. }
  431. /**
  432. * @brief Encode a high_latency2 struct on a channel
  433. *
  434. * @param system_id ID of this system
  435. * @param component_id ID of this component (e.g. 200 for IMU)
  436. * @param chan The MAVLink channel this message will be sent over
  437. * @param msg The MAVLink message to compress the data into
  438. * @param high_latency2 C-struct to read the message contents from
  439. */
  440. static inline uint16_t mavlink_msg_high_latency2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
  441. {
  442. return mavlink_msg_high_latency2_pack_chan(system_id, component_id, chan, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  443. }
  444. /**
  445. * @brief Encode a high_latency2 struct with provided status structure
  446. *
  447. * @param system_id ID of this system
  448. * @param component_id ID of this component (e.g. 200 for IMU)
  449. * @param status MAVLink status structure
  450. * @param msg The MAVLink message to compress the data into
  451. * @param high_latency2 C-struct to read the message contents from
  452. */
  453. static inline uint16_t mavlink_msg_high_latency2_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
  454. {
  455. return mavlink_msg_high_latency2_pack_status(system_id, component_id, _status, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  456. }
  457. /**
  458. * @brief Send a high_latency2 message
  459. * @param chan MAVLink channel to send the message
  460. *
  461. * @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
  462. * @param type Type of the MAV (quadrotor, helicopter, etc.)
  463. * @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  464. * @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
  465. * @param latitude [degE7] Latitude
  466. * @param longitude [degE7] Longitude
  467. * @param altitude [m] Altitude above mean sea level
  468. * @param target_altitude [m] Altitude setpoint
  469. * @param heading [deg/2] Heading
  470. * @param target_heading [deg/2] Heading setpoint
  471. * @param target_distance [dam] Distance to target waypoint or position
  472. * @param throttle [%] Throttle
  473. * @param airspeed [m/s*5] Airspeed
  474. * @param airspeed_sp [m/s*5] Airspeed setpoint
  475. * @param groundspeed [m/s*5] Groundspeed
  476. * @param windspeed [m/s*5] Windspeed
  477. * @param wind_heading [deg/2] Wind heading
  478. * @param eph [dm] Maximum error horizontal position since last message
  479. * @param epv [dm] Maximum error vertical position since last message
  480. * @param temperature_air [degC] Air temperature from airspeed sensor
  481. * @param climb_rate [dm/s] Maximum climb rate magnitude since last message
  482. * @param battery [%] Battery level (-1 if field not provided).
  483. * @param wp_num Current waypoint number
  484. * @param failure_flags Bitmap of failure flags.
  485. * @param custom0 Field for custom payload.
  486. * @param custom1 Field for custom payload.
  487. * @param custom2 Field for custom payload.
  488. */
  489. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  490. static inline void mavlink_msg_high_latency2_send(mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  491. {
  492. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  493. char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
  494. _mav_put_uint32_t(buf, 0, timestamp);
  495. _mav_put_int32_t(buf, 4, latitude);
  496. _mav_put_int32_t(buf, 8, longitude);
  497. _mav_put_uint16_t(buf, 12, custom_mode);
  498. _mav_put_int16_t(buf, 14, altitude);
  499. _mav_put_int16_t(buf, 16, target_altitude);
  500. _mav_put_uint16_t(buf, 18, target_distance);
  501. _mav_put_uint16_t(buf, 20, wp_num);
  502. _mav_put_uint16_t(buf, 22, failure_flags);
  503. _mav_put_uint8_t(buf, 24, type);
  504. _mav_put_uint8_t(buf, 25, autopilot);
  505. _mav_put_uint8_t(buf, 26, heading);
  506. _mav_put_uint8_t(buf, 27, target_heading);
  507. _mav_put_uint8_t(buf, 28, throttle);
  508. _mav_put_uint8_t(buf, 29, airspeed);
  509. _mav_put_uint8_t(buf, 30, airspeed_sp);
  510. _mav_put_uint8_t(buf, 31, groundspeed);
  511. _mav_put_uint8_t(buf, 32, windspeed);
  512. _mav_put_uint8_t(buf, 33, wind_heading);
  513. _mav_put_uint8_t(buf, 34, eph);
  514. _mav_put_uint8_t(buf, 35, epv);
  515. _mav_put_int8_t(buf, 36, temperature_air);
  516. _mav_put_int8_t(buf, 37, climb_rate);
  517. _mav_put_int8_t(buf, 38, battery);
  518. _mav_put_int8_t(buf, 39, custom0);
  519. _mav_put_int8_t(buf, 40, custom1);
  520. _mav_put_int8_t(buf, 41, custom2);
  521. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  522. #else
  523. mavlink_high_latency2_t packet;
  524. packet.timestamp = timestamp;
  525. packet.latitude = latitude;
  526. packet.longitude = longitude;
  527. packet.custom_mode = custom_mode;
  528. packet.altitude = altitude;
  529. packet.target_altitude = target_altitude;
  530. packet.target_distance = target_distance;
  531. packet.wp_num = wp_num;
  532. packet.failure_flags = failure_flags;
  533. packet.type = type;
  534. packet.autopilot = autopilot;
  535. packet.heading = heading;
  536. packet.target_heading = target_heading;
  537. packet.throttle = throttle;
  538. packet.airspeed = airspeed;
  539. packet.airspeed_sp = airspeed_sp;
  540. packet.groundspeed = groundspeed;
  541. packet.windspeed = windspeed;
  542. packet.wind_heading = wind_heading;
  543. packet.eph = eph;
  544. packet.epv = epv;
  545. packet.temperature_air = temperature_air;
  546. packet.climb_rate = climb_rate;
  547. packet.battery = battery;
  548. packet.custom0 = custom0;
  549. packet.custom1 = custom1;
  550. packet.custom2 = custom2;
  551. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)&packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  552. #endif
  553. }
  554. /**
  555. * @brief Send a high_latency2 message
  556. * @param chan MAVLink channel to send the message
  557. * @param struct The MAVLink struct to serialize
  558. */
  559. static inline void mavlink_msg_high_latency2_send_struct(mavlink_channel_t chan, const mavlink_high_latency2_t* high_latency2)
  560. {
  561. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  562. mavlink_msg_high_latency2_send(chan, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
  563. #else
  564. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)high_latency2, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  565. #endif
  566. }
  567. #if MAVLINK_MSG_ID_HIGH_LATENCY2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  568. /*
  569. This variant of _send() can be used to save stack space by re-using
  570. memory from the receive buffer. The caller provides a
  571. mavlink_message_t which is the size of a full mavlink message. This
  572. is usually the receive buffer for the channel, and allows a reply to an
  573. incoming message with minimum stack space usage.
  574. */
  575. static inline void mavlink_msg_high_latency2_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
  576. {
  577. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  578. char *buf = (char *)msgbuf;
  579. _mav_put_uint32_t(buf, 0, timestamp);
  580. _mav_put_int32_t(buf, 4, latitude);
  581. _mav_put_int32_t(buf, 8, longitude);
  582. _mav_put_uint16_t(buf, 12, custom_mode);
  583. _mav_put_int16_t(buf, 14, altitude);
  584. _mav_put_int16_t(buf, 16, target_altitude);
  585. _mav_put_uint16_t(buf, 18, target_distance);
  586. _mav_put_uint16_t(buf, 20, wp_num);
  587. _mav_put_uint16_t(buf, 22, failure_flags);
  588. _mav_put_uint8_t(buf, 24, type);
  589. _mav_put_uint8_t(buf, 25, autopilot);
  590. _mav_put_uint8_t(buf, 26, heading);
  591. _mav_put_uint8_t(buf, 27, target_heading);
  592. _mav_put_uint8_t(buf, 28, throttle);
  593. _mav_put_uint8_t(buf, 29, airspeed);
  594. _mav_put_uint8_t(buf, 30, airspeed_sp);
  595. _mav_put_uint8_t(buf, 31, groundspeed);
  596. _mav_put_uint8_t(buf, 32, windspeed);
  597. _mav_put_uint8_t(buf, 33, wind_heading);
  598. _mav_put_uint8_t(buf, 34, eph);
  599. _mav_put_uint8_t(buf, 35, epv);
  600. _mav_put_int8_t(buf, 36, temperature_air);
  601. _mav_put_int8_t(buf, 37, climb_rate);
  602. _mav_put_int8_t(buf, 38, battery);
  603. _mav_put_int8_t(buf, 39, custom0);
  604. _mav_put_int8_t(buf, 40, custom1);
  605. _mav_put_int8_t(buf, 41, custom2);
  606. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  607. #else
  608. mavlink_high_latency2_t *packet = (mavlink_high_latency2_t *)msgbuf;
  609. packet->timestamp = timestamp;
  610. packet->latitude = latitude;
  611. packet->longitude = longitude;
  612. packet->custom_mode = custom_mode;
  613. packet->altitude = altitude;
  614. packet->target_altitude = target_altitude;
  615. packet->target_distance = target_distance;
  616. packet->wp_num = wp_num;
  617. packet->failure_flags = failure_flags;
  618. packet->type = type;
  619. packet->autopilot = autopilot;
  620. packet->heading = heading;
  621. packet->target_heading = target_heading;
  622. packet->throttle = throttle;
  623. packet->airspeed = airspeed;
  624. packet->airspeed_sp = airspeed_sp;
  625. packet->groundspeed = groundspeed;
  626. packet->windspeed = windspeed;
  627. packet->wind_heading = wind_heading;
  628. packet->eph = eph;
  629. packet->epv = epv;
  630. packet->temperature_air = temperature_air;
  631. packet->climb_rate = climb_rate;
  632. packet->battery = battery;
  633. packet->custom0 = custom0;
  634. packet->custom1 = custom1;
  635. packet->custom2 = custom2;
  636. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char *)packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
  637. #endif
  638. }
  639. #endif
  640. #endif
  641. // MESSAGE HIGH_LATENCY2 UNPACKING
  642. /**
  643. * @brief Get field timestamp from high_latency2 message
  644. *
  645. * @return [ms] Timestamp (milliseconds since boot or Unix epoch)
  646. */
  647. static inline uint32_t mavlink_msg_high_latency2_get_timestamp(const mavlink_message_t* msg)
  648. {
  649. return _MAV_RETURN_uint32_t(msg, 0);
  650. }
  651. /**
  652. * @brief Get field type from high_latency2 message
  653. *
  654. * @return Type of the MAV (quadrotor, helicopter, etc.)
  655. */
  656. static inline uint8_t mavlink_msg_high_latency2_get_type(const mavlink_message_t* msg)
  657. {
  658. return _MAV_RETURN_uint8_t(msg, 24);
  659. }
  660. /**
  661. * @brief Get field autopilot from high_latency2 message
  662. *
  663. * @return Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
  664. */
  665. static inline uint8_t mavlink_msg_high_latency2_get_autopilot(const mavlink_message_t* msg)
  666. {
  667. return _MAV_RETURN_uint8_t(msg, 25);
  668. }
  669. /**
  670. * @brief Get field custom_mode from high_latency2 message
  671. *
  672. * @return A bitfield for use for autopilot-specific flags (2 byte version).
  673. */
  674. static inline uint16_t mavlink_msg_high_latency2_get_custom_mode(const mavlink_message_t* msg)
  675. {
  676. return _MAV_RETURN_uint16_t(msg, 12);
  677. }
  678. /**
  679. * @brief Get field latitude from high_latency2 message
  680. *
  681. * @return [degE7] Latitude
  682. */
  683. static inline int32_t mavlink_msg_high_latency2_get_latitude(const mavlink_message_t* msg)
  684. {
  685. return _MAV_RETURN_int32_t(msg, 4);
  686. }
  687. /**
  688. * @brief Get field longitude from high_latency2 message
  689. *
  690. * @return [degE7] Longitude
  691. */
  692. static inline int32_t mavlink_msg_high_latency2_get_longitude(const mavlink_message_t* msg)
  693. {
  694. return _MAV_RETURN_int32_t(msg, 8);
  695. }
  696. /**
  697. * @brief Get field altitude from high_latency2 message
  698. *
  699. * @return [m] Altitude above mean sea level
  700. */
  701. static inline int16_t mavlink_msg_high_latency2_get_altitude(const mavlink_message_t* msg)
  702. {
  703. return _MAV_RETURN_int16_t(msg, 14);
  704. }
  705. /**
  706. * @brief Get field target_altitude from high_latency2 message
  707. *
  708. * @return [m] Altitude setpoint
  709. */
  710. static inline int16_t mavlink_msg_high_latency2_get_target_altitude(const mavlink_message_t* msg)
  711. {
  712. return _MAV_RETURN_int16_t(msg, 16);
  713. }
  714. /**
  715. * @brief Get field heading from high_latency2 message
  716. *
  717. * @return [deg/2] Heading
  718. */
  719. static inline uint8_t mavlink_msg_high_latency2_get_heading(const mavlink_message_t* msg)
  720. {
  721. return _MAV_RETURN_uint8_t(msg, 26);
  722. }
  723. /**
  724. * @brief Get field target_heading from high_latency2 message
  725. *
  726. * @return [deg/2] Heading setpoint
  727. */
  728. static inline uint8_t mavlink_msg_high_latency2_get_target_heading(const mavlink_message_t* msg)
  729. {
  730. return _MAV_RETURN_uint8_t(msg, 27);
  731. }
  732. /**
  733. * @brief Get field target_distance from high_latency2 message
  734. *
  735. * @return [dam] Distance to target waypoint or position
  736. */
  737. static inline uint16_t mavlink_msg_high_latency2_get_target_distance(const mavlink_message_t* msg)
  738. {
  739. return _MAV_RETURN_uint16_t(msg, 18);
  740. }
  741. /**
  742. * @brief Get field throttle from high_latency2 message
  743. *
  744. * @return [%] Throttle
  745. */
  746. static inline uint8_t mavlink_msg_high_latency2_get_throttle(const mavlink_message_t* msg)
  747. {
  748. return _MAV_RETURN_uint8_t(msg, 28);
  749. }
  750. /**
  751. * @brief Get field airspeed from high_latency2 message
  752. *
  753. * @return [m/s*5] Airspeed
  754. */
  755. static inline uint8_t mavlink_msg_high_latency2_get_airspeed(const mavlink_message_t* msg)
  756. {
  757. return _MAV_RETURN_uint8_t(msg, 29);
  758. }
  759. /**
  760. * @brief Get field airspeed_sp from high_latency2 message
  761. *
  762. * @return [m/s*5] Airspeed setpoint
  763. */
  764. static inline uint8_t mavlink_msg_high_latency2_get_airspeed_sp(const mavlink_message_t* msg)
  765. {
  766. return _MAV_RETURN_uint8_t(msg, 30);
  767. }
  768. /**
  769. * @brief Get field groundspeed from high_latency2 message
  770. *
  771. * @return [m/s*5] Groundspeed
  772. */
  773. static inline uint8_t mavlink_msg_high_latency2_get_groundspeed(const mavlink_message_t* msg)
  774. {
  775. return _MAV_RETURN_uint8_t(msg, 31);
  776. }
  777. /**
  778. * @brief Get field windspeed from high_latency2 message
  779. *
  780. * @return [m/s*5] Windspeed
  781. */
  782. static inline uint8_t mavlink_msg_high_latency2_get_windspeed(const mavlink_message_t* msg)
  783. {
  784. return _MAV_RETURN_uint8_t(msg, 32);
  785. }
  786. /**
  787. * @brief Get field wind_heading from high_latency2 message
  788. *
  789. * @return [deg/2] Wind heading
  790. */
  791. static inline uint8_t mavlink_msg_high_latency2_get_wind_heading(const mavlink_message_t* msg)
  792. {
  793. return _MAV_RETURN_uint8_t(msg, 33);
  794. }
  795. /**
  796. * @brief Get field eph from high_latency2 message
  797. *
  798. * @return [dm] Maximum error horizontal position since last message
  799. */
  800. static inline uint8_t mavlink_msg_high_latency2_get_eph(const mavlink_message_t* msg)
  801. {
  802. return _MAV_RETURN_uint8_t(msg, 34);
  803. }
  804. /**
  805. * @brief Get field epv from high_latency2 message
  806. *
  807. * @return [dm] Maximum error vertical position since last message
  808. */
  809. static inline uint8_t mavlink_msg_high_latency2_get_epv(const mavlink_message_t* msg)
  810. {
  811. return _MAV_RETURN_uint8_t(msg, 35);
  812. }
  813. /**
  814. * @brief Get field temperature_air from high_latency2 message
  815. *
  816. * @return [degC] Air temperature from airspeed sensor
  817. */
  818. static inline int8_t mavlink_msg_high_latency2_get_temperature_air(const mavlink_message_t* msg)
  819. {
  820. return _MAV_RETURN_int8_t(msg, 36);
  821. }
  822. /**
  823. * @brief Get field climb_rate from high_latency2 message
  824. *
  825. * @return [dm/s] Maximum climb rate magnitude since last message
  826. */
  827. static inline int8_t mavlink_msg_high_latency2_get_climb_rate(const mavlink_message_t* msg)
  828. {
  829. return _MAV_RETURN_int8_t(msg, 37);
  830. }
  831. /**
  832. * @brief Get field battery from high_latency2 message
  833. *
  834. * @return [%] Battery level (-1 if field not provided).
  835. */
  836. static inline int8_t mavlink_msg_high_latency2_get_battery(const mavlink_message_t* msg)
  837. {
  838. return _MAV_RETURN_int8_t(msg, 38);
  839. }
  840. /**
  841. * @brief Get field wp_num from high_latency2 message
  842. *
  843. * @return Current waypoint number
  844. */
  845. static inline uint16_t mavlink_msg_high_latency2_get_wp_num(const mavlink_message_t* msg)
  846. {
  847. return _MAV_RETURN_uint16_t(msg, 20);
  848. }
  849. /**
  850. * @brief Get field failure_flags from high_latency2 message
  851. *
  852. * @return Bitmap of failure flags.
  853. */
  854. static inline uint16_t mavlink_msg_high_latency2_get_failure_flags(const mavlink_message_t* msg)
  855. {
  856. return _MAV_RETURN_uint16_t(msg, 22);
  857. }
  858. /**
  859. * @brief Get field custom0 from high_latency2 message
  860. *
  861. * @return Field for custom payload.
  862. */
  863. static inline int8_t mavlink_msg_high_latency2_get_custom0(const mavlink_message_t* msg)
  864. {
  865. return _MAV_RETURN_int8_t(msg, 39);
  866. }
  867. /**
  868. * @brief Get field custom1 from high_latency2 message
  869. *
  870. * @return Field for custom payload.
  871. */
  872. static inline int8_t mavlink_msg_high_latency2_get_custom1(const mavlink_message_t* msg)
  873. {
  874. return _MAV_RETURN_int8_t(msg, 40);
  875. }
  876. /**
  877. * @brief Get field custom2 from high_latency2 message
  878. *
  879. * @return Field for custom payload.
  880. */
  881. static inline int8_t mavlink_msg_high_latency2_get_custom2(const mavlink_message_t* msg)
  882. {
  883. return _MAV_RETURN_int8_t(msg, 41);
  884. }
  885. /**
  886. * @brief Decode a high_latency2 message into a struct
  887. *
  888. * @param msg The message to decode
  889. * @param high_latency2 C-struct to decode the message contents into
  890. */
  891. static inline void mavlink_msg_high_latency2_decode(const mavlink_message_t* msg, mavlink_high_latency2_t* high_latency2)
  892. {
  893. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  894. high_latency2->timestamp = mavlink_msg_high_latency2_get_timestamp(msg);
  895. high_latency2->latitude = mavlink_msg_high_latency2_get_latitude(msg);
  896. high_latency2->longitude = mavlink_msg_high_latency2_get_longitude(msg);
  897. high_latency2->custom_mode = mavlink_msg_high_latency2_get_custom_mode(msg);
  898. high_latency2->altitude = mavlink_msg_high_latency2_get_altitude(msg);
  899. high_latency2->target_altitude = mavlink_msg_high_latency2_get_target_altitude(msg);
  900. high_latency2->target_distance = mavlink_msg_high_latency2_get_target_distance(msg);
  901. high_latency2->wp_num = mavlink_msg_high_latency2_get_wp_num(msg);
  902. high_latency2->failure_flags = mavlink_msg_high_latency2_get_failure_flags(msg);
  903. high_latency2->type = mavlink_msg_high_latency2_get_type(msg);
  904. high_latency2->autopilot = mavlink_msg_high_latency2_get_autopilot(msg);
  905. high_latency2->heading = mavlink_msg_high_latency2_get_heading(msg);
  906. high_latency2->target_heading = mavlink_msg_high_latency2_get_target_heading(msg);
  907. high_latency2->throttle = mavlink_msg_high_latency2_get_throttle(msg);
  908. high_latency2->airspeed = mavlink_msg_high_latency2_get_airspeed(msg);
  909. high_latency2->airspeed_sp = mavlink_msg_high_latency2_get_airspeed_sp(msg);
  910. high_latency2->groundspeed = mavlink_msg_high_latency2_get_groundspeed(msg);
  911. high_latency2->windspeed = mavlink_msg_high_latency2_get_windspeed(msg);
  912. high_latency2->wind_heading = mavlink_msg_high_latency2_get_wind_heading(msg);
  913. high_latency2->eph = mavlink_msg_high_latency2_get_eph(msg);
  914. high_latency2->epv = mavlink_msg_high_latency2_get_epv(msg);
  915. high_latency2->temperature_air = mavlink_msg_high_latency2_get_temperature_air(msg);
  916. high_latency2->climb_rate = mavlink_msg_high_latency2_get_climb_rate(msg);
  917. high_latency2->battery = mavlink_msg_high_latency2_get_battery(msg);
  918. high_latency2->custom0 = mavlink_msg_high_latency2_get_custom0(msg);
  919. high_latency2->custom1 = mavlink_msg_high_latency2_get_custom1(msg);
  920. high_latency2->custom2 = mavlink_msg_high_latency2_get_custom2(msg);
  921. #else
  922. uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY2_LEN? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY2_LEN;
  923. memset(high_latency2, 0, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
  924. memcpy(high_latency2, _MAV_PAYLOAD(msg), len);
  925. #endif
  926. }