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

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