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.

588 lines
25 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE HIGHRES_IMU PACKING
  3. #define MAVLINK_MSG_ID_HIGHRES_IMU 105
  4. MAVPACKED(
  5. typedef struct __mavlink_highres_imu_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 xacc; /*< [m/s/s] X acceleration*/
  8. float yacc; /*< [m/s/s] Y acceleration*/
  9. float zacc; /*< [m/s/s] Z acceleration*/
  10. float xgyro; /*< [rad/s] Angular speed around X axis*/
  11. float ygyro; /*< [rad/s] Angular speed around Y axis*/
  12. float zgyro; /*< [rad/s] Angular speed around Z axis*/
  13. float xmag; /*< [gauss] X Magnetic field*/
  14. float ymag; /*< [gauss] Y Magnetic field*/
  15. float zmag; /*< [gauss] Z Magnetic field*/
  16. float abs_pressure; /*< [mbar] Absolute pressure*/
  17. float diff_pressure; /*< [mbar] Differential pressure*/
  18. float pressure_alt; /*< Altitude calculated from pressure*/
  19. float temperature; /*< [degC] Temperature*/
  20. uint16_t fields_updated; /*< Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/
  21. uint8_t id; /*< Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)*/
  22. }) mavlink_highres_imu_t;
  23. #define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 63
  24. #define MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN 62
  25. #define MAVLINK_MSG_ID_105_LEN 63
  26. #define MAVLINK_MSG_ID_105_MIN_LEN 62
  27. #define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
  28. #define MAVLINK_MSG_ID_105_CRC 93
  29. #if MAVLINK_COMMAND_24BIT
  30. #define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
  31. 105, \
  32. "HIGHRES_IMU", \
  33. 16, \
  34. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
  35. { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
  36. { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
  37. { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
  38. { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
  39. { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
  40. { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
  41. { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
  42. { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
  43. { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
  44. { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
  45. { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
  46. { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
  47. { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
  48. { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
  49. { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_highres_imu_t, id) }, \
  50. } \
  51. }
  52. #else
  53. #define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
  54. "HIGHRES_IMU", \
  55. 16, \
  56. { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
  57. { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
  58. { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
  59. { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
  60. { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
  61. { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
  62. { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
  63. { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
  64. { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
  65. { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
  66. { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
  67. { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
  68. { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
  69. { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
  70. { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
  71. { "id", NULL, MAVLINK_TYPE_UINT8_T, 0, 62, offsetof(mavlink_highres_imu_t, id) }, \
  72. } \
  73. }
  74. #endif
  75. /**
  76. * @brief Pack a highres_imu message
  77. * @param system_id ID of this system
  78. * @param component_id ID of this component (e.g. 200 for IMU)
  79. * @param msg The MAVLink message to compress the data into
  80. *
  81. * @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.
  82. * @param xacc [m/s/s] X acceleration
  83. * @param yacc [m/s/s] Y acceleration
  84. * @param zacc [m/s/s] Z acceleration
  85. * @param xgyro [rad/s] Angular speed around X axis
  86. * @param ygyro [rad/s] Angular speed around Y axis
  87. * @param zgyro [rad/s] Angular speed around Z axis
  88. * @param xmag [gauss] X Magnetic field
  89. * @param ymag [gauss] Y Magnetic field
  90. * @param zmag [gauss] Z Magnetic field
  91. * @param abs_pressure [mbar] Absolute pressure
  92. * @param diff_pressure [mbar] Differential pressure
  93. * @param pressure_alt Altitude calculated from pressure
  94. * @param temperature [degC] Temperature
  95. * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
  96. * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
  97. * @return length of the message in bytes (excluding serial stream start sign)
  98. */
  99. static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  100. uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
  101. {
  102. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  103. char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
  104. _mav_put_uint64_t(buf, 0, time_usec);
  105. _mav_put_float(buf, 8, xacc);
  106. _mav_put_float(buf, 12, yacc);
  107. _mav_put_float(buf, 16, zacc);
  108. _mav_put_float(buf, 20, xgyro);
  109. _mav_put_float(buf, 24, ygyro);
  110. _mav_put_float(buf, 28, zgyro);
  111. _mav_put_float(buf, 32, xmag);
  112. _mav_put_float(buf, 36, ymag);
  113. _mav_put_float(buf, 40, zmag);
  114. _mav_put_float(buf, 44, abs_pressure);
  115. _mav_put_float(buf, 48, diff_pressure);
  116. _mav_put_float(buf, 52, pressure_alt);
  117. _mav_put_float(buf, 56, temperature);
  118. _mav_put_uint16_t(buf, 60, fields_updated);
  119. _mav_put_uint8_t(buf, 62, id);
  120. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
  121. #else
  122. mavlink_highres_imu_t packet;
  123. packet.time_usec = time_usec;
  124. packet.xacc = xacc;
  125. packet.yacc = yacc;
  126. packet.zacc = zacc;
  127. packet.xgyro = xgyro;
  128. packet.ygyro = ygyro;
  129. packet.zgyro = zgyro;
  130. packet.xmag = xmag;
  131. packet.ymag = ymag;
  132. packet.zmag = zmag;
  133. packet.abs_pressure = abs_pressure;
  134. packet.diff_pressure = diff_pressure;
  135. packet.pressure_alt = pressure_alt;
  136. packet.temperature = temperature;
  137. packet.fields_updated = fields_updated;
  138. packet.id = id;
  139. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
  140. #endif
  141. msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
  142. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  143. }
  144. /**
  145. * @brief Pack a highres_imu message on a channel
  146. * @param system_id ID of this system
  147. * @param component_id ID of this component (e.g. 200 for IMU)
  148. * @param chan The MAVLink channel this message will be sent over
  149. * @param msg The MAVLink message to compress the data into
  150. * @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.
  151. * @param xacc [m/s/s] X acceleration
  152. * @param yacc [m/s/s] Y acceleration
  153. * @param zacc [m/s/s] Z acceleration
  154. * @param xgyro [rad/s] Angular speed around X axis
  155. * @param ygyro [rad/s] Angular speed around Y axis
  156. * @param zgyro [rad/s] Angular speed around Z axis
  157. * @param xmag [gauss] X Magnetic field
  158. * @param ymag [gauss] Y Magnetic field
  159. * @param zmag [gauss] Z Magnetic field
  160. * @param abs_pressure [mbar] Absolute pressure
  161. * @param diff_pressure [mbar] Differential pressure
  162. * @param pressure_alt Altitude calculated from pressure
  163. * @param temperature [degC] Temperature
  164. * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
  165. * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
  166. * @return length of the message in bytes (excluding serial stream start sign)
  167. */
  168. static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  169. mavlink_message_t* msg,
  170. uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint16_t fields_updated,uint8_t id)
  171. {
  172. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  173. char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
  174. _mav_put_uint64_t(buf, 0, time_usec);
  175. _mav_put_float(buf, 8, xacc);
  176. _mav_put_float(buf, 12, yacc);
  177. _mav_put_float(buf, 16, zacc);
  178. _mav_put_float(buf, 20, xgyro);
  179. _mav_put_float(buf, 24, ygyro);
  180. _mav_put_float(buf, 28, zgyro);
  181. _mav_put_float(buf, 32, xmag);
  182. _mav_put_float(buf, 36, ymag);
  183. _mav_put_float(buf, 40, zmag);
  184. _mav_put_float(buf, 44, abs_pressure);
  185. _mav_put_float(buf, 48, diff_pressure);
  186. _mav_put_float(buf, 52, pressure_alt);
  187. _mav_put_float(buf, 56, temperature);
  188. _mav_put_uint16_t(buf, 60, fields_updated);
  189. _mav_put_uint8_t(buf, 62, id);
  190. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
  191. #else
  192. mavlink_highres_imu_t packet;
  193. packet.time_usec = time_usec;
  194. packet.xacc = xacc;
  195. packet.yacc = yacc;
  196. packet.zacc = zacc;
  197. packet.xgyro = xgyro;
  198. packet.ygyro = ygyro;
  199. packet.zgyro = zgyro;
  200. packet.xmag = xmag;
  201. packet.ymag = ymag;
  202. packet.zmag = zmag;
  203. packet.abs_pressure = abs_pressure;
  204. packet.diff_pressure = diff_pressure;
  205. packet.pressure_alt = pressure_alt;
  206. packet.temperature = temperature;
  207. packet.fields_updated = fields_updated;
  208. packet.id = id;
  209. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
  210. #endif
  211. msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
  212. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  213. }
  214. /**
  215. * @brief Encode a highres_imu struct
  216. *
  217. * @param system_id ID of this system
  218. * @param component_id ID of this component (e.g. 200 for IMU)
  219. * @param msg The MAVLink message to compress the data into
  220. * @param highres_imu C-struct to read the message contents from
  221. */
  222. static inline uint16_t mavlink_msg_highres_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
  223. {
  224. return mavlink_msg_highres_imu_pack(system_id, component_id, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
  225. }
  226. /**
  227. * @brief Encode a highres_imu struct on a channel
  228. *
  229. * @param system_id ID of this system
  230. * @param component_id ID of this component (e.g. 200 for IMU)
  231. * @param chan The MAVLink channel this message will be sent over
  232. * @param msg The MAVLink message to compress the data into
  233. * @param highres_imu C-struct to read the message contents from
  234. */
  235. static inline uint16_t mavlink_msg_highres_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_highres_imu_t* highres_imu)
  236. {
  237. return mavlink_msg_highres_imu_pack_chan(system_id, component_id, chan, msg, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
  238. }
  239. /**
  240. * @brief Send a highres_imu message
  241. * @param chan MAVLink channel to send the message
  242. *
  243. * @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.
  244. * @param xacc [m/s/s] X acceleration
  245. * @param yacc [m/s/s] Y acceleration
  246. * @param zacc [m/s/s] Z acceleration
  247. * @param xgyro [rad/s] Angular speed around X axis
  248. * @param ygyro [rad/s] Angular speed around Y axis
  249. * @param zgyro [rad/s] Angular speed around Z axis
  250. * @param xmag [gauss] X Magnetic field
  251. * @param ymag [gauss] Y Magnetic field
  252. * @param zmag [gauss] Z Magnetic field
  253. * @param abs_pressure [mbar] Absolute pressure
  254. * @param diff_pressure [mbar] Differential pressure
  255. * @param pressure_alt Altitude calculated from pressure
  256. * @param temperature [degC] Temperature
  257. * @param fields_updated Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
  258. * @param id Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
  259. */
  260. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  261. static inline void mavlink_msg_highres_imu_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
  262. {
  263. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  264. char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
  265. _mav_put_uint64_t(buf, 0, time_usec);
  266. _mav_put_float(buf, 8, xacc);
  267. _mav_put_float(buf, 12, yacc);
  268. _mav_put_float(buf, 16, zacc);
  269. _mav_put_float(buf, 20, xgyro);
  270. _mav_put_float(buf, 24, ygyro);
  271. _mav_put_float(buf, 28, zgyro);
  272. _mav_put_float(buf, 32, xmag);
  273. _mav_put_float(buf, 36, ymag);
  274. _mav_put_float(buf, 40, zmag);
  275. _mav_put_float(buf, 44, abs_pressure);
  276. _mav_put_float(buf, 48, diff_pressure);
  277. _mav_put_float(buf, 52, pressure_alt);
  278. _mav_put_float(buf, 56, temperature);
  279. _mav_put_uint16_t(buf, 60, fields_updated);
  280. _mav_put_uint8_t(buf, 62, id);
  281. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  282. #else
  283. mavlink_highres_imu_t packet;
  284. packet.time_usec = time_usec;
  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.xmag = xmag;
  292. packet.ymag = ymag;
  293. packet.zmag = zmag;
  294. packet.abs_pressure = abs_pressure;
  295. packet.diff_pressure = diff_pressure;
  296. packet.pressure_alt = pressure_alt;
  297. packet.temperature = temperature;
  298. packet.fields_updated = fields_updated;
  299. packet.id = id;
  300. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  301. #endif
  302. }
  303. /**
  304. * @brief Send a highres_imu message
  305. * @param chan MAVLink channel to send the message
  306. * @param struct The MAVLink struct to serialize
  307. */
  308. static inline void mavlink_msg_highres_imu_send_struct(mavlink_channel_t chan, const mavlink_highres_imu_t* highres_imu)
  309. {
  310. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  311. mavlink_msg_highres_imu_send(chan, highres_imu->time_usec, highres_imu->xacc, highres_imu->yacc, highres_imu->zacc, highres_imu->xgyro, highres_imu->ygyro, highres_imu->zgyro, highres_imu->xmag, highres_imu->ymag, highres_imu->zmag, highres_imu->abs_pressure, highres_imu->diff_pressure, highres_imu->pressure_alt, highres_imu->temperature, highres_imu->fields_updated, highres_imu->id);
  312. #else
  313. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)highres_imu, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  314. #endif
  315. }
  316. #if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  317. /*
  318. This varient of _send() can be used to save stack space by re-using
  319. memory from the receive buffer. The caller provides a
  320. mavlink_message_t which is the size of a full mavlink message. This
  321. is usually the receive buffer for the channel, and allows a reply to an
  322. incoming message with minimum stack space usage.
  323. */
  324. static inline void mavlink_msg_highres_imu_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint16_t fields_updated, uint8_t id)
  325. {
  326. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  327. char *buf = (char *)msgbuf;
  328. _mav_put_uint64_t(buf, 0, time_usec);
  329. _mav_put_float(buf, 8, xacc);
  330. _mav_put_float(buf, 12, yacc);
  331. _mav_put_float(buf, 16, zacc);
  332. _mav_put_float(buf, 20, xgyro);
  333. _mav_put_float(buf, 24, ygyro);
  334. _mav_put_float(buf, 28, zgyro);
  335. _mav_put_float(buf, 32, xmag);
  336. _mav_put_float(buf, 36, ymag);
  337. _mav_put_float(buf, 40, zmag);
  338. _mav_put_float(buf, 44, abs_pressure);
  339. _mav_put_float(buf, 48, diff_pressure);
  340. _mav_put_float(buf, 52, pressure_alt);
  341. _mav_put_float(buf, 56, temperature);
  342. _mav_put_uint16_t(buf, 60, fields_updated);
  343. _mav_put_uint8_t(buf, 62, id);
  344. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  345. #else
  346. mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
  347. packet->time_usec = time_usec;
  348. packet->xacc = xacc;
  349. packet->yacc = yacc;
  350. packet->zacc = zacc;
  351. packet->xgyro = xgyro;
  352. packet->ygyro = ygyro;
  353. packet->zgyro = zgyro;
  354. packet->xmag = xmag;
  355. packet->ymag = ymag;
  356. packet->zmag = zmag;
  357. packet->abs_pressure = abs_pressure;
  358. packet->diff_pressure = diff_pressure;
  359. packet->pressure_alt = pressure_alt;
  360. packet->temperature = temperature;
  361. packet->fields_updated = fields_updated;
  362. packet->id = id;
  363. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
  364. #endif
  365. }
  366. #endif
  367. #endif
  368. // MESSAGE HIGHRES_IMU UNPACKING
  369. /**
  370. * @brief Get field time_usec from highres_imu message
  371. *
  372. * @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.
  373. */
  374. static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
  375. {
  376. return _MAV_RETURN_uint64_t(msg, 0);
  377. }
  378. /**
  379. * @brief Get field xacc from highres_imu message
  380. *
  381. * @return [m/s/s] X acceleration
  382. */
  383. static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
  384. {
  385. return _MAV_RETURN_float(msg, 8);
  386. }
  387. /**
  388. * @brief Get field yacc from highres_imu message
  389. *
  390. * @return [m/s/s] Y acceleration
  391. */
  392. static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
  393. {
  394. return _MAV_RETURN_float(msg, 12);
  395. }
  396. /**
  397. * @brief Get field zacc from highres_imu message
  398. *
  399. * @return [m/s/s] Z acceleration
  400. */
  401. static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
  402. {
  403. return _MAV_RETURN_float(msg, 16);
  404. }
  405. /**
  406. * @brief Get field xgyro from highres_imu message
  407. *
  408. * @return [rad/s] Angular speed around X axis
  409. */
  410. static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
  411. {
  412. return _MAV_RETURN_float(msg, 20);
  413. }
  414. /**
  415. * @brief Get field ygyro from highres_imu message
  416. *
  417. * @return [rad/s] Angular speed around Y axis
  418. */
  419. static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
  420. {
  421. return _MAV_RETURN_float(msg, 24);
  422. }
  423. /**
  424. * @brief Get field zgyro from highres_imu message
  425. *
  426. * @return [rad/s] Angular speed around Z axis
  427. */
  428. static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
  429. {
  430. return _MAV_RETURN_float(msg, 28);
  431. }
  432. /**
  433. * @brief Get field xmag from highres_imu message
  434. *
  435. * @return [gauss] X Magnetic field
  436. */
  437. static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
  438. {
  439. return _MAV_RETURN_float(msg, 32);
  440. }
  441. /**
  442. * @brief Get field ymag from highres_imu message
  443. *
  444. * @return [gauss] Y Magnetic field
  445. */
  446. static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
  447. {
  448. return _MAV_RETURN_float(msg, 36);
  449. }
  450. /**
  451. * @brief Get field zmag from highres_imu message
  452. *
  453. * @return [gauss] Z Magnetic field
  454. */
  455. static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
  456. {
  457. return _MAV_RETURN_float(msg, 40);
  458. }
  459. /**
  460. * @brief Get field abs_pressure from highres_imu message
  461. *
  462. * @return [mbar] Absolute pressure
  463. */
  464. static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
  465. {
  466. return _MAV_RETURN_float(msg, 44);
  467. }
  468. /**
  469. * @brief Get field diff_pressure from highres_imu message
  470. *
  471. * @return [mbar] Differential pressure
  472. */
  473. static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
  474. {
  475. return _MAV_RETURN_float(msg, 48);
  476. }
  477. /**
  478. * @brief Get field pressure_alt from highres_imu message
  479. *
  480. * @return Altitude calculated from pressure
  481. */
  482. static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
  483. {
  484. return _MAV_RETURN_float(msg, 52);
  485. }
  486. /**
  487. * @brief Get field temperature from highres_imu message
  488. *
  489. * @return [degC] Temperature
  490. */
  491. static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
  492. {
  493. return _MAV_RETURN_float(msg, 56);
  494. }
  495. /**
  496. * @brief Get field fields_updated from highres_imu message
  497. *
  498. * @return Bitmap for fields that have updated since last message, bit 0 = xacc, bit 12: temperature
  499. */
  500. static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
  501. {
  502. return _MAV_RETURN_uint16_t(msg, 60);
  503. }
  504. /**
  505. * @brief Get field id from highres_imu message
  506. *
  507. * @return Id. Ids are numbered from 0 and map to IMUs numbered from 1 (e.g. IMU1 will have a message with id=0)
  508. */
  509. static inline uint8_t mavlink_msg_highres_imu_get_id(const mavlink_message_t* msg)
  510. {
  511. return _MAV_RETURN_uint8_t(msg, 62);
  512. }
  513. /**
  514. * @brief Decode a highres_imu message into a struct
  515. *
  516. * @param msg The message to decode
  517. * @param highres_imu C-struct to decode the message contents into
  518. */
  519. static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
  520. {
  521. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  522. highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
  523. highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
  524. highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
  525. highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
  526. highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
  527. highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
  528. highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
  529. highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
  530. highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
  531. highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
  532. highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
  533. highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
  534. highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
  535. highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
  536. highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
  537. highres_imu->id = mavlink_msg_highres_imu_get_id(msg);
  538. #else
  539. uint8_t len = msg->len < MAVLINK_MSG_ID_HIGHRES_IMU_LEN? msg->len : MAVLINK_MSG_ID_HIGHRES_IMU_LEN;
  540. memset(highres_imu, 0, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
  541. memcpy(highres_imu, _MAV_PAYLOAD(msg), len);
  542. #endif
  543. }