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.

463 lines
19 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE HIL_CONTROLS PACKING
  3. #define MAVLINK_MSG_ID_HIL_CONTROLS 91
  4. MAVPACKED(
  5. typedef struct __mavlink_hil_controls_t {
  6. uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.*/
  7. float roll_ailerons; /*< Control output -1 .. 1*/
  8. float pitch_elevator; /*< Control output -1 .. 1*/
  9. float yaw_rudder; /*< Control output -1 .. 1*/
  10. float throttle; /*< Throttle 0 .. 1*/
  11. float aux1; /*< Aux 1, -1 .. 1*/
  12. float aux2; /*< Aux 2, -1 .. 1*/
  13. float aux3; /*< Aux 3, -1 .. 1*/
  14. float aux4; /*< Aux 4, -1 .. 1*/
  15. uint8_t mode; /*< System mode.*/
  16. uint8_t nav_mode; /*< Navigation mode (MAV_NAV_MODE)*/
  17. }) mavlink_hil_controls_t;
  18. #define MAVLINK_MSG_ID_HIL_CONTROLS_LEN 42
  19. #define MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN 42
  20. #define MAVLINK_MSG_ID_91_LEN 42
  21. #define MAVLINK_MSG_ID_91_MIN_LEN 42
  22. #define MAVLINK_MSG_ID_HIL_CONTROLS_CRC 63
  23. #define MAVLINK_MSG_ID_91_CRC 63
  24. #if MAVLINK_COMMAND_24BIT
  25. #define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
  26. 91, \
  27. "HIL_CONTROLS", \
  28. 11, \
  29. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
  30. { "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
  31. { "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
  32. { "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
  33. { "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
  34. { "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
  35. { "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
  36. { "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
  37. { "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
  38. { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
  39. { "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
  40. } \
  41. }
  42. #else
  43. #define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
  44. "HIL_CONTROLS", \
  45. 11, \
  46. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_usec) }, \
  47. { "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
  48. { "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
  49. { "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
  50. { "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
  51. { "aux1", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_controls_t, aux1) }, \
  52. { "aux2", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_controls_t, aux2) }, \
  53. { "aux3", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_controls_t, aux3) }, \
  54. { "aux4", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_controls_t, aux4) }, \
  55. { "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_hil_controls_t, mode) }, \
  56. { "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_hil_controls_t, nav_mode) }, \
  57. } \
  58. }
  59. #endif
  60. /**
  61. * @brief Pack a hil_controls message
  62. * @param system_id ID of this system
  63. * @param component_id ID of this component (e.g. 200 for IMU)
  64. * @param msg The MAVLink message to compress the data into
  65. *
  66. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  67. * @param roll_ailerons Control output -1 .. 1
  68. * @param pitch_elevator Control output -1 .. 1
  69. * @param yaw_rudder Control output -1 .. 1
  70. * @param throttle Throttle 0 .. 1
  71. * @param aux1 Aux 1, -1 .. 1
  72. * @param aux2 Aux 2, -1 .. 1
  73. * @param aux3 Aux 3, -1 .. 1
  74. * @param aux4 Aux 4, -1 .. 1
  75. * @param mode System mode.
  76. * @param nav_mode Navigation mode (MAV_NAV_MODE)
  77. * @return length of the message in bytes (excluding serial stream start sign)
  78. */
  79. static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  80. uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
  81. {
  82. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  83. char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
  84. _mav_put_uint64_t(buf, 0, time_usec);
  85. _mav_put_float(buf, 8, roll_ailerons);
  86. _mav_put_float(buf, 12, pitch_elevator);
  87. _mav_put_float(buf, 16, yaw_rudder);
  88. _mav_put_float(buf, 20, throttle);
  89. _mav_put_float(buf, 24, aux1);
  90. _mav_put_float(buf, 28, aux2);
  91. _mav_put_float(buf, 32, aux3);
  92. _mav_put_float(buf, 36, aux4);
  93. _mav_put_uint8_t(buf, 40, mode);
  94. _mav_put_uint8_t(buf, 41, nav_mode);
  95. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
  96. #else
  97. mavlink_hil_controls_t packet;
  98. packet.time_usec = time_usec;
  99. packet.roll_ailerons = roll_ailerons;
  100. packet.pitch_elevator = pitch_elevator;
  101. packet.yaw_rudder = yaw_rudder;
  102. packet.throttle = throttle;
  103. packet.aux1 = aux1;
  104. packet.aux2 = aux2;
  105. packet.aux3 = aux3;
  106. packet.aux4 = aux4;
  107. packet.mode = mode;
  108. packet.nav_mode = nav_mode;
  109. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
  110. #endif
  111. msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
  112. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  113. }
  114. /**
  115. * @brief Pack a hil_controls message on a channel
  116. * @param system_id ID of this system
  117. * @param component_id ID of this component (e.g. 200 for IMU)
  118. * @param chan The MAVLink channel this message will be sent over
  119. * @param msg The MAVLink message to compress the data into
  120. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  121. * @param roll_ailerons Control output -1 .. 1
  122. * @param pitch_elevator Control output -1 .. 1
  123. * @param yaw_rudder Control output -1 .. 1
  124. * @param throttle Throttle 0 .. 1
  125. * @param aux1 Aux 1, -1 .. 1
  126. * @param aux2 Aux 2, -1 .. 1
  127. * @param aux3 Aux 3, -1 .. 1
  128. * @param aux4 Aux 4, -1 .. 1
  129. * @param mode System mode.
  130. * @param nav_mode Navigation mode (MAV_NAV_MODE)
  131. * @return length of the message in bytes (excluding serial stream start sign)
  132. */
  133. static inline uint16_t mavlink_msg_hil_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  134. mavlink_message_t* msg,
  135. uint64_t time_usec,float roll_ailerons,float pitch_elevator,float yaw_rudder,float throttle,float aux1,float aux2,float aux3,float aux4,uint8_t mode,uint8_t nav_mode)
  136. {
  137. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  138. char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
  139. _mav_put_uint64_t(buf, 0, time_usec);
  140. _mav_put_float(buf, 8, roll_ailerons);
  141. _mav_put_float(buf, 12, pitch_elevator);
  142. _mav_put_float(buf, 16, yaw_rudder);
  143. _mav_put_float(buf, 20, throttle);
  144. _mav_put_float(buf, 24, aux1);
  145. _mav_put_float(buf, 28, aux2);
  146. _mav_put_float(buf, 32, aux3);
  147. _mav_put_float(buf, 36, aux4);
  148. _mav_put_uint8_t(buf, 40, mode);
  149. _mav_put_uint8_t(buf, 41, nav_mode);
  150. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
  151. #else
  152. mavlink_hil_controls_t packet;
  153. packet.time_usec = time_usec;
  154. packet.roll_ailerons = roll_ailerons;
  155. packet.pitch_elevator = pitch_elevator;
  156. packet.yaw_rudder = yaw_rudder;
  157. packet.throttle = throttle;
  158. packet.aux1 = aux1;
  159. packet.aux2 = aux2;
  160. packet.aux3 = aux3;
  161. packet.aux4 = aux4;
  162. packet.mode = mode;
  163. packet.nav_mode = nav_mode;
  164. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
  165. #endif
  166. msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
  167. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  168. }
  169. /**
  170. * @brief Encode a hil_controls struct
  171. *
  172. * @param system_id ID of this system
  173. * @param component_id ID of this component (e.g. 200 for IMU)
  174. * @param msg The MAVLink message to compress the data into
  175. * @param hil_controls C-struct to read the message contents from
  176. */
  177. static inline uint16_t mavlink_msg_hil_controls_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
  178. {
  179. return mavlink_msg_hil_controls_pack(system_id, component_id, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
  180. }
  181. /**
  182. * @brief Encode a hil_controls struct on a channel
  183. *
  184. * @param system_id ID of this system
  185. * @param component_id ID of this component (e.g. 200 for IMU)
  186. * @param chan The MAVLink channel this message will be sent over
  187. * @param msg The MAVLink message to compress the data into
  188. * @param hil_controls C-struct to read the message contents from
  189. */
  190. static inline uint16_t mavlink_msg_hil_controls_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
  191. {
  192. return mavlink_msg_hil_controls_pack_chan(system_id, component_id, chan, msg, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
  193. }
  194. /**
  195. * @brief Send a hil_controls message
  196. * @param chan MAVLink channel to send the message
  197. *
  198. * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  199. * @param roll_ailerons Control output -1 .. 1
  200. * @param pitch_elevator Control output -1 .. 1
  201. * @param yaw_rudder Control output -1 .. 1
  202. * @param throttle Throttle 0 .. 1
  203. * @param aux1 Aux 1, -1 .. 1
  204. * @param aux2 Aux 2, -1 .. 1
  205. * @param aux3 Aux 3, -1 .. 1
  206. * @param aux4 Aux 4, -1 .. 1
  207. * @param mode System mode.
  208. * @param nav_mode Navigation mode (MAV_NAV_MODE)
  209. */
  210. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  211. static inline void mavlink_msg_hil_controls_send(mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
  212. {
  213. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  214. char buf[MAVLINK_MSG_ID_HIL_CONTROLS_LEN];
  215. _mav_put_uint64_t(buf, 0, time_usec);
  216. _mav_put_float(buf, 8, roll_ailerons);
  217. _mav_put_float(buf, 12, pitch_elevator);
  218. _mav_put_float(buf, 16, yaw_rudder);
  219. _mav_put_float(buf, 20, throttle);
  220. _mav_put_float(buf, 24, aux1);
  221. _mav_put_float(buf, 28, aux2);
  222. _mav_put_float(buf, 32, aux3);
  223. _mav_put_float(buf, 36, aux4);
  224. _mav_put_uint8_t(buf, 40, mode);
  225. _mav_put_uint8_t(buf, 41, nav_mode);
  226. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  227. #else
  228. mavlink_hil_controls_t packet;
  229. packet.time_usec = time_usec;
  230. packet.roll_ailerons = roll_ailerons;
  231. packet.pitch_elevator = pitch_elevator;
  232. packet.yaw_rudder = yaw_rudder;
  233. packet.throttle = throttle;
  234. packet.aux1 = aux1;
  235. packet.aux2 = aux2;
  236. packet.aux3 = aux3;
  237. packet.aux4 = aux4;
  238. packet.mode = mode;
  239. packet.nav_mode = nav_mode;
  240. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  241. #endif
  242. }
  243. /**
  244. * @brief Send a hil_controls message
  245. * @param chan MAVLink channel to send the message
  246. * @param struct The MAVLink struct to serialize
  247. */
  248. static inline void mavlink_msg_hil_controls_send_struct(mavlink_channel_t chan, const mavlink_hil_controls_t* hil_controls)
  249. {
  250. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  251. mavlink_msg_hil_controls_send(chan, hil_controls->time_usec, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->aux1, hil_controls->aux2, hil_controls->aux3, hil_controls->aux4, hil_controls->mode, hil_controls->nav_mode);
  252. #else
  253. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)hil_controls, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  254. #endif
  255. }
  256. #if MAVLINK_MSG_ID_HIL_CONTROLS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  257. /*
  258. This varient of _send() can be used to save stack space by re-using
  259. memory from the receive buffer. The caller provides a
  260. mavlink_message_t which is the size of a full mavlink message. This
  261. is usually the receive buffer for the channel, and allows a reply to an
  262. incoming message with minimum stack space usage.
  263. */
  264. static inline void mavlink_msg_hil_controls_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, float aux1, float aux2, float aux3, float aux4, uint8_t mode, uint8_t nav_mode)
  265. {
  266. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  267. char *buf = (char *)msgbuf;
  268. _mav_put_uint64_t(buf, 0, time_usec);
  269. _mav_put_float(buf, 8, roll_ailerons);
  270. _mav_put_float(buf, 12, pitch_elevator);
  271. _mav_put_float(buf, 16, yaw_rudder);
  272. _mav_put_float(buf, 20, throttle);
  273. _mav_put_float(buf, 24, aux1);
  274. _mav_put_float(buf, 28, aux2);
  275. _mav_put_float(buf, 32, aux3);
  276. _mav_put_float(buf, 36, aux4);
  277. _mav_put_uint8_t(buf, 40, mode);
  278. _mav_put_uint8_t(buf, 41, nav_mode);
  279. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  280. #else
  281. mavlink_hil_controls_t *packet = (mavlink_hil_controls_t *)msgbuf;
  282. packet->time_usec = time_usec;
  283. packet->roll_ailerons = roll_ailerons;
  284. packet->pitch_elevator = pitch_elevator;
  285. packet->yaw_rudder = yaw_rudder;
  286. packet->throttle = throttle;
  287. packet->aux1 = aux1;
  288. packet->aux2 = aux2;
  289. packet->aux3 = aux3;
  290. packet->aux4 = aux4;
  291. packet->mode = mode;
  292. packet->nav_mode = nav_mode;
  293. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)packet, MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_LEN, MAVLINK_MSG_ID_HIL_CONTROLS_CRC);
  294. #endif
  295. }
  296. #endif
  297. #endif
  298. // MESSAGE HIL_CONTROLS UNPACKING
  299. /**
  300. * @brief Get field time_usec from hil_controls message
  301. *
  302. * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude the number.
  303. */
  304. static inline uint64_t mavlink_msg_hil_controls_get_time_usec(const mavlink_message_t* msg)
  305. {
  306. return _MAV_RETURN_uint64_t(msg, 0);
  307. }
  308. /**
  309. * @brief Get field roll_ailerons from hil_controls message
  310. *
  311. * @return Control output -1 .. 1
  312. */
  313. static inline float mavlink_msg_hil_controls_get_roll_ailerons(const mavlink_message_t* msg)
  314. {
  315. return _MAV_RETURN_float(msg, 8);
  316. }
  317. /**
  318. * @brief Get field pitch_elevator from hil_controls message
  319. *
  320. * @return Control output -1 .. 1
  321. */
  322. static inline float mavlink_msg_hil_controls_get_pitch_elevator(const mavlink_message_t* msg)
  323. {
  324. return _MAV_RETURN_float(msg, 12);
  325. }
  326. /**
  327. * @brief Get field yaw_rudder from hil_controls message
  328. *
  329. * @return Control output -1 .. 1
  330. */
  331. static inline float mavlink_msg_hil_controls_get_yaw_rudder(const mavlink_message_t* msg)
  332. {
  333. return _MAV_RETURN_float(msg, 16);
  334. }
  335. /**
  336. * @brief Get field throttle from hil_controls message
  337. *
  338. * @return Throttle 0 .. 1
  339. */
  340. static inline float mavlink_msg_hil_controls_get_throttle(const mavlink_message_t* msg)
  341. {
  342. return _MAV_RETURN_float(msg, 20);
  343. }
  344. /**
  345. * @brief Get field aux1 from hil_controls message
  346. *
  347. * @return Aux 1, -1 .. 1
  348. */
  349. static inline float mavlink_msg_hil_controls_get_aux1(const mavlink_message_t* msg)
  350. {
  351. return _MAV_RETURN_float(msg, 24);
  352. }
  353. /**
  354. * @brief Get field aux2 from hil_controls message
  355. *
  356. * @return Aux 2, -1 .. 1
  357. */
  358. static inline float mavlink_msg_hil_controls_get_aux2(const mavlink_message_t* msg)
  359. {
  360. return _MAV_RETURN_float(msg, 28);
  361. }
  362. /**
  363. * @brief Get field aux3 from hil_controls message
  364. *
  365. * @return Aux 3, -1 .. 1
  366. */
  367. static inline float mavlink_msg_hil_controls_get_aux3(const mavlink_message_t* msg)
  368. {
  369. return _MAV_RETURN_float(msg, 32);
  370. }
  371. /**
  372. * @brief Get field aux4 from hil_controls message
  373. *
  374. * @return Aux 4, -1 .. 1
  375. */
  376. static inline float mavlink_msg_hil_controls_get_aux4(const mavlink_message_t* msg)
  377. {
  378. return _MAV_RETURN_float(msg, 36);
  379. }
  380. /**
  381. * @brief Get field mode from hil_controls message
  382. *
  383. * @return System mode.
  384. */
  385. static inline uint8_t mavlink_msg_hil_controls_get_mode(const mavlink_message_t* msg)
  386. {
  387. return _MAV_RETURN_uint8_t(msg, 40);
  388. }
  389. /**
  390. * @brief Get field nav_mode from hil_controls message
  391. *
  392. * @return Navigation mode (MAV_NAV_MODE)
  393. */
  394. static inline uint8_t mavlink_msg_hil_controls_get_nav_mode(const mavlink_message_t* msg)
  395. {
  396. return _MAV_RETURN_uint8_t(msg, 41);
  397. }
  398. /**
  399. * @brief Decode a hil_controls message into a struct
  400. *
  401. * @param msg The message to decode
  402. * @param hil_controls C-struct to decode the message contents into
  403. */
  404. static inline void mavlink_msg_hil_controls_decode(const mavlink_message_t* msg, mavlink_hil_controls_t* hil_controls)
  405. {
  406. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  407. hil_controls->time_usec = mavlink_msg_hil_controls_get_time_usec(msg);
  408. hil_controls->roll_ailerons = mavlink_msg_hil_controls_get_roll_ailerons(msg);
  409. hil_controls->pitch_elevator = mavlink_msg_hil_controls_get_pitch_elevator(msg);
  410. hil_controls->yaw_rudder = mavlink_msg_hil_controls_get_yaw_rudder(msg);
  411. hil_controls->throttle = mavlink_msg_hil_controls_get_throttle(msg);
  412. hil_controls->aux1 = mavlink_msg_hil_controls_get_aux1(msg);
  413. hil_controls->aux2 = mavlink_msg_hil_controls_get_aux2(msg);
  414. hil_controls->aux3 = mavlink_msg_hil_controls_get_aux3(msg);
  415. hil_controls->aux4 = mavlink_msg_hil_controls_get_aux4(msg);
  416. hil_controls->mode = mavlink_msg_hil_controls_get_mode(msg);
  417. hil_controls->nav_mode = mavlink_msg_hil_controls_get_nav_mode(msg);
  418. #else
  419. uint8_t len = msg->len < MAVLINK_MSG_ID_HIL_CONTROLS_LEN? msg->len : MAVLINK_MSG_ID_HIL_CONTROLS_LEN;
  420. memset(hil_controls, 0, MAVLINK_MSG_ID_HIL_CONTROLS_LEN);
  421. memcpy(hil_controls, _MAV_PAYLOAD(msg), len);
  422. #endif
  423. }