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
17 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE SIMSTATE PACKING
  3. #define MAVLINK_MSG_ID_SIMSTATE 164
  4. MAVPACKED(
  5. typedef struct __mavlink_simstate_t {
  6. float roll; /*< [rad] Roll angle.*/
  7. float pitch; /*< [rad] Pitch angle.*/
  8. float yaw; /*< [rad] Yaw angle.*/
  9. float xacc; /*< [m/s/s] X acceleration.*/
  10. float yacc; /*< [m/s/s] Y acceleration.*/
  11. float zacc; /*< [m/s/s] Z acceleration.*/
  12. float xgyro; /*< [rad/s] Angular speed around X axis.*/
  13. float ygyro; /*< [rad/s] Angular speed around Y axis.*/
  14. float zgyro; /*< [rad/s] Angular speed around Z axis.*/
  15. int32_t lat; /*< [degE7] Latitude.*/
  16. int32_t lng; /*< [degE7] Longitude.*/
  17. }) mavlink_simstate_t;
  18. #define MAVLINK_MSG_ID_SIMSTATE_LEN 44
  19. #define MAVLINK_MSG_ID_SIMSTATE_MIN_LEN 44
  20. #define MAVLINK_MSG_ID_164_LEN 44
  21. #define MAVLINK_MSG_ID_164_MIN_LEN 44
  22. #define MAVLINK_MSG_ID_SIMSTATE_CRC 154
  23. #define MAVLINK_MSG_ID_164_CRC 154
  24. #if MAVLINK_COMMAND_24BIT
  25. #define MAVLINK_MESSAGE_INFO_SIMSTATE { \
  26. 164, \
  27. "SIMSTATE", \
  28. 11, \
  29. { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_simstate_t, roll) }, \
  30. { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_simstate_t, pitch) }, \
  31. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_simstate_t, yaw) }, \
  32. { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_simstate_t, xacc) }, \
  33. { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_simstate_t, yacc) }, \
  34. { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_simstate_t, zacc) }, \
  35. { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_simstate_t, xgyro) }, \
  36. { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_simstate_t, ygyro) }, \
  37. { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_simstate_t, zgyro) }, \
  38. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_simstate_t, lat) }, \
  39. { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_simstate_t, lng) }, \
  40. } \
  41. }
  42. #else
  43. #define MAVLINK_MESSAGE_INFO_SIMSTATE { \
  44. "SIMSTATE", \
  45. 11, \
  46. { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_simstate_t, roll) }, \
  47. { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_simstate_t, pitch) }, \
  48. { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_simstate_t, yaw) }, \
  49. { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_simstate_t, xacc) }, \
  50. { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_simstate_t, yacc) }, \
  51. { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_simstate_t, zacc) }, \
  52. { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_simstate_t, xgyro) }, \
  53. { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_simstate_t, ygyro) }, \
  54. { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_simstate_t, zgyro) }, \
  55. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_simstate_t, lat) }, \
  56. { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_simstate_t, lng) }, \
  57. } \
  58. }
  59. #endif
  60. /**
  61. * @brief Pack a simstate 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 roll [rad] Roll angle.
  67. * @param pitch [rad] Pitch angle.
  68. * @param yaw [rad] Yaw angle.
  69. * @param xacc [m/s/s] X acceleration.
  70. * @param yacc [m/s/s] Y acceleration.
  71. * @param zacc [m/s/s] Z acceleration.
  72. * @param xgyro [rad/s] Angular speed around X axis.
  73. * @param ygyro [rad/s] Angular speed around Y axis.
  74. * @param zgyro [rad/s] Angular speed around Z axis.
  75. * @param lat [degE7] Latitude.
  76. * @param lng [degE7] Longitude.
  77. * @return length of the message in bytes (excluding serial stream start sign)
  78. */
  79. static inline uint16_t mavlink_msg_simstate_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  80. float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng)
  81. {
  82. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  83. char buf[MAVLINK_MSG_ID_SIMSTATE_LEN];
  84. _mav_put_float(buf, 0, roll);
  85. _mav_put_float(buf, 4, pitch);
  86. _mav_put_float(buf, 8, yaw);
  87. _mav_put_float(buf, 12, xacc);
  88. _mav_put_float(buf, 16, yacc);
  89. _mav_put_float(buf, 20, zacc);
  90. _mav_put_float(buf, 24, xgyro);
  91. _mav_put_float(buf, 28, ygyro);
  92. _mav_put_float(buf, 32, zgyro);
  93. _mav_put_int32_t(buf, 36, lat);
  94. _mav_put_int32_t(buf, 40, lng);
  95. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIMSTATE_LEN);
  96. #else
  97. mavlink_simstate_t packet;
  98. packet.roll = roll;
  99. packet.pitch = pitch;
  100. packet.yaw = yaw;
  101. packet.xacc = xacc;
  102. packet.yacc = yacc;
  103. packet.zacc = zacc;
  104. packet.xgyro = xgyro;
  105. packet.ygyro = ygyro;
  106. packet.zgyro = zgyro;
  107. packet.lat = lat;
  108. packet.lng = lng;
  109. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIMSTATE_LEN);
  110. #endif
  111. msg->msgid = MAVLINK_MSG_ID_SIMSTATE;
  112. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  113. }
  114. /**
  115. * @brief Pack a simstate 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 roll [rad] Roll angle.
  121. * @param pitch [rad] Pitch angle.
  122. * @param yaw [rad] Yaw angle.
  123. * @param xacc [m/s/s] X acceleration.
  124. * @param yacc [m/s/s] Y acceleration.
  125. * @param zacc [m/s/s] Z acceleration.
  126. * @param xgyro [rad/s] Angular speed around X axis.
  127. * @param ygyro [rad/s] Angular speed around Y axis.
  128. * @param zgyro [rad/s] Angular speed around Z axis.
  129. * @param lat [degE7] Latitude.
  130. * @param lng [degE7] Longitude.
  131. * @return length of the message in bytes (excluding serial stream start sign)
  132. */
  133. static inline uint16_t mavlink_msg_simstate_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  134. mavlink_message_t* msg,
  135. float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,int32_t lat,int32_t lng)
  136. {
  137. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  138. char buf[MAVLINK_MSG_ID_SIMSTATE_LEN];
  139. _mav_put_float(buf, 0, roll);
  140. _mav_put_float(buf, 4, pitch);
  141. _mav_put_float(buf, 8, yaw);
  142. _mav_put_float(buf, 12, xacc);
  143. _mav_put_float(buf, 16, yacc);
  144. _mav_put_float(buf, 20, zacc);
  145. _mav_put_float(buf, 24, xgyro);
  146. _mav_put_float(buf, 28, ygyro);
  147. _mav_put_float(buf, 32, zgyro);
  148. _mav_put_int32_t(buf, 36, lat);
  149. _mav_put_int32_t(buf, 40, lng);
  150. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIMSTATE_LEN);
  151. #else
  152. mavlink_simstate_t packet;
  153. packet.roll = roll;
  154. packet.pitch = pitch;
  155. packet.yaw = yaw;
  156. packet.xacc = xacc;
  157. packet.yacc = yacc;
  158. packet.zacc = zacc;
  159. packet.xgyro = xgyro;
  160. packet.ygyro = ygyro;
  161. packet.zgyro = zgyro;
  162. packet.lat = lat;
  163. packet.lng = lng;
  164. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIMSTATE_LEN);
  165. #endif
  166. msg->msgid = MAVLINK_MSG_ID_SIMSTATE;
  167. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  168. }
  169. /**
  170. * @brief Encode a simstate 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 simstate C-struct to read the message contents from
  176. */
  177. static inline uint16_t mavlink_msg_simstate_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_simstate_t* simstate)
  178. {
  179. return mavlink_msg_simstate_pack(system_id, component_id, msg, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng);
  180. }
  181. /**
  182. * @brief Encode a simstate 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 simstate C-struct to read the message contents from
  189. */
  190. static inline uint16_t mavlink_msg_simstate_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_simstate_t* simstate)
  191. {
  192. return mavlink_msg_simstate_pack_chan(system_id, component_id, chan, msg, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng);
  193. }
  194. /**
  195. * @brief Send a simstate message
  196. * @param chan MAVLink channel to send the message
  197. *
  198. * @param roll [rad] Roll angle.
  199. * @param pitch [rad] Pitch angle.
  200. * @param yaw [rad] Yaw angle.
  201. * @param xacc [m/s/s] X acceleration.
  202. * @param yacc [m/s/s] Y acceleration.
  203. * @param zacc [m/s/s] Z acceleration.
  204. * @param xgyro [rad/s] Angular speed around X axis.
  205. * @param ygyro [rad/s] Angular speed around Y axis.
  206. * @param zgyro [rad/s] Angular speed around Z axis.
  207. * @param lat [degE7] Latitude.
  208. * @param lng [degE7] Longitude.
  209. */
  210. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  211. static inline void mavlink_msg_simstate_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng)
  212. {
  213. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  214. char buf[MAVLINK_MSG_ID_SIMSTATE_LEN];
  215. _mav_put_float(buf, 0, roll);
  216. _mav_put_float(buf, 4, pitch);
  217. _mav_put_float(buf, 8, yaw);
  218. _mav_put_float(buf, 12, xacc);
  219. _mav_put_float(buf, 16, yacc);
  220. _mav_put_float(buf, 20, zacc);
  221. _mav_put_float(buf, 24, xgyro);
  222. _mav_put_float(buf, 28, ygyro);
  223. _mav_put_float(buf, 32, zgyro);
  224. _mav_put_int32_t(buf, 36, lat);
  225. _mav_put_int32_t(buf, 40, lng);
  226. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, buf, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  227. #else
  228. mavlink_simstate_t packet;
  229. packet.roll = roll;
  230. packet.pitch = pitch;
  231. packet.yaw = yaw;
  232. packet.xacc = xacc;
  233. packet.yacc = yacc;
  234. packet.zacc = zacc;
  235. packet.xgyro = xgyro;
  236. packet.ygyro = ygyro;
  237. packet.zgyro = zgyro;
  238. packet.lat = lat;
  239. packet.lng = lng;
  240. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)&packet, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  241. #endif
  242. }
  243. /**
  244. * @brief Send a simstate 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_simstate_send_struct(mavlink_channel_t chan, const mavlink_simstate_t* simstate)
  249. {
  250. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  251. mavlink_msg_simstate_send(chan, simstate->roll, simstate->pitch, simstate->yaw, simstate->xacc, simstate->yacc, simstate->zacc, simstate->xgyro, simstate->ygyro, simstate->zgyro, simstate->lat, simstate->lng);
  252. #else
  253. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)simstate, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  254. #endif
  255. }
  256. #if MAVLINK_MSG_ID_SIMSTATE_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_simstate_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, int32_t lat, int32_t lng)
  265. {
  266. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  267. char *buf = (char *)msgbuf;
  268. _mav_put_float(buf, 0, roll);
  269. _mav_put_float(buf, 4, pitch);
  270. _mav_put_float(buf, 8, yaw);
  271. _mav_put_float(buf, 12, xacc);
  272. _mav_put_float(buf, 16, yacc);
  273. _mav_put_float(buf, 20, zacc);
  274. _mav_put_float(buf, 24, xgyro);
  275. _mav_put_float(buf, 28, ygyro);
  276. _mav_put_float(buf, 32, zgyro);
  277. _mav_put_int32_t(buf, 36, lat);
  278. _mav_put_int32_t(buf, 40, lng);
  279. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, buf, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  280. #else
  281. mavlink_simstate_t *packet = (mavlink_simstate_t *)msgbuf;
  282. packet->roll = roll;
  283. packet->pitch = pitch;
  284. packet->yaw = yaw;
  285. packet->xacc = xacc;
  286. packet->yacc = yacc;
  287. packet->zacc = zacc;
  288. packet->xgyro = xgyro;
  289. packet->ygyro = ygyro;
  290. packet->zgyro = zgyro;
  291. packet->lat = lat;
  292. packet->lng = lng;
  293. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIMSTATE, (const char *)packet, MAVLINK_MSG_ID_SIMSTATE_MIN_LEN, MAVLINK_MSG_ID_SIMSTATE_LEN, MAVLINK_MSG_ID_SIMSTATE_CRC);
  294. #endif
  295. }
  296. #endif
  297. #endif
  298. // MESSAGE SIMSTATE UNPACKING
  299. /**
  300. * @brief Get field roll from simstate message
  301. *
  302. * @return [rad] Roll angle.
  303. */
  304. static inline float mavlink_msg_simstate_get_roll(const mavlink_message_t* msg)
  305. {
  306. return _MAV_RETURN_float(msg, 0);
  307. }
  308. /**
  309. * @brief Get field pitch from simstate message
  310. *
  311. * @return [rad] Pitch angle.
  312. */
  313. static inline float mavlink_msg_simstate_get_pitch(const mavlink_message_t* msg)
  314. {
  315. return _MAV_RETURN_float(msg, 4);
  316. }
  317. /**
  318. * @brief Get field yaw from simstate message
  319. *
  320. * @return [rad] Yaw angle.
  321. */
  322. static inline float mavlink_msg_simstate_get_yaw(const mavlink_message_t* msg)
  323. {
  324. return _MAV_RETURN_float(msg, 8);
  325. }
  326. /**
  327. * @brief Get field xacc from simstate message
  328. *
  329. * @return [m/s/s] X acceleration.
  330. */
  331. static inline float mavlink_msg_simstate_get_xacc(const mavlink_message_t* msg)
  332. {
  333. return _MAV_RETURN_float(msg, 12);
  334. }
  335. /**
  336. * @brief Get field yacc from simstate message
  337. *
  338. * @return [m/s/s] Y acceleration.
  339. */
  340. static inline float mavlink_msg_simstate_get_yacc(const mavlink_message_t* msg)
  341. {
  342. return _MAV_RETURN_float(msg, 16);
  343. }
  344. /**
  345. * @brief Get field zacc from simstate message
  346. *
  347. * @return [m/s/s] Z acceleration.
  348. */
  349. static inline float mavlink_msg_simstate_get_zacc(const mavlink_message_t* msg)
  350. {
  351. return _MAV_RETURN_float(msg, 20);
  352. }
  353. /**
  354. * @brief Get field xgyro from simstate message
  355. *
  356. * @return [rad/s] Angular speed around X axis.
  357. */
  358. static inline float mavlink_msg_simstate_get_xgyro(const mavlink_message_t* msg)
  359. {
  360. return _MAV_RETURN_float(msg, 24);
  361. }
  362. /**
  363. * @brief Get field ygyro from simstate message
  364. *
  365. * @return [rad/s] Angular speed around Y axis.
  366. */
  367. static inline float mavlink_msg_simstate_get_ygyro(const mavlink_message_t* msg)
  368. {
  369. return _MAV_RETURN_float(msg, 28);
  370. }
  371. /**
  372. * @brief Get field zgyro from simstate message
  373. *
  374. * @return [rad/s] Angular speed around Z axis.
  375. */
  376. static inline float mavlink_msg_simstate_get_zgyro(const mavlink_message_t* msg)
  377. {
  378. return _MAV_RETURN_float(msg, 32);
  379. }
  380. /**
  381. * @brief Get field lat from simstate message
  382. *
  383. * @return [degE7] Latitude.
  384. */
  385. static inline int32_t mavlink_msg_simstate_get_lat(const mavlink_message_t* msg)
  386. {
  387. return _MAV_RETURN_int32_t(msg, 36);
  388. }
  389. /**
  390. * @brief Get field lng from simstate message
  391. *
  392. * @return [degE7] Longitude.
  393. */
  394. static inline int32_t mavlink_msg_simstate_get_lng(const mavlink_message_t* msg)
  395. {
  396. return _MAV_RETURN_int32_t(msg, 40);
  397. }
  398. /**
  399. * @brief Decode a simstate message into a struct
  400. *
  401. * @param msg The message to decode
  402. * @param simstate C-struct to decode the message contents into
  403. */
  404. static inline void mavlink_msg_simstate_decode(const mavlink_message_t* msg, mavlink_simstate_t* simstate)
  405. {
  406. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  407. simstate->roll = mavlink_msg_simstate_get_roll(msg);
  408. simstate->pitch = mavlink_msg_simstate_get_pitch(msg);
  409. simstate->yaw = mavlink_msg_simstate_get_yaw(msg);
  410. simstate->xacc = mavlink_msg_simstate_get_xacc(msg);
  411. simstate->yacc = mavlink_msg_simstate_get_yacc(msg);
  412. simstate->zacc = mavlink_msg_simstate_get_zacc(msg);
  413. simstate->xgyro = mavlink_msg_simstate_get_xgyro(msg);
  414. simstate->ygyro = mavlink_msg_simstate_get_ygyro(msg);
  415. simstate->zgyro = mavlink_msg_simstate_get_zgyro(msg);
  416. simstate->lat = mavlink_msg_simstate_get_lat(msg);
  417. simstate->lng = mavlink_msg_simstate_get_lng(msg);
  418. #else
  419. uint8_t len = msg->len < MAVLINK_MSG_ID_SIMSTATE_LEN? msg->len : MAVLINK_MSG_ID_SIMSTATE_LEN;
  420. memset(simstate, 0, MAVLINK_MSG_ID_SIMSTATE_LEN);
  421. memcpy(simstate, _MAV_PAYLOAD(msg), len);
  422. #endif
  423. }