mavlink_msg_scaled_imu2.h
Go to the documentation of this file.
00001 // MESSAGE SCALED_IMU2 PACKING
00002 
00003 #define MAVLINK_MSG_ID_SCALED_IMU2 116
00004 
00005 typedef struct __mavlink_scaled_imu2_t
00006 {
00007  uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
00008  int16_t xacc; /*< X acceleration (mg)*/
00009  int16_t yacc; /*< Y acceleration (mg)*/
00010  int16_t zacc; /*< Z acceleration (mg)*/
00011  int16_t xgyro; /*< Angular speed around X axis (millirad /sec)*/
00012  int16_t ygyro; /*< Angular speed around Y axis (millirad /sec)*/
00013  int16_t zgyro; /*< Angular speed around Z axis (millirad /sec)*/
00014  int16_t xmag; /*< X Magnetic field (milli tesla)*/
00015  int16_t ymag; /*< Y Magnetic field (milli tesla)*/
00016  int16_t zmag; /*< Z Magnetic field (milli tesla)*/
00017 } mavlink_scaled_imu2_t;
00018 
00019 #define MAVLINK_MSG_ID_SCALED_IMU2_LEN 22
00020 #define MAVLINK_MSG_ID_116_LEN 22
00021 
00022 #define MAVLINK_MSG_ID_SCALED_IMU2_CRC 76
00023 #define MAVLINK_MSG_ID_116_CRC 76
00024 
00025 
00026 
00027 #define MAVLINK_MESSAGE_INFO_SCALED_IMU2 { \
00028         "SCALED_IMU2", \
00029         10, \
00030         {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_scaled_imu2_t, time_boot_ms) }, \
00031          { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_scaled_imu2_t, xacc) }, \
00032          { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_scaled_imu2_t, yacc) }, \
00033          { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_scaled_imu2_t, zacc) }, \
00034          { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_scaled_imu2_t, xgyro) }, \
00035          { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_scaled_imu2_t, ygyro) }, \
00036          { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_scaled_imu2_t, zgyro) }, \
00037          { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_scaled_imu2_t, xmag) }, \
00038          { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_scaled_imu2_t, ymag) }, \
00039          { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_scaled_imu2_t, zmag) }, \
00040          } \
00041 }
00042 
00043 
00062 static inline uint16_t mavlink_msg_scaled_imu2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00063                                                        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)
00064 {
00065 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00066         char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
00067         _mav_put_uint32_t(buf, 0, time_boot_ms);
00068         _mav_put_int16_t(buf, 4, xacc);
00069         _mav_put_int16_t(buf, 6, yacc);
00070         _mav_put_int16_t(buf, 8, zacc);
00071         _mav_put_int16_t(buf, 10, xgyro);
00072         _mav_put_int16_t(buf, 12, ygyro);
00073         _mav_put_int16_t(buf, 14, zgyro);
00074         _mav_put_int16_t(buf, 16, xmag);
00075         _mav_put_int16_t(buf, 18, ymag);
00076         _mav_put_int16_t(buf, 20, zmag);
00077 
00078         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00079 #else
00080         mavlink_scaled_imu2_t packet;
00081         packet.time_boot_ms = time_boot_ms;
00082         packet.xacc = xacc;
00083         packet.yacc = yacc;
00084         packet.zacc = zacc;
00085         packet.xgyro = xgyro;
00086         packet.ygyro = ygyro;
00087         packet.zgyro = zgyro;
00088         packet.xmag = xmag;
00089         packet.ymag = ymag;
00090         packet.zmag = zmag;
00091 
00092         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00093 #endif
00094 
00095         msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
00096 #if MAVLINK_CRC_EXTRA
00097     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00098 #else
00099     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00100 #endif
00101 }
00102 
00121 static inline uint16_t mavlink_msg_scaled_imu2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00122                                                            mavlink_message_t* msg,
00123                                                            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)
00124 {
00125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00126         char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
00127         _mav_put_uint32_t(buf, 0, time_boot_ms);
00128         _mav_put_int16_t(buf, 4, xacc);
00129         _mav_put_int16_t(buf, 6, yacc);
00130         _mav_put_int16_t(buf, 8, zacc);
00131         _mav_put_int16_t(buf, 10, xgyro);
00132         _mav_put_int16_t(buf, 12, ygyro);
00133         _mav_put_int16_t(buf, 14, zgyro);
00134         _mav_put_int16_t(buf, 16, xmag);
00135         _mav_put_int16_t(buf, 18, ymag);
00136         _mav_put_int16_t(buf, 20, zmag);
00137 
00138         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00139 #else
00140         mavlink_scaled_imu2_t packet;
00141         packet.time_boot_ms = time_boot_ms;
00142         packet.xacc = xacc;
00143         packet.yacc = yacc;
00144         packet.zacc = zacc;
00145         packet.xgyro = xgyro;
00146         packet.ygyro = ygyro;
00147         packet.zgyro = zgyro;
00148         packet.xmag = xmag;
00149         packet.ymag = ymag;
00150         packet.zmag = zmag;
00151 
00152         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00153 #endif
00154 
00155         msg->msgid = MAVLINK_MSG_ID_SCALED_IMU2;
00156 #if MAVLINK_CRC_EXTRA
00157     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00158 #else
00159     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00160 #endif
00161 }
00162 
00171 static inline uint16_t mavlink_msg_scaled_imu2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2)
00172 {
00173         return mavlink_msg_scaled_imu2_pack(system_id, component_id, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag);
00174 }
00175 
00185 static inline uint16_t mavlink_msg_scaled_imu2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_scaled_imu2_t* scaled_imu2)
00186 {
00187         return mavlink_msg_scaled_imu2_pack_chan(system_id, component_id, chan, msg, scaled_imu2->time_boot_ms, scaled_imu2->xacc, scaled_imu2->yacc, scaled_imu2->zacc, scaled_imu2->xgyro, scaled_imu2->ygyro, scaled_imu2->zgyro, scaled_imu2->xmag, scaled_imu2->ymag, scaled_imu2->zmag);
00188 }
00189 
00205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00206 
00207 static inline void mavlink_msg_scaled_imu2_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)
00208 {
00209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00210         char buf[MAVLINK_MSG_ID_SCALED_IMU2_LEN];
00211         _mav_put_uint32_t(buf, 0, time_boot_ms);
00212         _mav_put_int16_t(buf, 4, xacc);
00213         _mav_put_int16_t(buf, 6, yacc);
00214         _mav_put_int16_t(buf, 8, zacc);
00215         _mav_put_int16_t(buf, 10, xgyro);
00216         _mav_put_int16_t(buf, 12, ygyro);
00217         _mav_put_int16_t(buf, 14, zgyro);
00218         _mav_put_int16_t(buf, 16, xmag);
00219         _mav_put_int16_t(buf, 18, ymag);
00220         _mav_put_int16_t(buf, 20, zmag);
00221 
00222 #if MAVLINK_CRC_EXTRA
00223     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00224 #else
00225     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00226 #endif
00227 #else
00228         mavlink_scaled_imu2_t packet;
00229         packet.time_boot_ms = time_boot_ms;
00230         packet.xacc = xacc;
00231         packet.yacc = yacc;
00232         packet.zacc = zacc;
00233         packet.xgyro = xgyro;
00234         packet.ygyro = ygyro;
00235         packet.zgyro = zgyro;
00236         packet.xmag = xmag;
00237         packet.ymag = ymag;
00238         packet.zmag = zmag;
00239 
00240 #if MAVLINK_CRC_EXTRA
00241     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00242 #else
00243     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)&packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00244 #endif
00245 #endif
00246 }
00247 
00248 #if MAVLINK_MSG_ID_SCALED_IMU2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00249 /*
00250   This varient of _send() can be used to save stack space by re-using
00251   memory from the receive buffer.  The caller provides a
00252   mavlink_message_t which is the size of a full mavlink message. This
00253   is usually the receive buffer for the channel, and allows a reply to an
00254   incoming message with minimum stack space usage.
00255  */
00256 static inline void mavlink_msg_scaled_imu2_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)
00257 {
00258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00259         char *buf = (char *)msgbuf;
00260         _mav_put_uint32_t(buf, 0, time_boot_ms);
00261         _mav_put_int16_t(buf, 4, xacc);
00262         _mav_put_int16_t(buf, 6, yacc);
00263         _mav_put_int16_t(buf, 8, zacc);
00264         _mav_put_int16_t(buf, 10, xgyro);
00265         _mav_put_int16_t(buf, 12, ygyro);
00266         _mav_put_int16_t(buf, 14, zgyro);
00267         _mav_put_int16_t(buf, 16, xmag);
00268         _mav_put_int16_t(buf, 18, ymag);
00269         _mav_put_int16_t(buf, 20, zmag);
00270 
00271 #if MAVLINK_CRC_EXTRA
00272     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00273 #else
00274     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, buf, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00275 #endif
00276 #else
00277         mavlink_scaled_imu2_t *packet = (mavlink_scaled_imu2_t *)msgbuf;
00278         packet->time_boot_ms = time_boot_ms;
00279         packet->xacc = xacc;
00280         packet->yacc = yacc;
00281         packet->zacc = zacc;
00282         packet->xgyro = xgyro;
00283         packet->ygyro = ygyro;
00284         packet->zgyro = zgyro;
00285         packet->xmag = xmag;
00286         packet->ymag = ymag;
00287         packet->zmag = zmag;
00288 
00289 #if MAVLINK_CRC_EXTRA
00290     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN, MAVLINK_MSG_ID_SCALED_IMU2_CRC);
00291 #else
00292     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SCALED_IMU2, (const char *)packet, MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00293 #endif
00294 #endif
00295 }
00296 #endif
00297 
00298 #endif
00299 
00300 // MESSAGE SCALED_IMU2 UNPACKING
00301 
00302 
00308 static inline uint32_t mavlink_msg_scaled_imu2_get_time_boot_ms(const mavlink_message_t* msg)
00309 {
00310         return _MAV_RETURN_uint32_t(msg,  0);
00311 }
00312 
00318 static inline int16_t mavlink_msg_scaled_imu2_get_xacc(const mavlink_message_t* msg)
00319 {
00320         return _MAV_RETURN_int16_t(msg,  4);
00321 }
00322 
00328 static inline int16_t mavlink_msg_scaled_imu2_get_yacc(const mavlink_message_t* msg)
00329 {
00330         return _MAV_RETURN_int16_t(msg,  6);
00331 }
00332 
00338 static inline int16_t mavlink_msg_scaled_imu2_get_zacc(const mavlink_message_t* msg)
00339 {
00340         return _MAV_RETURN_int16_t(msg,  8);
00341 }
00342 
00348 static inline int16_t mavlink_msg_scaled_imu2_get_xgyro(const mavlink_message_t* msg)
00349 {
00350         return _MAV_RETURN_int16_t(msg,  10);
00351 }
00352 
00358 static inline int16_t mavlink_msg_scaled_imu2_get_ygyro(const mavlink_message_t* msg)
00359 {
00360         return _MAV_RETURN_int16_t(msg,  12);
00361 }
00362 
00368 static inline int16_t mavlink_msg_scaled_imu2_get_zgyro(const mavlink_message_t* msg)
00369 {
00370         return _MAV_RETURN_int16_t(msg,  14);
00371 }
00372 
00378 static inline int16_t mavlink_msg_scaled_imu2_get_xmag(const mavlink_message_t* msg)
00379 {
00380         return _MAV_RETURN_int16_t(msg,  16);
00381 }
00382 
00388 static inline int16_t mavlink_msg_scaled_imu2_get_ymag(const mavlink_message_t* msg)
00389 {
00390         return _MAV_RETURN_int16_t(msg,  18);
00391 }
00392 
00398 static inline int16_t mavlink_msg_scaled_imu2_get_zmag(const mavlink_message_t* msg)
00399 {
00400         return _MAV_RETURN_int16_t(msg,  20);
00401 }
00402 
00409 static inline void mavlink_msg_scaled_imu2_decode(const mavlink_message_t* msg, mavlink_scaled_imu2_t* scaled_imu2)
00410 {
00411 #if MAVLINK_NEED_BYTE_SWAP
00412         scaled_imu2->time_boot_ms = mavlink_msg_scaled_imu2_get_time_boot_ms(msg);
00413         scaled_imu2->xacc = mavlink_msg_scaled_imu2_get_xacc(msg);
00414         scaled_imu2->yacc = mavlink_msg_scaled_imu2_get_yacc(msg);
00415         scaled_imu2->zacc = mavlink_msg_scaled_imu2_get_zacc(msg);
00416         scaled_imu2->xgyro = mavlink_msg_scaled_imu2_get_xgyro(msg);
00417         scaled_imu2->ygyro = mavlink_msg_scaled_imu2_get_ygyro(msg);
00418         scaled_imu2->zgyro = mavlink_msg_scaled_imu2_get_zgyro(msg);
00419         scaled_imu2->xmag = mavlink_msg_scaled_imu2_get_xmag(msg);
00420         scaled_imu2->ymag = mavlink_msg_scaled_imu2_get_ymag(msg);
00421         scaled_imu2->zmag = mavlink_msg_scaled_imu2_get_zmag(msg);
00422 #else
00423         memcpy(scaled_imu2, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SCALED_IMU2_LEN);
00424 #endif
00425 }


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:35