mavlink_msg_highres_imu.h
Go to the documentation of this file.
00001 // MESSAGE HIGHRES_IMU PACKING
00002 
00003 #define MAVLINK_MSG_ID_HIGHRES_IMU 105
00004 
00005 typedef struct __mavlink_highres_imu_t
00006 {
00007  uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
00008  float xacc; /*< X acceleration (m/s^2)*/
00009  float yacc; /*< Y acceleration (m/s^2)*/
00010  float zacc; /*< Z acceleration (m/s^2)*/
00011  float xgyro; /*< Angular speed around X axis (rad / sec)*/
00012  float ygyro; /*< Angular speed around Y axis (rad / sec)*/
00013  float zgyro; /*< Angular speed around Z axis (rad / sec)*/
00014  float xmag; /*< X Magnetic field (Gauss)*/
00015  float ymag; /*< Y Magnetic field (Gauss)*/
00016  float zmag; /*< Z Magnetic field (Gauss)*/
00017  float abs_pressure; /*< Absolute pressure in millibar*/
00018  float diff_pressure; /*< Differential pressure in millibar*/
00019  float pressure_alt; /*< Altitude calculated from pressure*/
00020  float temperature; /*< Temperature in degrees celsius*/
00021  uint16_t fields_updated; /*< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature*/
00022 } mavlink_highres_imu_t;
00023 
00024 #define MAVLINK_MSG_ID_HIGHRES_IMU_LEN 62
00025 #define MAVLINK_MSG_ID_105_LEN 62
00026 
00027 #define MAVLINK_MSG_ID_HIGHRES_IMU_CRC 93
00028 #define MAVLINK_MSG_ID_105_CRC 93
00029 
00030 
00031 
00032 #define MAVLINK_MESSAGE_INFO_HIGHRES_IMU { \
00033         "HIGHRES_IMU", \
00034         15, \
00035         {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_highres_imu_t, time_usec) }, \
00036          { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_highres_imu_t, xacc) }, \
00037          { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_highres_imu_t, yacc) }, \
00038          { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_highres_imu_t, zacc) }, \
00039          { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_highres_imu_t, xgyro) }, \
00040          { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_highres_imu_t, ygyro) }, \
00041          { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_highres_imu_t, zgyro) }, \
00042          { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_highres_imu_t, xmag) }, \
00043          { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_highres_imu_t, ymag) }, \
00044          { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_highres_imu_t, zmag) }, \
00045          { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_highres_imu_t, abs_pressure) }, \
00046          { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_highres_imu_t, diff_pressure) }, \
00047          { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_highres_imu_t, pressure_alt) }, \
00048          { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_highres_imu_t, temperature) }, \
00049          { "fields_updated", NULL, MAVLINK_TYPE_UINT16_T, 0, 60, offsetof(mavlink_highres_imu_t, fields_updated) }, \
00050          } \
00051 }
00052 
00053 
00077 static inline uint16_t mavlink_msg_highres_imu_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00078                                                        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)
00079 {
00080 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00081         char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
00082         _mav_put_uint64_t(buf, 0, time_usec);
00083         _mav_put_float(buf, 8, xacc);
00084         _mav_put_float(buf, 12, yacc);
00085         _mav_put_float(buf, 16, zacc);
00086         _mav_put_float(buf, 20, xgyro);
00087         _mav_put_float(buf, 24, ygyro);
00088         _mav_put_float(buf, 28, zgyro);
00089         _mav_put_float(buf, 32, xmag);
00090         _mav_put_float(buf, 36, ymag);
00091         _mav_put_float(buf, 40, zmag);
00092         _mav_put_float(buf, 44, abs_pressure);
00093         _mav_put_float(buf, 48, diff_pressure);
00094         _mav_put_float(buf, 52, pressure_alt);
00095         _mav_put_float(buf, 56, temperature);
00096         _mav_put_uint16_t(buf, 60, fields_updated);
00097 
00098         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00099 #else
00100         mavlink_highres_imu_t packet;
00101         packet.time_usec = time_usec;
00102         packet.xacc = xacc;
00103         packet.yacc = yacc;
00104         packet.zacc = zacc;
00105         packet.xgyro = xgyro;
00106         packet.ygyro = ygyro;
00107         packet.zgyro = zgyro;
00108         packet.xmag = xmag;
00109         packet.ymag = ymag;
00110         packet.zmag = zmag;
00111         packet.abs_pressure = abs_pressure;
00112         packet.diff_pressure = diff_pressure;
00113         packet.pressure_alt = pressure_alt;
00114         packet.temperature = temperature;
00115         packet.fields_updated = fields_updated;
00116 
00117         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00118 #endif
00119 
00120         msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
00121 #if MAVLINK_CRC_EXTRA
00122     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00123 #else
00124     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00125 #endif
00126 }
00127 
00151 static inline uint16_t mavlink_msg_highres_imu_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00152                                                            mavlink_message_t* msg,
00153                                                            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)
00154 {
00155 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00156         char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
00157         _mav_put_uint64_t(buf, 0, time_usec);
00158         _mav_put_float(buf, 8, xacc);
00159         _mav_put_float(buf, 12, yacc);
00160         _mav_put_float(buf, 16, zacc);
00161         _mav_put_float(buf, 20, xgyro);
00162         _mav_put_float(buf, 24, ygyro);
00163         _mav_put_float(buf, 28, zgyro);
00164         _mav_put_float(buf, 32, xmag);
00165         _mav_put_float(buf, 36, ymag);
00166         _mav_put_float(buf, 40, zmag);
00167         _mav_put_float(buf, 44, abs_pressure);
00168         _mav_put_float(buf, 48, diff_pressure);
00169         _mav_put_float(buf, 52, pressure_alt);
00170         _mav_put_float(buf, 56, temperature);
00171         _mav_put_uint16_t(buf, 60, fields_updated);
00172 
00173         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00174 #else
00175         mavlink_highres_imu_t packet;
00176         packet.time_usec = time_usec;
00177         packet.xacc = xacc;
00178         packet.yacc = yacc;
00179         packet.zacc = zacc;
00180         packet.xgyro = xgyro;
00181         packet.ygyro = ygyro;
00182         packet.zgyro = zgyro;
00183         packet.xmag = xmag;
00184         packet.ymag = ymag;
00185         packet.zmag = zmag;
00186         packet.abs_pressure = abs_pressure;
00187         packet.diff_pressure = diff_pressure;
00188         packet.pressure_alt = pressure_alt;
00189         packet.temperature = temperature;
00190         packet.fields_updated = fields_updated;
00191 
00192         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00193 #endif
00194 
00195         msg->msgid = MAVLINK_MSG_ID_HIGHRES_IMU;
00196 #if MAVLINK_CRC_EXTRA
00197     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00198 #else
00199     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00200 #endif
00201 }
00202 
00211 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)
00212 {
00213         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);
00214 }
00215 
00225 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)
00226 {
00227         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);
00228 }
00229 
00250 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00251 
00252 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)
00253 {
00254 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00255         char buf[MAVLINK_MSG_ID_HIGHRES_IMU_LEN];
00256         _mav_put_uint64_t(buf, 0, time_usec);
00257         _mav_put_float(buf, 8, xacc);
00258         _mav_put_float(buf, 12, yacc);
00259         _mav_put_float(buf, 16, zacc);
00260         _mav_put_float(buf, 20, xgyro);
00261         _mav_put_float(buf, 24, ygyro);
00262         _mav_put_float(buf, 28, zgyro);
00263         _mav_put_float(buf, 32, xmag);
00264         _mav_put_float(buf, 36, ymag);
00265         _mav_put_float(buf, 40, zmag);
00266         _mav_put_float(buf, 44, abs_pressure);
00267         _mav_put_float(buf, 48, diff_pressure);
00268         _mav_put_float(buf, 52, pressure_alt);
00269         _mav_put_float(buf, 56, temperature);
00270         _mav_put_uint16_t(buf, 60, fields_updated);
00271 
00272 #if MAVLINK_CRC_EXTRA
00273     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00274 #else
00275     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00276 #endif
00277 #else
00278         mavlink_highres_imu_t packet;
00279         packet.time_usec = time_usec;
00280         packet.xacc = xacc;
00281         packet.yacc = yacc;
00282         packet.zacc = zacc;
00283         packet.xgyro = xgyro;
00284         packet.ygyro = ygyro;
00285         packet.zgyro = zgyro;
00286         packet.xmag = xmag;
00287         packet.ymag = ymag;
00288         packet.zmag = zmag;
00289         packet.abs_pressure = abs_pressure;
00290         packet.diff_pressure = diff_pressure;
00291         packet.pressure_alt = pressure_alt;
00292         packet.temperature = temperature;
00293         packet.fields_updated = fields_updated;
00294 
00295 #if MAVLINK_CRC_EXTRA
00296     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00297 #else
00298     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)&packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00299 #endif
00300 #endif
00301 }
00302 
00303 #if MAVLINK_MSG_ID_HIGHRES_IMU_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00304 /*
00305   This varient of _send() can be used to save stack space by re-using
00306   memory from the receive buffer.  The caller provides a
00307   mavlink_message_t which is the size of a full mavlink message. This
00308   is usually the receive buffer for the channel, and allows a reply to an
00309   incoming message with minimum stack space usage.
00310  */
00311 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)
00312 {
00313 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00314         char *buf = (char *)msgbuf;
00315         _mav_put_uint64_t(buf, 0, time_usec);
00316         _mav_put_float(buf, 8, xacc);
00317         _mav_put_float(buf, 12, yacc);
00318         _mav_put_float(buf, 16, zacc);
00319         _mav_put_float(buf, 20, xgyro);
00320         _mav_put_float(buf, 24, ygyro);
00321         _mav_put_float(buf, 28, zgyro);
00322         _mav_put_float(buf, 32, xmag);
00323         _mav_put_float(buf, 36, ymag);
00324         _mav_put_float(buf, 40, zmag);
00325         _mav_put_float(buf, 44, abs_pressure);
00326         _mav_put_float(buf, 48, diff_pressure);
00327         _mav_put_float(buf, 52, pressure_alt);
00328         _mav_put_float(buf, 56, temperature);
00329         _mav_put_uint16_t(buf, 60, fields_updated);
00330 
00331 #if MAVLINK_CRC_EXTRA
00332     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00333 #else
00334     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, buf, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00335 #endif
00336 #else
00337         mavlink_highres_imu_t *packet = (mavlink_highres_imu_t *)msgbuf;
00338         packet->time_usec = time_usec;
00339         packet->xacc = xacc;
00340         packet->yacc = yacc;
00341         packet->zacc = zacc;
00342         packet->xgyro = xgyro;
00343         packet->ygyro = ygyro;
00344         packet->zgyro = zgyro;
00345         packet->xmag = xmag;
00346         packet->ymag = ymag;
00347         packet->zmag = zmag;
00348         packet->abs_pressure = abs_pressure;
00349         packet->diff_pressure = diff_pressure;
00350         packet->pressure_alt = pressure_alt;
00351         packet->temperature = temperature;
00352         packet->fields_updated = fields_updated;
00353 
00354 #if MAVLINK_CRC_EXTRA
00355     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN, MAVLINK_MSG_ID_HIGHRES_IMU_CRC);
00356 #else
00357     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGHRES_IMU, (const char *)packet, MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00358 #endif
00359 #endif
00360 }
00361 #endif
00362 
00363 #endif
00364 
00365 // MESSAGE HIGHRES_IMU UNPACKING
00366 
00367 
00373 static inline uint64_t mavlink_msg_highres_imu_get_time_usec(const mavlink_message_t* msg)
00374 {
00375         return _MAV_RETURN_uint64_t(msg,  0);
00376 }
00377 
00383 static inline float mavlink_msg_highres_imu_get_xacc(const mavlink_message_t* msg)
00384 {
00385         return _MAV_RETURN_float(msg,  8);
00386 }
00387 
00393 static inline float mavlink_msg_highres_imu_get_yacc(const mavlink_message_t* msg)
00394 {
00395         return _MAV_RETURN_float(msg,  12);
00396 }
00397 
00403 static inline float mavlink_msg_highres_imu_get_zacc(const mavlink_message_t* msg)
00404 {
00405         return _MAV_RETURN_float(msg,  16);
00406 }
00407 
00413 static inline float mavlink_msg_highres_imu_get_xgyro(const mavlink_message_t* msg)
00414 {
00415         return _MAV_RETURN_float(msg,  20);
00416 }
00417 
00423 static inline float mavlink_msg_highres_imu_get_ygyro(const mavlink_message_t* msg)
00424 {
00425         return _MAV_RETURN_float(msg,  24);
00426 }
00427 
00433 static inline float mavlink_msg_highres_imu_get_zgyro(const mavlink_message_t* msg)
00434 {
00435         return _MAV_RETURN_float(msg,  28);
00436 }
00437 
00443 static inline float mavlink_msg_highres_imu_get_xmag(const mavlink_message_t* msg)
00444 {
00445         return _MAV_RETURN_float(msg,  32);
00446 }
00447 
00453 static inline float mavlink_msg_highres_imu_get_ymag(const mavlink_message_t* msg)
00454 {
00455         return _MAV_RETURN_float(msg,  36);
00456 }
00457 
00463 static inline float mavlink_msg_highres_imu_get_zmag(const mavlink_message_t* msg)
00464 {
00465         return _MAV_RETURN_float(msg,  40);
00466 }
00467 
00473 static inline float mavlink_msg_highres_imu_get_abs_pressure(const mavlink_message_t* msg)
00474 {
00475         return _MAV_RETURN_float(msg,  44);
00476 }
00477 
00483 static inline float mavlink_msg_highres_imu_get_diff_pressure(const mavlink_message_t* msg)
00484 {
00485         return _MAV_RETURN_float(msg,  48);
00486 }
00487 
00493 static inline float mavlink_msg_highres_imu_get_pressure_alt(const mavlink_message_t* msg)
00494 {
00495         return _MAV_RETURN_float(msg,  52);
00496 }
00497 
00503 static inline float mavlink_msg_highres_imu_get_temperature(const mavlink_message_t* msg)
00504 {
00505         return _MAV_RETURN_float(msg,  56);
00506 }
00507 
00513 static inline uint16_t mavlink_msg_highres_imu_get_fields_updated(const mavlink_message_t* msg)
00514 {
00515         return _MAV_RETURN_uint16_t(msg,  60);
00516 }
00517 
00524 static inline void mavlink_msg_highres_imu_decode(const mavlink_message_t* msg, mavlink_highres_imu_t* highres_imu)
00525 {
00526 #if MAVLINK_NEED_BYTE_SWAP
00527         highres_imu->time_usec = mavlink_msg_highres_imu_get_time_usec(msg);
00528         highres_imu->xacc = mavlink_msg_highres_imu_get_xacc(msg);
00529         highres_imu->yacc = mavlink_msg_highres_imu_get_yacc(msg);
00530         highres_imu->zacc = mavlink_msg_highres_imu_get_zacc(msg);
00531         highres_imu->xgyro = mavlink_msg_highres_imu_get_xgyro(msg);
00532         highres_imu->ygyro = mavlink_msg_highres_imu_get_ygyro(msg);
00533         highres_imu->zgyro = mavlink_msg_highres_imu_get_zgyro(msg);
00534         highres_imu->xmag = mavlink_msg_highres_imu_get_xmag(msg);
00535         highres_imu->ymag = mavlink_msg_highres_imu_get_ymag(msg);
00536         highres_imu->zmag = mavlink_msg_highres_imu_get_zmag(msg);
00537         highres_imu->abs_pressure = mavlink_msg_highres_imu_get_abs_pressure(msg);
00538         highres_imu->diff_pressure = mavlink_msg_highres_imu_get_diff_pressure(msg);
00539         highres_imu->pressure_alt = mavlink_msg_highres_imu_get_pressure_alt(msg);
00540         highres_imu->temperature = mavlink_msg_highres_imu_get_temperature(msg);
00541         highres_imu->fields_updated = mavlink_msg_highres_imu_get_fields_updated(msg);
00542 #else
00543         memcpy(highres_imu, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIGHRES_IMU_LEN);
00544 #endif
00545 }


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