Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_set_attitude_target.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE SET_ATTITUDE_TARGET PACKING
3
4#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET 82
5
6MAVPACKED(
7typedef struct __mavlink_set_attitude_target_t {
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 float q[4]; /*< Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD*/
10 float body_roll_rate; /*< [rad/s] Body roll rate*/
11 float body_pitch_rate; /*< [rad/s] Body pitch rate*/
12 float body_yaw_rate; /*< [rad/s] Body yaw rate*/
13 float thrust; /*< Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)*/
14 uint8_t target_system; /*< System ID*/
15 uint8_t target_component; /*< Component ID*/
16 uint8_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/
17 float thrust_body[3]; /*< 3D thrust setpoint in the body NED frame, normalized to -1 .. 1*/
18}) mavlink_set_attitude_target_t;
19
20#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN 51
21#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN 39
22#define MAVLINK_MSG_ID_82_LEN 51
23#define MAVLINK_MSG_ID_82_MIN_LEN 39
24
25#define MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC 49
26#define MAVLINK_MSG_ID_82_CRC 49
27
28#define MAVLINK_MSG_SET_ATTITUDE_TARGET_FIELD_Q_LEN 4
29#define MAVLINK_MSG_SET_ATTITUDE_TARGET_FIELD_THRUST_BODY_LEN 3
30
31#if MAVLINK_COMMAND_24BIT
32#define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET {
33 82,
34 "SET_ATTITUDE_TARGET",
35 10,
36 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) },
37 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) },
38 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) },
39 { "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_set_attitude_target_t, type_mask) },
40 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_set_attitude_target_t, q) },
41 { "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_attitude_target_t, body_roll_rate) },
42 { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) },
43 { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) },
44 { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) },
45 { "thrust_body", NULL, MAVLINK_TYPE_FLOAT, 3, 39, offsetof(mavlink_set_attitude_target_t, thrust_body) },
46 } \
47}
48#else
49#define MAVLINK_MESSAGE_INFO_SET_ATTITUDE_TARGET {
50 "SET_ATTITUDE_TARGET",
51 10,
52 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_attitude_target_t, time_boot_ms) },
53 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_set_attitude_target_t, target_system) },
54 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_set_attitude_target_t, target_component) },
55 { "type_mask", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_set_attitude_target_t, type_mask) },
56 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_set_attitude_target_t, q) },
57 { "body_roll_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_attitude_target_t, body_roll_rate) },
58 { "body_pitch_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_attitude_target_t, body_pitch_rate) },
59 { "body_yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_attitude_target_t, body_yaw_rate) },
60 { "thrust", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_attitude_target_t, thrust) },
61 { "thrust_body", NULL, MAVLINK_TYPE_FLOAT, 3, 39, offsetof(mavlink_set_attitude_target_t, thrust_body) },
62 } \
63}
64#endif
65
66/**
67 * @brief Pack a set_attitude_target message
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param msg The MAVLink message to compress the data into
71 *
72 * @param time_boot_ms [ms] Timestamp (time since system boot).
73 * @param target_system System ID
74 * @param target_component Component ID
75 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
76 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD
77 * @param body_roll_rate [rad/s] Body roll rate
78 * @param body_pitch_rate [rad/s] Body pitch rate
79 * @param body_yaw_rate [rad/s] Body yaw rate
80 * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)
81 * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1
82 * @return length of the message in bytes (excluding serial stream start sign)
83 */
84static inline uint16_t mavlink_msg_set_attitude_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
85 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, const float *thrust_body)
86{
87#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89 _mav_put_uint32_t(buf, 0, time_boot_ms);
90 _mav_put_float(buf, 20, body_roll_rate);
91 _mav_put_float(buf, 24, body_pitch_rate);
92 _mav_put_float(buf, 28, body_yaw_rate);
93 _mav_put_float(buf, 32, thrust);
94 _mav_put_uint8_t(buf, 36, target_system);
95 _mav_put_uint8_t(buf, 37, target_component);
96 _mav_put_uint8_t(buf, 38, type_mask);
97 _mav_put_float_array(buf, 4, q, 4);
98 _mav_put_float_array(buf, 39, thrust_body, 3);
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
100#else
101 mavlink_set_attitude_target_t packet;
102 packet.time_boot_ms = time_boot_ms;
103 packet.body_roll_rate = body_roll_rate;
104 packet.body_pitch_rate = body_pitch_rate;
105 packet.body_yaw_rate = body_yaw_rate;
106 packet.thrust = thrust;
107 packet.target_system = target_system;
108 packet.target_component = target_component;
109 packet.type_mask = type_mask;
110 mav_array_memcpy(packet.q, q, sizeof(float)*4);
111 mav_array_memcpy(packet.thrust_body, thrust_body, sizeof(float)*3);
112 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
113#endif
114
117}
118
119/**
120 * @brief Pack a set_attitude_target message
121 * @param system_id ID of this system
122 * @param component_id ID of this component (e.g. 200 for IMU)
123 * @param status MAVLink status structure
124 * @param msg The MAVLink message to compress the data into
125 *
126 * @param time_boot_ms [ms] Timestamp (time since system boot).
127 * @param target_system System ID
128 * @param target_component Component ID
129 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
130 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD
131 * @param body_roll_rate [rad/s] Body roll rate
132 * @param body_pitch_rate [rad/s] Body pitch rate
133 * @param body_yaw_rate [rad/s] Body yaw rate
134 * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)
135 * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1
136 * @return length of the message in bytes (excluding serial stream start sign)
137 */
138static inline uint16_t mavlink_msg_set_attitude_target_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
139 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, const float *thrust_body)
140{
141#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 _mav_put_uint32_t(buf, 0, time_boot_ms);
144 _mav_put_float(buf, 20, body_roll_rate);
145 _mav_put_float(buf, 24, body_pitch_rate);
146 _mav_put_float(buf, 28, body_yaw_rate);
147 _mav_put_float(buf, 32, thrust);
148 _mav_put_uint8_t(buf, 36, target_system);
149 _mav_put_uint8_t(buf, 37, target_component);
150 _mav_put_uint8_t(buf, 38, type_mask);
151 _mav_put_float_array(buf, 4, q, 4);
152 _mav_put_float_array(buf, 39, thrust_body, 3);
153 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
154#else
155 mavlink_set_attitude_target_t packet;
156 packet.time_boot_ms = time_boot_ms;
157 packet.body_roll_rate = body_roll_rate;
158 packet.body_pitch_rate = body_pitch_rate;
159 packet.body_yaw_rate = body_yaw_rate;
160 packet.thrust = thrust;
161 packet.target_system = target_system;
162 packet.target_component = target_component;
163 packet.type_mask = type_mask;
164 mav_array_memcpy(packet.q, q, sizeof(float)*4);
165 mav_array_memcpy(packet.thrust_body, thrust_body, sizeof(float)*3);
166 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
167#endif
168
170#if MAVLINK_CRC_EXTRA
171 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_CRC);
172#else
173 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
174#endif
175}
176
177/**
178 * @brief Pack a set_attitude_target message on a channel
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param chan The MAVLink channel this message will be sent over
182 * @param msg The MAVLink message to compress the data into
183 * @param time_boot_ms [ms] Timestamp (time since system boot).
184 * @param target_system System ID
185 * @param target_component Component ID
186 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
187 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD
188 * @param body_roll_rate [rad/s] Body roll rate
189 * @param body_pitch_rate [rad/s] Body pitch rate
190 * @param body_yaw_rate [rad/s] Body yaw rate
191 * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)
192 * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1
193 * @return length of the message in bytes (excluding serial stream start sign)
194 */
195static inline uint16_t mavlink_msg_set_attitude_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
196 mavlink_message_t* msg,
197 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,const float *thrust_body)
198{
199#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 _mav_put_uint32_t(buf, 0, time_boot_ms);
202 _mav_put_float(buf, 20, body_roll_rate);
203 _mav_put_float(buf, 24, body_pitch_rate);
204 _mav_put_float(buf, 28, body_yaw_rate);
205 _mav_put_float(buf, 32, thrust);
206 _mav_put_uint8_t(buf, 36, target_system);
207 _mav_put_uint8_t(buf, 37, target_component);
208 _mav_put_uint8_t(buf, 38, type_mask);
209 _mav_put_float_array(buf, 4, q, 4);
210 _mav_put_float_array(buf, 39, thrust_body, 3);
211 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
212#else
213 mavlink_set_attitude_target_t packet;
214 packet.time_boot_ms = time_boot_ms;
215 packet.body_roll_rate = body_roll_rate;
216 packet.body_pitch_rate = body_pitch_rate;
217 packet.body_yaw_rate = body_yaw_rate;
218 packet.thrust = thrust;
219 packet.target_system = target_system;
220 packet.target_component = target_component;
221 packet.type_mask = type_mask;
222 mav_array_memcpy(packet.q, q, sizeof(float)*4);
223 mav_array_memcpy(packet.thrust_body, thrust_body, sizeof(float)*3);
224 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
225#endif
226
228 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);
229}
230
231/**
232 * @brief Encode a set_attitude_target struct
233 *
234 * @param system_id ID of this system
235 * @param component_id ID of this component (e.g. 200 for IMU)
236 * @param msg The MAVLink message to compress the data into
237 * @param set_attitude_target C-struct to read the message contents from
238 */
239static 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)
240{
241 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, set_attitude_target->thrust_body);
242}
243
244/**
245 * @brief Encode a set_attitude_target struct on a channel
246 *
247 * @param system_id ID of this system
248 * @param component_id ID of this component (e.g. 200 for IMU)
249 * @param chan The MAVLink channel this message will be sent over
250 * @param msg The MAVLink message to compress the data into
251 * @param set_attitude_target C-struct to read the message contents from
252 */
253static 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)
254{
255 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, set_attitude_target->thrust_body);
256}
257
258/**
259 * @brief Encode a set_attitude_target struct with provided status structure
260 *
261 * @param system_id ID of this system
262 * @param component_id ID of this component (e.g. 200 for IMU)
263 * @param status MAVLink status structure
264 * @param msg The MAVLink message to compress the data into
265 * @param set_attitude_target C-struct to read the message contents from
266 */
267static inline uint16_t mavlink_msg_set_attitude_target_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_attitude_target_t* set_attitude_target)
268{
269 return mavlink_msg_set_attitude_target_pack_status(system_id, component_id, _status, 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, set_attitude_target->thrust_body);
270}
271
272/**
273 * @brief Send a set_attitude_target message
274 * @param chan MAVLink channel to send the message
275 *
276 * @param time_boot_ms [ms] Timestamp (time since system boot).
277 * @param target_system System ID
278 * @param target_component Component ID
279 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
280 * @param q Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD
281 * @param body_roll_rate [rad/s] Body roll rate
282 * @param body_pitch_rate [rad/s] Body pitch rate
283 * @param body_yaw_rate [rad/s] Body yaw rate
284 * @param thrust Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)
285 * @param thrust_body 3D thrust setpoint in the body NED frame, normalized to -1 .. 1
286 */
287#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
288
289static 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, const float *thrust_body)
290{
291#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292 char buf[MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN];
293 _mav_put_uint32_t(buf, 0, time_boot_ms);
294 _mav_put_float(buf, 20, body_roll_rate);
295 _mav_put_float(buf, 24, body_pitch_rate);
296 _mav_put_float(buf, 28, body_yaw_rate);
297 _mav_put_float(buf, 32, thrust);
298 _mav_put_uint8_t(buf, 36, target_system);
299 _mav_put_uint8_t(buf, 37, target_component);
300 _mav_put_uint8_t(buf, 38, type_mask);
301 _mav_put_float_array(buf, 4, q, 4);
302 _mav_put_float_array(buf, 39, thrust_body, 3);
303 _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);
304#else
305 mavlink_set_attitude_target_t packet;
306 packet.time_boot_ms = time_boot_ms;
307 packet.body_roll_rate = body_roll_rate;
308 packet.body_pitch_rate = body_pitch_rate;
309 packet.body_yaw_rate = body_yaw_rate;
310 packet.thrust = thrust;
311 packet.target_system = target_system;
312 packet.target_component = target_component;
313 packet.type_mask = type_mask;
314 mav_array_memcpy(packet.q, q, sizeof(float)*4);
315 mav_array_memcpy(packet.thrust_body, thrust_body, sizeof(float)*3);
316 _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);
317#endif
318}
319
320/**
321 * @brief Send a set_attitude_target message
322 * @param chan MAVLink channel to send the message
323 * @param struct The MAVLink struct to serialize
324 */
325static inline void mavlink_msg_set_attitude_target_send_struct(mavlink_channel_t chan, const mavlink_set_attitude_target_t* set_attitude_target)
326{
327#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
328 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, set_attitude_target->thrust_body);
329#else
330 _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);
331#endif
332}
333
334#if MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
335/*
336 This variant of _send() can be used to save stack space by reusing
337 memory from the receive buffer. The caller provides a
338 mavlink_message_t which is the size of a full mavlink message. This
339 is usually the receive buffer for the channel, and allows a reply to an
340 incoming message with minimum stack space usage.
341 */
342static 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, const float *thrust_body)
343{
344#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
345 char *buf = (char *)msgbuf;
346 _mav_put_uint32_t(buf, 0, time_boot_ms);
347 _mav_put_float(buf, 20, body_roll_rate);
348 _mav_put_float(buf, 24, body_pitch_rate);
349 _mav_put_float(buf, 28, body_yaw_rate);
350 _mav_put_float(buf, 32, thrust);
351 _mav_put_uint8_t(buf, 36, target_system);
352 _mav_put_uint8_t(buf, 37, target_component);
353 _mav_put_uint8_t(buf, 38, type_mask);
354 _mav_put_float_array(buf, 4, q, 4);
355 _mav_put_float_array(buf, 39, thrust_body, 3);
356 _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);
357#else
358 mavlink_set_attitude_target_t *packet = (mavlink_set_attitude_target_t *)msgbuf;
359 packet->time_boot_ms = time_boot_ms;
360 packet->body_roll_rate = body_roll_rate;
361 packet->body_pitch_rate = body_pitch_rate;
362 packet->body_yaw_rate = body_yaw_rate;
363 packet->thrust = thrust;
364 packet->target_system = target_system;
365 packet->target_component = target_component;
366 packet->type_mask = type_mask;
367 mav_array_memcpy(packet->q, q, sizeof(float)*4);
368 mav_array_memcpy(packet->thrust_body, thrust_body, sizeof(float)*3);
369 _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);
370#endif
371}
372#endif
373
374#endif
375
376// MESSAGE SET_ATTITUDE_TARGET UNPACKING
377
378
379/**
380 * @brief Get field time_boot_ms from set_attitude_target message
381 *
382 * @return [ms] Timestamp (time since system boot).
383 */
384static inline uint32_t mavlink_msg_set_attitude_target_get_time_boot_ms(const mavlink_message_t* msg)
385{
386 return _MAV_RETURN_uint32_t(msg, 0);
387}
388
389/**
390 * @brief Get field target_system from set_attitude_target message
391 *
392 * @return System ID
393 */
394static inline uint8_t mavlink_msg_set_attitude_target_get_target_system(const mavlink_message_t* msg)
395{
396 return _MAV_RETURN_uint8_t(msg, 36);
397}
398
399/**
400 * @brief Get field target_component from set_attitude_target message
401 *
402 * @return Component ID
403 */
404static inline uint8_t mavlink_msg_set_attitude_target_get_target_component(const mavlink_message_t* msg)
405{
406 return _MAV_RETURN_uint8_t(msg, 37);
407}
408
409/**
410 * @brief Get field type_mask from set_attitude_target message
411 *
412 * @return Bitmap to indicate which dimensions should be ignored by the vehicle.
413 */
414static inline uint8_t mavlink_msg_set_attitude_target_get_type_mask(const mavlink_message_t* msg)
415{
416 return _MAV_RETURN_uint8_t(msg, 38);
417}
418
419/**
420 * @brief Get field q from set_attitude_target message
421 *
422 * @return Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) from MAV_FRAME_LOCAL_NED to MAV_FRAME_BODY_FRD
423 */
424static inline uint16_t mavlink_msg_set_attitude_target_get_q(const mavlink_message_t* msg, float *q)
425{
426 return _MAV_RETURN_float_array(msg, q, 4, 4);
427}
428
429/**
430 * @brief Get field body_roll_rate from set_attitude_target message
431 *
432 * @return [rad/s] Body roll rate
433 */
434static inline float mavlink_msg_set_attitude_target_get_body_roll_rate(const mavlink_message_t* msg)
435{
436 return _MAV_RETURN_float(msg, 20);
437}
438
439/**
440 * @brief Get field body_pitch_rate from set_attitude_target message
441 *
442 * @return [rad/s] Body pitch rate
443 */
444static inline float mavlink_msg_set_attitude_target_get_body_pitch_rate(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_float(msg, 24);
447}
448
449/**
450 * @brief Get field body_yaw_rate from set_attitude_target message
451 *
452 * @return [rad/s] Body yaw rate
453 */
454static inline float mavlink_msg_set_attitude_target_get_body_yaw_rate(const mavlink_message_t* msg)
455{
456 return _MAV_RETURN_float(msg, 28);
457}
458
459/**
460 * @brief Get field thrust from set_attitude_target message
461 *
462 * @return Collective thrust, normalized to 0 .. 1 (-1 .. 1 for vehicles capable of reverse thrust)
463 */
464static inline float mavlink_msg_set_attitude_target_get_thrust(const mavlink_message_t* msg)
465{
466 return _MAV_RETURN_float(msg, 32);
467}
468
469/**
470 * @brief Get field thrust_body from set_attitude_target message
471 *
472 * @return 3D thrust setpoint in the body NED frame, normalized to -1 .. 1
473 */
474static inline uint16_t mavlink_msg_set_attitude_target_get_thrust_body(const mavlink_message_t* msg, float *thrust_body)
475{
476 return _MAV_RETURN_float_array(msg, thrust_body, 3, 39);
477}
478
479/**
480 * @brief Decode a set_attitude_target message into a struct
481 *
482 * @param msg The message to decode
483 * @param set_attitude_target C-struct to decode the message contents into
484 */
485static inline void mavlink_msg_set_attitude_target_decode(const mavlink_message_t* msg, mavlink_set_attitude_target_t* set_attitude_target)
486{
487#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
488 set_attitude_target->time_boot_ms = mavlink_msg_set_attitude_target_get_time_boot_ms(msg);
489 mavlink_msg_set_attitude_target_get_q(msg, set_attitude_target->q);
490 set_attitude_target->body_roll_rate = mavlink_msg_set_attitude_target_get_body_roll_rate(msg);
491 set_attitude_target->body_pitch_rate = mavlink_msg_set_attitude_target_get_body_pitch_rate(msg);
492 set_attitude_target->body_yaw_rate = mavlink_msg_set_attitude_target_get_body_yaw_rate(msg);
493 set_attitude_target->thrust = mavlink_msg_set_attitude_target_get_thrust(msg);
494 set_attitude_target->target_system = mavlink_msg_set_attitude_target_get_target_system(msg);
495 set_attitude_target->target_component = mavlink_msg_set_attitude_target_get_target_component(msg);
496 set_attitude_target->type_mask = mavlink_msg_set_attitude_target_get_type_mask(msg);
497 mavlink_msg_set_attitude_target_get_thrust_body(msg, set_attitude_target->thrust_body);
498#else
499 uint8_t len = msg->len < MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN? msg->len : MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN;
500 memset(set_attitude_target, 0, MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_LEN);
501 memcpy(set_attitude_target, _MAV_PAYLOAD(msg), len);
502#endif
503}