[324] | 1 | // MESSAGE SET_ATTITUDE_TARGET PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET 82
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_set_attitude_target_t
|
---|
| 6 | {
|
---|
| 7 | uint32_t time_boot_ms; /*< Timestamp in milliseconds since system boot*/
|
---|
| 8 | float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)*/
|
---|
| 9 | float body_roll_rate; /*< Body roll rate in radians per second*/
|
---|
| 10 | float body_pitch_rate; /*< Body roll rate in radians per second*/
|
---|
| 11 | float body_yaw_rate; /*< Body roll rate in radians per second*/
|
---|
| 12 | float thrust; /*< Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)*/
|
---|
| 13 | uint8_t target_system; /*< System ID*/
|
---|
| 14 | uint8_t target_component; /*< Component ID*/
|
---|
| 15 | 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 6: reserved, bit 7: throttle, bit 8: attitude*/
|
---|
| 16 | } mavlink_set_attitude_target_t;
|
---|
| 17 |
|
---|
| 18 | #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN 39
|
---|
| 19 | #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN 39
|
---|
| 20 | #define MAVLINK_MSG_ID_82_LEN 39
|
---|
| 21 | #define MAVLINK_MSG_ID_82_MIN_LEN 39
|
---|
| 22 |
|
---|
| 23 | #define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC 49
|
---|
| 24 | #define MAVLINK_MSG_ID_82_CRC 49
|
---|
| 25 |
|
---|
| 26 | #define MAVLINK_MSG_SET_ATTITUDE_TARGET_FIELD_Q_LEN 4
|
---|
| 27 |
|
---|
| 28 | #if MAVLINK_COMMAND_24BIT
|
---|
| 29 | #define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET { \
|
---|
| 30 | 82, \
|
---|
| 31 | "SET_ATTITUDE_TARGET", \
|
---|
| 32 | 9, \
|
---|
| 33 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) }, \
|
---|
| 34 | { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_set_attitude_target_t, q) }, \
|
---|
| 35 | { "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_attitude_target_t, body_roll_rate) }, \
|
---|
| 36 | { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) }, \
|
---|
| 37 | { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) }, \
|
---|
| 38 | { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) }, \
|
---|
| 39 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) }, \
|
---|
| 40 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) }, \
|
---|
| 41 | { "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_set_attitude_target_t, type_mask) }, \
|
---|
| 42 | } \
|
---|
| 43 | }
|
---|
| 44 | #else
|
---|
| 45 | #define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET { \
|
---|
| 46 | "SET_ATTITUDE_TARGET", \
|
---|
| 47 | 9, \
|
---|
| 48 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) }, \
|
---|
| 49 | { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_set_attitude_target_t, q) }, \
|
---|
| 50 | { "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_attitude_target_t, body_roll_rate) }, \
|
---|
| 51 | { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) }, \
|
---|
| 52 | { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) }, \
|
---|
| 53 | { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) }, \
|
---|
| 54 | { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) }, \
|
---|
| 55 | { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) }, \
|
---|
| 56 | { "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_set_attitude_target_t, type_mask) }, \
|
---|
| 57 | } \
|
---|
| 58 | }
|
---|
| 59 | #endif
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * @brief Pack a set_attitude_target message
|
---|
| 63 | * @param system_id ID of this system
|
---|
| 64 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 65 | * @param msg The MAVLink message to compress the data into
|
---|
| 66 | *
|
---|
| 67 | * @param time_boot_ms Timestamp in milliseconds since system boot
|
---|
| 68 | * @param target_system System ID
|
---|
| 69 | * @param target_component Component ID
|
---|
| 70 | * @param 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 6: reserved, bit 7: throttle, bit 8: attitude
|
---|
| 71 | * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
|
---|
| 72 | * @param body_roll_rate Body roll rate in radians per second
|
---|
| 73 | * @param body_pitch_rate Body roll rate in radians per second
|
---|
| 74 | * @param body_yaw_rate Body roll rate in radians per second
|
---|
| 75 | * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
|
---|
| 76 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 77 | */
|
---|
| 78 | static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 79 | uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
|
---|
| 80 | {
|
---|
| 81 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 82 | char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN];
|
---|
| 83 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 84 | _mav_put_float(buf, 20, body_roll_rate);
|
---|
| 85 | _mav_put_float(buf, 24, body_pitch_rate);
|
---|
| 86 | _mav_put_float(buf, 28, body_yaw_rate);
|
---|
| 87 | _mav_put_float(buf, 32, thrust);
|
---|
| 88 | _mav_put_uint8_t(buf, 36, target_system);
|
---|
| 89 | _mav_put_uint8_t(buf, 37, target_component);
|
---|
| 90 | _mav_put_uint8_t(buf, 38, type_mask);
|
---|
| 91 | _mav_put_float_array(buf, 4, q, 4);
|
---|
| 92 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
|
---|
| 93 | #else
|
---|
| 94 | mavlink_set_attitude_target_t packet;
|
---|
| 95 | packet.time_boot_ms = time_boot_ms;
|
---|
| 96 | packet.body_roll_rate = body_roll_rate;
|
---|
| 97 | packet.body_pitch_rate = body_pitch_rate;
|
---|
| 98 | packet.body_yaw_rate = body_yaw_rate;
|
---|
| 99 | packet.thrust = thrust;
|
---|
| 100 | packet.target_system = target_system;
|
---|
| 101 | packet.target_component = target_component;
|
---|
| 102 | packet.type_mask = type_mask;
|
---|
| 103 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 104 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
|
---|
| 105 | #endif
|
---|
| 106 |
|
---|
| 107 | msg->msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET;
|
---|
| 108 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | /**
|
---|
| 112 | * @brief Pack a set_attitude_target message on a channel
|
---|
| 113 | * @param system_id ID of this system
|
---|
| 114 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 115 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 116 | * @param msg The MAVLink message to compress the data into
|
---|
| 117 | * @param time_boot_ms Timestamp in milliseconds since system boot
|
---|
| 118 | * @param target_system System ID
|
---|
| 119 | * @param target_component Component ID
|
---|
| 120 | * @param 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 6: reserved, bit 7: throttle, bit 8: attitude
|
---|
| 121 | * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
|
---|
| 122 | * @param body_roll_rate Body roll rate in radians per second
|
---|
| 123 | * @param body_pitch_rate Body roll rate in radians per second
|
---|
| 124 | * @param body_yaw_rate Body roll rate in radians per second
|
---|
| 125 | * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
|
---|
| 126 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 127 | */
|
---|
| 128 | static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 129 | mavlink_message_t* msg,
|
---|
| 130 | uint32_t time_boot_ms,uint8_t target_system,uint8_t target_component,uint8_t type_mask,const float *q,float body_roll_rate,float body_pitch_rate,float body_yaw_rate,float thrust)
|
---|
| 131 | {
|
---|
| 132 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 133 | char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN];
|
---|
| 134 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 135 | _mav_put_float(buf, 20, body_roll_rate);
|
---|
| 136 | _mav_put_float(buf, 24, body_pitch_rate);
|
---|
| 137 | _mav_put_float(buf, 28, body_yaw_rate);
|
---|
| 138 | _mav_put_float(buf, 32, thrust);
|
---|
| 139 | _mav_put_uint8_t(buf, 36, target_system);
|
---|
| 140 | _mav_put_uint8_t(buf, 37, target_component);
|
---|
| 141 | _mav_put_uint8_t(buf, 38, type_mask);
|
---|
| 142 | _mav_put_float_array(buf, 4, q, 4);
|
---|
| 143 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
|
---|
| 144 | #else
|
---|
| 145 | mavlink_set_attitude_target_t packet;
|
---|
| 146 | packet.time_boot_ms = time_boot_ms;
|
---|
| 147 | packet.body_roll_rate = body_roll_rate;
|
---|
| 148 | packet.body_pitch_rate = body_pitch_rate;
|
---|
| 149 | packet.body_yaw_rate = body_yaw_rate;
|
---|
| 150 | packet.thrust = thrust;
|
---|
| 151 | packet.target_system = target_system;
|
---|
| 152 | packet.target_component = target_component;
|
---|
| 153 | packet.type_mask = type_mask;
|
---|
| 154 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 155 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
| 158 | msg->msgid = MAVLINK_MSG_ID_SET_ATTITUDE_TARGET;
|
---|
| 159 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | /**
|
---|
| 163 | * @brief Encode a set_attitude_target struct
|
---|
| 164 | *
|
---|
| 165 | * @param system_id ID of this system
|
---|
| 166 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 167 | * @param msg The MAVLink message to compress the data into
|
---|
| 168 | * @param set_attitude_target C-struct to read the message contents from
|
---|
| 169 | */
|
---|
| 170 | static inline uint16_t mavlink_msg_set_attitude_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target)
|
---|
| 171 | {
|
---|
| 172 | return mavlink_msg_set_attitude_target_pack(system_id, component_id, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | /**
|
---|
| 176 | * @brief Encode a set_attitude_target struct on a channel
|
---|
| 177 | *
|
---|
| 178 | * @param system_id ID of this system
|
---|
| 179 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 180 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 181 | * @param msg The MAVLink message to compress the data into
|
---|
| 182 | * @param set_attitude_target C-struct to read the message contents from
|
---|
| 183 | */
|
---|
| 184 | static inline uint16_t mavlink_msg_set_attitude_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target)
|
---|
| 185 | {
|
---|
| 186 | return mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, chan, msg, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust);
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | /**
|
---|
| 190 | * @brief Send a set_attitude_target message
|
---|
| 191 | * @param chan MAVLink channel to send the message
|
---|
| 192 | *
|
---|
| 193 | * @param time_boot_ms Timestamp in milliseconds since system boot
|
---|
| 194 | * @param target_system System ID
|
---|
| 195 | * @param target_component Component ID
|
---|
| 196 | * @param 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 6: reserved, bit 7: throttle, bit 8: attitude
|
---|
| 197 | * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
|
---|
| 198 | * @param body_roll_rate Body roll rate in radians per second
|
---|
| 199 | * @param body_pitch_rate Body roll rate in radians per second
|
---|
| 200 | * @param body_yaw_rate Body roll rate in radians per second
|
---|
| 201 | * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
|
---|
| 202 | */
|
---|
| 203 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 204 |
|
---|
| 205 | static inline void mavlink_msg_set_attitude_target_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
|
---|
| 206 | {
|
---|
| 207 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 208 | char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN];
|
---|
| 209 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 210 | _mav_put_float(buf, 20, body_roll_rate);
|
---|
| 211 | _mav_put_float(buf, 24, body_pitch_rate);
|
---|
| 212 | _mav_put_float(buf, 28, body_yaw_rate);
|
---|
| 213 | _mav_put_float(buf, 32, thrust);
|
---|
| 214 | _mav_put_uint8_t(buf, 36, target_system);
|
---|
| 215 | _mav_put_uint8_t(buf, 37, target_component);
|
---|
| 216 | _mav_put_uint8_t(buf, 38, type_mask);
|
---|
| 217 | _mav_put_float_array(buf, 4, q, 4);
|
---|
| 218 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 219 | #else
|
---|
| 220 | mavlink_set_attitude_target_t packet;
|
---|
| 221 | packet.time_boot_ms = time_boot_ms;
|
---|
| 222 | packet.body_roll_rate = body_roll_rate;
|
---|
| 223 | packet.body_pitch_rate = body_pitch_rate;
|
---|
| 224 | packet.body_yaw_rate = body_yaw_rate;
|
---|
| 225 | packet.thrust = thrust;
|
---|
| 226 | packet.target_system = target_system;
|
---|
| 227 | packet.target_component = target_component;
|
---|
| 228 | packet.type_mask = type_mask;
|
---|
| 229 | mav_array_memcpy(packet.q, q, sizeof(float)*4);
|
---|
| 230 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)&packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 231 | #endif
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | /**
|
---|
| 235 | * @brief Send a set_attitude_target message
|
---|
| 236 | * @param chan MAVLink channel to send the message
|
---|
| 237 | * @param struct The MAVLink struct to serialize
|
---|
| 238 | */
|
---|
| 239 | static inline void mavlink_msg_set_attitude_target_send_struct(mavlink_channel_t chan, const mavlink_set_attitude_target_t* set_attitude_target)
|
---|
| 240 | {
|
---|
| 241 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 242 | mavlink_msg_set_attitude_target_send(chan, set_attitude_target->time_boot_ms, set_attitude_target->target_system, set_attitude_target->target_component, set_attitude_target->type_mask, set_attitude_target->q, set_attitude_target->body_roll_rate, set_attitude_target->body_pitch_rate, set_attitude_target->body_yaw_rate, set_attitude_target->thrust);
|
---|
| 243 | #else
|
---|
| 244 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)set_attitude_target, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 245 | #endif
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | #if MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 249 | /*
|
---|
| 250 | This varient of _send() can be used to save stack space by re-using
|
---|
| 251 | memory from the receive buffer. The caller provides a
|
---|
| 252 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 253 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 254 | incoming message with minimum stack space usage.
|
---|
| 255 | */
|
---|
| 256 | static inline void mavlink_msg_set_attitude_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, uint8_t type_mask, const float *q, float body_roll_rate, float body_pitch_rate, float body_yaw_rate, float thrust)
|
---|
| 257 | {
|
---|
| 258 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 259 | char *buf = (char *)msgbuf;
|
---|
| 260 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 261 | _mav_put_float(buf, 20, body_roll_rate);
|
---|
| 262 | _mav_put_float(buf, 24, body_pitch_rate);
|
---|
| 263 | _mav_put_float(buf, 28, body_yaw_rate);
|
---|
| 264 | _mav_put_float(buf, 32, thrust);
|
---|
| 265 | _mav_put_uint8_t(buf, 36, target_system);
|
---|
| 266 | _mav_put_uint8_t(buf, 37, target_component);
|
---|
| 267 | _mav_put_uint8_t(buf, 38, type_mask);
|
---|
| 268 | _mav_put_float_array(buf, 4, q, 4);
|
---|
| 269 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 270 | #else
|
---|
| 271 | mavlink_set_attitude_target_t *packet = (mavlink_set_attitude_target_t *)msgbuf;
|
---|
| 272 | packet->time_boot_ms = time_boot_ms;
|
---|
| 273 | packet->body_roll_rate = body_roll_rate;
|
---|
| 274 | packet->body_pitch_rate = body_pitch_rate;
|
---|
| 275 | packet->body_yaw_rate = body_yaw_rate;
|
---|
| 276 | packet->thrust = thrust;
|
---|
| 277 | packet->target_system = target_system;
|
---|
| 278 | packet->target_component = target_component;
|
---|
| 279 | packet->type_mask = type_mask;
|
---|
| 280 | mav_array_memcpy(packet->q, q, sizeof(float)*4);
|
---|
| 281 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET, (const char *)packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
|
---|
| 282 | #endif
|
---|
| 283 | }
|
---|
| 284 | #endif
|
---|
| 285 |
|
---|
| 286 | #endif
|
---|
| 287 |
|
---|
| 288 | // MESSAGE SET_ATTITUDE_TARGET UNPACKING
|
---|
| 289 |
|
---|
| 290 |
|
---|
| 291 | /**
|
---|
| 292 | * @brief Get field time_boot_ms from set_attitude_target message
|
---|
| 293 | *
|
---|
| 294 | * @return Timestamp in milliseconds since system boot
|
---|
| 295 | */
|
---|
| 296 | static inline uint32_t mavlink_msg_set_attitude_target_get_time_boot_ms(const mavlink_message_t* msg)
|
---|
| 297 | {
|
---|
| 298 | return _MAV_RETURN_uint32_t(msg, 0);
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | /**
|
---|
| 302 | * @brief Get field target_system from set_attitude_target message
|
---|
| 303 | *
|
---|
| 304 | * @return System ID
|
---|
| 305 | */
|
---|
| 306 | static inline uint8_t mavlink_msg_set_attitude_target_get_target_system(const mavlink_message_t* msg)
|
---|
| 307 | {
|
---|
| 308 | return _MAV_RETURN_uint8_t(msg, 36);
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | /**
|
---|
| 312 | * @brief Get field target_component from set_attitude_target message
|
---|
| 313 | *
|
---|
| 314 | * @return Component ID
|
---|
| 315 | */
|
---|
| 316 | static inline uint8_t mavlink_msg_set_attitude_target_get_target_component(const mavlink_message_t* msg)
|
---|
| 317 | {
|
---|
| 318 | return _MAV_RETURN_uint8_t(msg, 37);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | /**
|
---|
| 322 | * @brief Get field type_mask from set_attitude_target message
|
---|
| 323 | *
|
---|
| 324 | * @return 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 6: reserved, bit 7: throttle, bit 8: attitude
|
---|
| 325 | */
|
---|
| 326 | static inline uint8_t mavlink_msg_set_attitude_target_get_type_mask(const mavlink_message_t* msg)
|
---|
| 327 | {
|
---|
| 328 | return _MAV_RETURN_uint8_t(msg, 38);
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | /**
|
---|
| 332 | * @brief Get field q from set_attitude_target message
|
---|
| 333 | *
|
---|
| 334 | * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
|
---|
| 335 | */
|
---|
| 336 | static inline uint16_t mavlink_msg_set_attitude_target_get_q(const mavlink_message_t* msg, float *q)
|
---|
| 337 | {
|
---|
| 338 | return _MAV_RETURN_float_array(msg, q, 4, 4);
|
---|
| 339 | }
|
---|
| 340 |
|
---|
| 341 | /**
|
---|
| 342 | * @brief Get field body_roll_rate from set_attitude_target message
|
---|
| 343 | *
|
---|
| 344 | * @return Body roll rate in radians per second
|
---|
| 345 | */
|
---|
| 346 | static inline float mavlink_msg_set_attitude_target_get_body_roll_rate(const mavlink_message_t* msg)
|
---|
| 347 | {
|
---|
| 348 | return _MAV_RETURN_float(msg, 20);
|
---|
| 349 | }
|
---|
| 350 |
|
---|
| 351 | /**
|
---|
| 352 | * @brief Get field body_pitch_rate from set_attitude_target message
|
---|
| 353 | *
|
---|
| 354 | * @return Body roll rate in radians per second
|
---|
| 355 | */
|
---|
| 356 | static inline float mavlink_msg_set_attitude_target_get_body_pitch_rate(const mavlink_message_t* msg)
|
---|
| 357 | {
|
---|
| 358 | return _MAV_RETURN_float(msg, 24);
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | /**
|
---|
| 362 | * @brief Get field body_yaw_rate from set_attitude_target message
|
---|
| 363 | *
|
---|
| 364 | * @return Body roll rate in radians per second
|
---|
| 365 | */
|
---|
| 366 | static inline float mavlink_msg_set_attitude_target_get_body_yaw_rate(const mavlink_message_t* msg)
|
---|
| 367 | {
|
---|
| 368 | return _MAV_RETURN_float(msg, 28);
|
---|
| 369 | }
|
---|
| 370 |
|
---|
| 371 | /**
|
---|
| 372 | * @brief Get field thrust from set_attitude_target message
|
---|
| 373 | *
|
---|
| 374 | * @return Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse trust)
|
---|
| 375 | */
|
---|
| 376 | static inline float mavlink_msg_set_attitude_target_get_thrust(const mavlink_message_t* msg)
|
---|
| 377 | {
|
---|
| 378 | return _MAV_RETURN_float(msg, 32);
|
---|
| 379 | }
|
---|
| 380 |
|
---|
| 381 | /**
|
---|
| 382 | * @brief Decode a set_attitude_target message into a struct
|
---|
| 383 | *
|
---|
| 384 | * @param msg The message to decode
|
---|
| 385 | * @param set_attitude_target C-struct to decode the message contents into
|
---|
| 386 | */
|
---|
| 387 | static inline void mavlink_msg_set_attitude_target_decode(const mavlink_message_t* msg, mavlink_set_attitude_target_t* set_attitude_target)
|
---|
| 388 | {
|
---|
| 389 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 390 | set_attitude_target->time_boot_ms = mavlink_msg_set_attitude_target_get_time_boot_ms(msg);
|
---|
| 391 | mavlink_msg_set_attitude_target_get_q(msg, set_attitude_target->q);
|
---|
| 392 | set_attitude_target->body_roll_rate = mavlink_msg_set_attitude_target_get_body_roll_rate(msg);
|
---|
| 393 | set_attitude_target->body_pitch_rate = mavlink_msg_set_attitude_target_get_body_pitch_rate(msg);
|
---|
| 394 | set_attitude_target->body_yaw_rate = mavlink_msg_set_attitude_target_get_body_yaw_rate(msg);
|
---|
| 395 | set_attitude_target->thrust = mavlink_msg_set_attitude_target_get_thrust(msg);
|
---|
| 396 | set_attitude_target->target_system = mavlink_msg_set_attitude_target_get_target_system(msg);
|
---|
| 397 | set_attitude_target->target_component = mavlink_msg_set_attitude_target_get_target_component(msg);
|
---|
| 398 | set_attitude_target->type_mask = mavlink_msg_set_attitude_target_get_type_mask(msg);
|
---|
| 399 | #else
|
---|
| 400 | uint8_t len = msg->len < MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN? msg->len : MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN;
|
---|
| 401 | memset(set_attitude_target, 0, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
|
---|
| 402 | memcpy(set_attitude_target, _MAV_PAYLOAD(msg), len);
|
---|
| 403 | #endif
|
---|
| 404 | }
|
---|