You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

863 lines
39 KiB

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