mavlink_msg_raw_imu.h
Go to the documentation of this file.
00001 // MESSAGE RAW_IMU PACKING
00002 
00003 #define MAVLINK_MSG_ID_RAW_IMU 27
00004 
00005 typedef struct __mavlink_raw_imu_t
00006 {
00007  uint64_t time_usec; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
00008  int16_t xacc; /*< X acceleration (raw)*/
00009  int16_t yacc; /*< Y acceleration (raw)*/
00010  int16_t zacc; /*< Z acceleration (raw)*/
00011  int16_t xgyro; /*< Angular speed around X axis (raw)*/
00012  int16_t ygyro; /*< Angular speed around Y axis (raw)*/
00013  int16_t zgyro; /*< Angular speed around Z axis (raw)*/
00014  int16_t xmag; /*< X Magnetic field (raw)*/
00015  int16_t ymag; /*< Y Magnetic field (raw)*/
00016  int16_t zmag; /*< Z Magnetic field (raw)*/
00017 } mavlink_raw_imu_t;
00018 
00019 #define MAVLINK_MSG_ID_RAW_IMU_LEN 26
00020 #define MAVLINK_MSG_ID_27_LEN 26
00021 
00022 #define MAVLINK_MSG_ID_RAW_IMU_CRC 144
00023 #define MAVLINK_MSG_ID_27_CRC 144
00024 
00025 
00026 
00027 #define MAVLINK_MESSAGE_INFO_RAW_IMU { \
00028         "RAW_IMU", \
00029         10, \
00030         {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_raw_imu_t, time_usec) }, \
00031          { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_raw_imu_t, xacc) }, \
00032          { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_raw_imu_t, yacc) }, \
00033          { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_raw_imu_t, zacc) }, \
00034          { "xgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_raw_imu_t, xgyro) }, \
00035          { "ygyro", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_raw_imu_t, ygyro) }, \
00036          { "zgyro", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_raw_imu_t, zgyro) }, \
00037          { "xmag", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_raw_imu_t, xmag) }, \
00038          { "ymag", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_raw_imu_t, ymag) }, \
00039          { "zmag", NULL, MAVLINK_TYPE_INT16_T, 0, 24, offsetof(mavlink_raw_imu_t, zmag) }, \
00040          } \
00041 }
00042 
00043 
00062 static inline uint16_t mavlink_msg_raw_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00063                                                        uint64_t time_usec, 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_RAW_IMU_LEN];
00067         _mav_put_uint64_t(buf, 0, time_usec);
00068         _mav_put_int16_t(buf, 8, xacc);
00069         _mav_put_int16_t(buf, 10, yacc);
00070         _mav_put_int16_t(buf, 12, zacc);
00071         _mav_put_int16_t(buf, 14, xgyro);
00072         _mav_put_int16_t(buf, 16, ygyro);
00073         _mav_put_int16_t(buf, 18, zgyro);
00074         _mav_put_int16_t(buf, 20, xmag);
00075         _mav_put_int16_t(buf, 22, ymag);
00076         _mav_put_int16_t(buf, 24, zmag);
00077 
00078         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_IMU_LEN);
00079 #else
00080         mavlink_raw_imu_t packet;
00081         packet.time_usec = time_usec;
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_RAW_IMU_LEN);
00093 #endif
00094 
00095         msg->msgid = MAVLINK_MSG_ID_RAW_IMU;
00096 #if MAVLINK_CRC_EXTRA
00097     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00098 #else
00099     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RAW_IMU_LEN);
00100 #endif
00101 }
00102 
00121 static inline uint16_t mavlink_msg_raw_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00122                                                            mavlink_message_t* msg,
00123                                                            uint64_t time_usec,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_RAW_IMU_LEN];
00127         _mav_put_uint64_t(buf, 0, time_usec);
00128         _mav_put_int16_t(buf, 8, xacc);
00129         _mav_put_int16_t(buf, 10, yacc);
00130         _mav_put_int16_t(buf, 12, zacc);
00131         _mav_put_int16_t(buf, 14, xgyro);
00132         _mav_put_int16_t(buf, 16, ygyro);
00133         _mav_put_int16_t(buf, 18, zgyro);
00134         _mav_put_int16_t(buf, 20, xmag);
00135         _mav_put_int16_t(buf, 22, ymag);
00136         _mav_put_int16_t(buf, 24, zmag);
00137 
00138         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RAW_IMU_LEN);
00139 #else
00140         mavlink_raw_imu_t packet;
00141         packet.time_usec = time_usec;
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_RAW_IMU_LEN);
00153 #endif
00154 
00155         msg->msgid = MAVLINK_MSG_ID_RAW_IMU;
00156 #if MAVLINK_CRC_EXTRA
00157     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00158 #else
00159     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RAW_IMU_LEN);
00160 #endif
00161 }
00162 
00171 static inline uint16_t mavlink_msg_raw_imu_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_raw_imu_t* raw_imu)
00172 {
00173         return mavlink_msg_raw_imu_pack(system_id, component_id, msg, raw_imu->time_usec, raw_imu->xacc, raw_imu->yacc, raw_imu->zacc, raw_imu->xgyro, raw_imu->ygyro, raw_imu->zgyro, raw_imu->xmag, raw_imu->ymag, raw_imu->zmag);
00174 }
00175 
00185 static inline uint16_t mavlink_msg_raw_imu_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_raw_imu_t* raw_imu)
00186 {
00187         return mavlink_msg_raw_imu_pack_chan(system_id, component_id, chan, msg, raw_imu->time_usec, raw_imu->xacc, raw_imu->yacc, raw_imu->zacc, raw_imu->xgyro, raw_imu->ygyro, raw_imu->zgyro, raw_imu->xmag, raw_imu->ymag, raw_imu->zmag);
00188 }
00189 
00205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00206 
00207 static inline void mavlink_msg_raw_imu_send(mavlink_channel_t chan, uint64_t time_usec, 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_RAW_IMU_LEN];
00211         _mav_put_uint64_t(buf, 0, time_usec);
00212         _mav_put_int16_t(buf, 8, xacc);
00213         _mav_put_int16_t(buf, 10, yacc);
00214         _mav_put_int16_t(buf, 12, zacc);
00215         _mav_put_int16_t(buf, 14, xgyro);
00216         _mav_put_int16_t(buf, 16, ygyro);
00217         _mav_put_int16_t(buf, 18, zgyro);
00218         _mav_put_int16_t(buf, 20, xmag);
00219         _mav_put_int16_t(buf, 22, ymag);
00220         _mav_put_int16_t(buf, 24, zmag);
00221 
00222 #if MAVLINK_CRC_EXTRA
00223     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, buf, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00224 #else
00225     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, buf, MAVLINK_MSG_ID_RAW_IMU_LEN);
00226 #endif
00227 #else
00228         mavlink_raw_imu_t packet;
00229         packet.time_usec = time_usec;
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_RAW_IMU, (const char *)&packet, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00242 #else
00243     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, (const char *)&packet, MAVLINK_MSG_ID_RAW_IMU_LEN);
00244 #endif
00245 #endif
00246 }
00247 
00248 #if MAVLINK_MSG_ID_RAW_IMU_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_raw_imu_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint64_t time_usec, 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_uint64_t(buf, 0, time_usec);
00261         _mav_put_int16_t(buf, 8, xacc);
00262         _mav_put_int16_t(buf, 10, yacc);
00263         _mav_put_int16_t(buf, 12, zacc);
00264         _mav_put_int16_t(buf, 14, xgyro);
00265         _mav_put_int16_t(buf, 16, ygyro);
00266         _mav_put_int16_t(buf, 18, zgyro);
00267         _mav_put_int16_t(buf, 20, xmag);
00268         _mav_put_int16_t(buf, 22, ymag);
00269         _mav_put_int16_t(buf, 24, zmag);
00270 
00271 #if MAVLINK_CRC_EXTRA
00272     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, buf, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00273 #else
00274     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, buf, MAVLINK_MSG_ID_RAW_IMU_LEN);
00275 #endif
00276 #else
00277         mavlink_raw_imu_t *packet = (mavlink_raw_imu_t *)msgbuf;
00278         packet->time_usec = time_usec;
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_RAW_IMU, (const char *)packet, MAVLINK_MSG_ID_RAW_IMU_LEN, MAVLINK_MSG_ID_RAW_IMU_CRC);
00291 #else
00292     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RAW_IMU, (const char *)packet, MAVLINK_MSG_ID_RAW_IMU_LEN);
00293 #endif
00294 #endif
00295 }
00296 #endif
00297 
00298 #endif
00299 
00300 // MESSAGE RAW_IMU UNPACKING
00301 
00302 
00308 static inline uint64_t mavlink_msg_raw_imu_get_time_usec(const mavlink_message_t* msg)
00309 {
00310         return _MAV_RETURN_uint64_t(msg,  0);
00311 }
00312 
00318 static inline int16_t mavlink_msg_raw_imu_get_xacc(const mavlink_message_t* msg)
00319 {
00320         return _MAV_RETURN_int16_t(msg,  8);
00321 }
00322 
00328 static inline int16_t mavlink_msg_raw_imu_get_yacc(const mavlink_message_t* msg)
00329 {
00330         return _MAV_RETURN_int16_t(msg,  10);
00331 }
00332 
00338 static inline int16_t mavlink_msg_raw_imu_get_zacc(const mavlink_message_t* msg)
00339 {
00340         return _MAV_RETURN_int16_t(msg,  12);
00341 }
00342 
00348 static inline int16_t mavlink_msg_raw_imu_get_xgyro(const mavlink_message_t* msg)
00349 {
00350         return _MAV_RETURN_int16_t(msg,  14);
00351 }
00352 
00358 static inline int16_t mavlink_msg_raw_imu_get_ygyro(const mavlink_message_t* msg)
00359 {
00360         return _MAV_RETURN_int16_t(msg,  16);
00361 }
00362 
00368 static inline int16_t mavlink_msg_raw_imu_get_zgyro(const mavlink_message_t* msg)
00369 {
00370         return _MAV_RETURN_int16_t(msg,  18);
00371 }
00372 
00378 static inline int16_t mavlink_msg_raw_imu_get_xmag(const mavlink_message_t* msg)
00379 {
00380         return _MAV_RETURN_int16_t(msg,  20);
00381 }
00382 
00388 static inline int16_t mavlink_msg_raw_imu_get_ymag(const mavlink_message_t* msg)
00389 {
00390         return _MAV_RETURN_int16_t(msg,  22);
00391 }
00392 
00398 static inline int16_t mavlink_msg_raw_imu_get_zmag(const mavlink_message_t* msg)
00399 {
00400         return _MAV_RETURN_int16_t(msg,  24);
00401 }
00402 
00409 static inline void mavlink_msg_raw_imu_decode(const mavlink_message_t* msg, mavlink_raw_imu_t* raw_imu)
00410 {
00411 #if MAVLINK_NEED_BYTE_SWAP
00412         raw_imu->time_usec = mavlink_msg_raw_imu_get_time_usec(msg);
00413         raw_imu->xacc = mavlink_msg_raw_imu_get_xacc(msg);
00414         raw_imu->yacc = mavlink_msg_raw_imu_get_yacc(msg);
00415         raw_imu->zacc = mavlink_msg_raw_imu_get_zacc(msg);
00416         raw_imu->xgyro = mavlink_msg_raw_imu_get_xgyro(msg);
00417         raw_imu->ygyro = mavlink_msg_raw_imu_get_ygyro(msg);
00418         raw_imu->zgyro = mavlink_msg_raw_imu_get_zgyro(msg);
00419         raw_imu->xmag = mavlink_msg_raw_imu_get_xmag(msg);
00420         raw_imu->ymag = mavlink_msg_raw_imu_get_ymag(msg);
00421         raw_imu->zmag = mavlink_msg_raw_imu_get_zmag(msg);
00422 #else
00423         memcpy(raw_imu, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_RAW_IMU_LEN);
00424 #endif
00425 }


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