mavlink_msg_attitude_target.h
Go to the documentation of this file.
00001 // MESSAGE ATTITUDE_TARGET PACKING
00002 
00003 #define MAVLINK_MSG_ID_ATTITUDE_TARGET 83
00004 
00005 typedef struct __mavlink_attitude_target_t
00006 {
00007  uint32_t time_boot_ms; /*< Timestamp in milliseconds since system boot*/
00008  float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
00009  float body_roll_rate; /*< Body roll rate in radians per second*/
00010  float body_pitch_rate; /*< Body roll rate in radians per second*/
00011  float body_yaw_rate; /*< Body roll rate in radians per second*/
00012  float thrust; /*< Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)*/
00013  uint8_t type_mask; /*< Mappings: If any of these bits are set, the corresponding input should be ignored: bit 1: body roll rate, bit 2: body pitch rate, bit 3: body yaw rate. bit 4-bit 7: reserved, bit 8: attitude*/
00014 } mavlink_attitude_target_t;
00015 
00016 #define MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN 37
00017 #define MAVLINK_MSG_ID_83_LEN 37
00018 
00019 #define MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC 22
00020 #define MAVLINK_MSG_ID_83_CRC 22
00021 
00022 #define MAVLINK_MSG_ATTITUDE_TARGET_FIELD_Q_LEN 4
00023 
00024 #define MAVLINK_MESSAGE_INFO_ATTITUDE_TARGET { \
00025         "ATTITUDE_TARGET", \
00026         7, \
00027         {  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_target_t, time_boot_ms) }, \
00028          { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_attitude_target_t, q) }, \
00029          { "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_target_t, body_roll_rate) }, \
00030          { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_target_t, body_pitch_rate) }, \
00031          { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_target_t, body_yaw_rate) }, \
00032          { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_attitude_target_t, thrust) }, \
00033          { "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_attitude_target_t, type_mask) }, \
00034          } \
00035 }
00036 
00037 
00053 static inline uint16_t mavlink_msg_attitude_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00054                                                        uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
00055 {
00056 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00057         char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
00058         _mav_put_uint32_t(buf, 0, time_boot_ms);
00059         _mav_put_float(buf, 20, body_roll_rate);
00060         _mav_put_float(buf, 24, body_pitch_rate);
00061         _mav_put_float(buf, 28, body_yaw_rate);
00062         _mav_put_float(buf, 32, thrust);
00063         _mav_put_uint8_t(buf, 36, type_mask);
00064         _mav_put_float_array(buf, 4, q, 4);
00065         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00066 #else
00067         mavlink_attitude_target_t packet;
00068         packet.time_boot_ms = time_boot_ms;
00069         packet.body_roll_rate = body_roll_rate;
00070         packet.body_pitch_rate = body_pitch_rate;
00071         packet.body_yaw_rate = body_yaw_rate;
00072         packet.thrust = thrust;
00073         packet.type_mask = type_mask;
00074         mav_array_memcpy(packet.q, q, sizeof(float)*4);
00075         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00076 #endif
00077 
00078         msg->msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET;
00079 #if MAVLINK_CRC_EXTRA
00080     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00081 #else
00082     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00083 #endif
00084 }
00085 
00101 static inline uint16_t mavlink_msg_attitude_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00102                                                            mavlink_message_t* msg,
00103                                                            uint32_t time_boot_ms,uint8_t type_mask,const float *q,float body_roll_rate,float body_pitch_rate,float body_yaw_rate,float thrust)
00104 {
00105 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00106         char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
00107         _mav_put_uint32_t(buf, 0, time_boot_ms);
00108         _mav_put_float(buf, 20, body_roll_rate);
00109         _mav_put_float(buf, 24, body_pitch_rate);
00110         _mav_put_float(buf, 28, body_yaw_rate);
00111         _mav_put_float(buf, 32, thrust);
00112         _mav_put_uint8_t(buf, 36, type_mask);
00113         _mav_put_float_array(buf, 4, q, 4);
00114         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00115 #else
00116         mavlink_attitude_target_t packet;
00117         packet.time_boot_ms = time_boot_ms;
00118         packet.body_roll_rate = body_roll_rate;
00119         packet.body_pitch_rate = body_pitch_rate;
00120         packet.body_yaw_rate = body_yaw_rate;
00121         packet.thrust = thrust;
00122         packet.type_mask = type_mask;
00123         mav_array_memcpy(packet.q, q, sizeof(float)*4);
00124         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00125 #endif
00126 
00127         msg->msgid = MAVLINK_MSG_ID_ATTITUDE_TARGET;
00128 #if MAVLINK_CRC_EXTRA
00129     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00130 #else
00131     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00132 #endif
00133 }
00134 
00143 static inline uint16_t mavlink_msg_attitude_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_target_t* attitude_target)
00144 {
00145         return mavlink_msg_attitude_target_pack(system_id, component_id, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust);
00146 }
00147 
00157 static inline uint16_t mavlink_msg_attitude_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_target_t* attitude_target)
00158 {
00159         return mavlink_msg_attitude_target_pack_chan(system_id, component_id, chan, msg, attitude_target->time_boot_ms, attitude_target->type_mask, attitude_target->q, attitude_target->body_roll_rate, attitude_target->body_pitch_rate, attitude_target->body_yaw_rate, attitude_target->thrust);
00160 }
00161 
00174 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00175 
00176 static inline void mavlink_msg_attitude_target_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
00177 {
00178 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00179         char buf[MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN];
00180         _mav_put_uint32_t(buf, 0, time_boot_ms);
00181         _mav_put_float(buf, 20, body_roll_rate);
00182         _mav_put_float(buf, 24, body_pitch_rate);
00183         _mav_put_float(buf, 28, body_yaw_rate);
00184         _mav_put_float(buf, 32, thrust);
00185         _mav_put_uint8_t(buf, 36, type_mask);
00186         _mav_put_float_array(buf, 4, q, 4);
00187 #if MAVLINK_CRC_EXTRA
00188     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00189 #else
00190     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00191 #endif
00192 #else
00193         mavlink_attitude_target_t packet;
00194         packet.time_boot_ms = time_boot_ms;
00195         packet.body_roll_rate = body_roll_rate;
00196         packet.body_pitch_rate = body_pitch_rate;
00197         packet.body_yaw_rate = body_yaw_rate;
00198         packet.thrust = thrust;
00199         packet.type_mask = type_mask;
00200         mav_array_memcpy(packet.q, q, sizeof(float)*4);
00201 #if MAVLINK_CRC_EXTRA
00202     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00203 #else
00204     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00205 #endif
00206 #endif
00207 }
00208 
00209 #if MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00210 /*
00211   This varient of _send() can be used to save stack space by re-using
00212   memory from the receive buffer.  The caller provides a
00213   mavlink_message_t which is the size of a full mavlink message. This
00214   is usually the receive buffer for the channel, and allows a reply to an
00215   incoming message with minimum stack space usage.
00216  */
00217 static inline void mavlink_msg_attitude_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
00218 {
00219 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00220         char *buf = (char *)msgbuf;
00221         _mav_put_uint32_t(buf, 0, time_boot_ms);
00222         _mav_put_float(buf, 20, body_roll_rate);
00223         _mav_put_float(buf, 24, body_pitch_rate);
00224         _mav_put_float(buf, 28, body_yaw_rate);
00225         _mav_put_float(buf, 32, thrust);
00226         _mav_put_uint8_t(buf, 36, type_mask);
00227         _mav_put_float_array(buf, 4, q, 4);
00228 #if MAVLINK_CRC_EXTRA
00229     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00230 #else
00231     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00232 #endif
00233 #else
00234         mavlink_attitude_target_t *packet = (mavlink_attitude_target_t *)msgbuf;
00235         packet->time_boot_ms = time_boot_ms;
00236         packet->body_roll_rate = body_roll_rate;
00237         packet->body_pitch_rate = body_pitch_rate;
00238         packet->body_yaw_rate = body_yaw_rate;
00239         packet->thrust = thrust;
00240         packet->type_mask = type_mask;
00241         mav_array_memcpy(packet->q, q, sizeof(float)*4);
00242 #if MAVLINK_CRC_EXTRA
00243     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_ATTITUDE_TARGET_CRC);
00244 #else
00245     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00246 #endif
00247 #endif
00248 }
00249 #endif
00250 
00251 #endif
00252 
00253 // MESSAGE ATTITUDE_TARGET UNPACKING
00254 
00255 
00261 static inline uint32_t mavlink_msg_attitude_target_get_time_boot_ms(const mavlink_message_t* msg)
00262 {
00263         return _MAV_RETURN_uint32_t(msg,  0);
00264 }
00265 
00271 static inline uint8_t mavlink_msg_attitude_target_get_type_mask(const mavlink_message_t* msg)
00272 {
00273         return _MAV_RETURN_uint8_t(msg,  36);
00274 }
00275 
00281 static inline uint16_t mavlink_msg_attitude_target_get_q(const mavlink_message_t* msg, float *q)
00282 {
00283         return _MAV_RETURN_float_array(msg, q, 4,  4);
00284 }
00285 
00291 static inline float mavlink_msg_attitude_target_get_body_roll_rate(const mavlink_message_t* msg)
00292 {
00293         return _MAV_RETURN_float(msg,  20);
00294 }
00295 
00301 static inline float mavlink_msg_attitude_target_get_body_pitch_rate(const mavlink_message_t* msg)
00302 {
00303         return _MAV_RETURN_float(msg,  24);
00304 }
00305 
00311 static inline float mavlink_msg_attitude_target_get_body_yaw_rate(const mavlink_message_t* msg)
00312 {
00313         return _MAV_RETURN_float(msg,  28);
00314 }
00315 
00321 static inline float mavlink_msg_attitude_target_get_thrust(const mavlink_message_t* msg)
00322 {
00323         return _MAV_RETURN_float(msg,  32);
00324 }
00325 
00332 static inline void mavlink_msg_attitude_target_decode(const mavlink_message_t* msg, mavlink_attitude_target_t* attitude_target)
00333 {
00334 #if MAVLINK_NEED_BYTE_SWAP
00335         attitude_target->time_boot_ms = mavlink_msg_attitude_target_get_time_boot_ms(msg);
00336         mavlink_msg_attitude_target_get_q(msg, attitude_target->q);
00337         attitude_target->body_roll_rate = mavlink_msg_attitude_target_get_body_roll_rate(msg);
00338         attitude_target->body_pitch_rate = mavlink_msg_attitude_target_get_body_pitch_rate(msg);
00339         attitude_target->body_yaw_rate = mavlink_msg_attitude_target_get_body_yaw_rate(msg);
00340         attitude_target->thrust = mavlink_msg_attitude_target_get_thrust(msg);
00341         attitude_target->type_mask = mavlink_msg_attitude_target_get_type_mask(msg);
00342 #else
00343         memcpy(attitude_target, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_TARGET_LEN);
00344 #endif
00345 }


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