Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_gimbal_device_attitude_status.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE GIMBAL_DEVICE_ATTITUDE_STATUS PACKING
3
4#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS 285
5
6
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 float q[4]; /*< Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.*/
10 float angular_velocity_x; /*< [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.*/
11 float angular_velocity_y; /*< [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.*/
12 float angular_velocity_z; /*< [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.*/
13 uint32_t failure_flags; /*< Failure flags (0 for no failure)*/
14 uint16_t flags; /*< Current gimbal flags set.*/
15 uint8_t target_system; /*< System ID*/
16 uint8_t target_component; /*< Component ID*/
17 float delta_yaw; /*< [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.*/
18 float delta_yaw_velocity; /*< [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.*/
19 uint8_t gimbal_device_id; /*< This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.*/
20} mavlink_gimbal_device_attitude_status_t;
21
22#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN 49
23#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN 40
24#define MAVLINK_MSG_ID_285_LEN 49
25#define MAVLINK_MSG_ID_285_MIN_LEN 40
26
27#define MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC 137
28#define MAVLINK_MSG_ID_285_CRC 137
29
30#define MAVLINK_MSG_GIMBAL_DEVICE_ATTITUDE_STATUS_FIELD_Q_LEN 4
31
32#if MAVLINK_COMMAND_24BIT
33#define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS {
34 285,
35 "GIMBAL_DEVICE_ATTITUDE_STATUS",
36 12,
37 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) },
38 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) },
39 { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) },
40 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_gimbal_device_attitude_status_t, flags) },
41 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_gimbal_device_attitude_status_t, q) },
42 { "angular_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_x) },
43 { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) },
44 { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) },
45 { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) },
46 { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) },
47 { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) },
48 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) },
49 } \
50}
51#else
52#define MAVLINK_MESSAGE_INFO_GIMBAL_DEVICE_ATTITUDE_STATUS {
53 "GIMBAL_DEVICE_ATTITUDE_STATUS",
54 12,
55 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_gimbal_device_attitude_status_t, target_system) },
56 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_gimbal_device_attitude_status_t, target_component) },
57 { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_device_attitude_status_t, time_boot_ms) },
58 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 36, offsetof(mavlink_gimbal_device_attitude_status_t, flags) },
59 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 4, offsetof(mavlink_gimbal_device_attitude_status_t, q) },
60 { "angular_velocity_x", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_x) },
61 { "angular_velocity_y", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_y) },
62 { "angular_velocity_z", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_gimbal_device_attitude_status_t, angular_velocity_z) },
63 { "failure_flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_gimbal_device_attitude_status_t, failure_flags) },
64 { "delta_yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw) },
65 { "delta_yaw_velocity", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_gimbal_device_attitude_status_t, delta_yaw_velocity) },
66 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_gimbal_device_attitude_status_t, gimbal_device_id) },
67 } \
68}
69#endif
70
71/**
72 * @brief Pack a gimbal_device_attitude_status message
73 * @param system_id ID of this system
74 * @param component_id ID of this component (e.g. 200 for IMU)
75 * @param msg The MAVLink message to compress the data into
76 *
77 * @param target_system System ID
78 * @param target_component Component ID
79 * @param time_boot_ms [ms] Timestamp (time since system boot).
80 * @param flags Current gimbal flags set.
81 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
82 * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
83 * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
84 * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
85 * @param failure_flags Failure flags (0 for no failure)
86 * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
87 * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
88 * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.
89 * @return length of the message in bytes (excluding serial stream start sign)
90 */
91static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
92 uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
93{
94#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
96 _mav_put_uint32_t(buf, 0, time_boot_ms);
97 _mav_put_float(buf, 20, angular_velocity_x);
98 _mav_put_float(buf, 24, angular_velocity_y);
99 _mav_put_float(buf, 28, angular_velocity_z);
100 _mav_put_uint32_t(buf, 32, failure_flags);
101 _mav_put_uint16_t(buf, 36, flags);
102 _mav_put_uint8_t(buf, 38, target_system);
103 _mav_put_uint8_t(buf, 39, target_component);
104 _mav_put_float(buf, 40, delta_yaw);
105 _mav_put_float(buf, 44, delta_yaw_velocity);
106 _mav_put_uint8_t(buf, 48, gimbal_device_id);
107 _mav_put_float_array(buf, 4, q, 4);
108 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
109#else
110 mavlink_gimbal_device_attitude_status_t packet;
111 packet.time_boot_ms = time_boot_ms;
112 packet.angular_velocity_x = angular_velocity_x;
113 packet.angular_velocity_y = angular_velocity_y;
114 packet.angular_velocity_z = angular_velocity_z;
115 packet.failure_flags = failure_flags;
116 packet.flags = flags;
117 packet.target_system = target_system;
118 packet.target_component = target_component;
119 packet.delta_yaw = delta_yaw;
120 packet.delta_yaw_velocity = delta_yaw_velocity;
121 packet.gimbal_device_id = gimbal_device_id;
122 mav_array_memcpy(packet.q, q, sizeof(float)*4);
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
124#endif
125
128}
129
130/**
131 * @brief Pack a gimbal_device_attitude_status message
132 * @param system_id ID of this system
133 * @param component_id ID of this component (e.g. 200 for IMU)
134 * @param status MAVLink status structure
135 * @param msg The MAVLink message to compress the data into
136 *
137 * @param target_system System ID
138 * @param target_component Component ID
139 * @param time_boot_ms [ms] Timestamp (time since system boot).
140 * @param flags Current gimbal flags set.
141 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
142 * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
143 * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
144 * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
145 * @param failure_flags Failure flags (0 for no failure)
146 * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
147 * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
148 * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.
149 * @return length of the message in bytes (excluding serial stream start sign)
150 */
151static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
152 uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
153{
154#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
156 _mav_put_uint32_t(buf, 0, time_boot_ms);
157 _mav_put_float(buf, 20, angular_velocity_x);
158 _mav_put_float(buf, 24, angular_velocity_y);
159 _mav_put_float(buf, 28, angular_velocity_z);
160 _mav_put_uint32_t(buf, 32, failure_flags);
161 _mav_put_uint16_t(buf, 36, flags);
162 _mav_put_uint8_t(buf, 38, target_system);
163 _mav_put_uint8_t(buf, 39, target_component);
164 _mav_put_float(buf, 40, delta_yaw);
165 _mav_put_float(buf, 44, delta_yaw_velocity);
166 _mav_put_uint8_t(buf, 48, gimbal_device_id);
167 _mav_put_float_array(buf, 4, q, 4);
168 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
169#else
170 mavlink_gimbal_device_attitude_status_t packet;
171 packet.time_boot_ms = time_boot_ms;
172 packet.angular_velocity_x = angular_velocity_x;
173 packet.angular_velocity_y = angular_velocity_y;
174 packet.angular_velocity_z = angular_velocity_z;
175 packet.failure_flags = failure_flags;
176 packet.flags = flags;
177 packet.target_system = target_system;
178 packet.target_component = target_component;
179 packet.delta_yaw = delta_yaw;
180 packet.delta_yaw_velocity = delta_yaw_velocity;
181 packet.gimbal_device_id = gimbal_device_id;
182 mav_array_memcpy(packet.q, q, sizeof(float)*4);
183 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
184#endif
185
187#if MAVLINK_CRC_EXTRA
188 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
189#else
190 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
191#endif
192}
193
194/**
195 * @brief Pack a gimbal_device_attitude_status message on a channel
196 * @param system_id ID of this system
197 * @param component_id ID of this component (e.g. 200 for IMU)
198 * @param chan The MAVLink channel this message will be sent over
199 * @param msg The MAVLink message to compress the data into
200 * @param target_system System ID
201 * @param target_component Component ID
202 * @param time_boot_ms [ms] Timestamp (time since system boot).
203 * @param flags Current gimbal flags set.
204 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
205 * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
206 * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
207 * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
208 * @param failure_flags Failure flags (0 for no failure)
209 * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
210 * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
211 * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.
212 * @return length of the message in bytes (excluding serial stream start sign)
213 */
214static inline uint16_t mavlink_msg_gimbal_device_attitude_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
215 mavlink_message_t* msg,
216 uint8_t target_system,uint8_t target_component,uint32_t time_boot_ms,uint16_t flags,const float *q,float angular_velocity_x,float angular_velocity_y,float angular_velocity_z,uint32_t failure_flags,float delta_yaw,float delta_yaw_velocity,uint8_t gimbal_device_id)
217{
218#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
220 _mav_put_uint32_t(buf, 0, time_boot_ms);
221 _mav_put_float(buf, 20, angular_velocity_x);
222 _mav_put_float(buf, 24, angular_velocity_y);
223 _mav_put_float(buf, 28, angular_velocity_z);
224 _mav_put_uint32_t(buf, 32, failure_flags);
225 _mav_put_uint16_t(buf, 36, flags);
226 _mav_put_uint8_t(buf, 38, target_system);
227 _mav_put_uint8_t(buf, 39, target_component);
228 _mav_put_float(buf, 40, delta_yaw);
229 _mav_put_float(buf, 44, delta_yaw_velocity);
230 _mav_put_uint8_t(buf, 48, gimbal_device_id);
231 _mav_put_float_array(buf, 4, q, 4);
232 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
233#else
234 mavlink_gimbal_device_attitude_status_t packet;
235 packet.time_boot_ms = time_boot_ms;
236 packet.angular_velocity_x = angular_velocity_x;
237 packet.angular_velocity_y = angular_velocity_y;
238 packet.angular_velocity_z = angular_velocity_z;
239 packet.failure_flags = failure_flags;
240 packet.flags = flags;
241 packet.target_system = target_system;
242 packet.target_component = target_component;
243 packet.delta_yaw = delta_yaw;
244 packet.delta_yaw_velocity = delta_yaw_velocity;
245 packet.gimbal_device_id = gimbal_device_id;
246 mav_array_memcpy(packet.q, q, sizeof(float)*4);
247 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
248#endif
249
252}
253
254/**
255 * @brief Encode a gimbal_device_attitude_status struct
256 *
257 * @param system_id ID of this system
258 * @param component_id ID of this component (e.g. 200 for IMU)
259 * @param msg The MAVLink message to compress the data into
260 * @param gimbal_device_attitude_status C-struct to read the message contents from
261 */
262static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
263{
264 return mavlink_msg_gimbal_device_attitude_status_pack(system_id, component_id, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
265}
266
267/**
268 * @brief Encode a gimbal_device_attitude_status struct on a channel
269 *
270 * @param system_id ID of this system
271 * @param component_id ID of this component (e.g. 200 for IMU)
272 * @param chan The MAVLink channel this message will be sent over
273 * @param msg The MAVLink message to compress the data into
274 * @param gimbal_device_attitude_status C-struct to read the message contents from
275 */
276static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
277{
278 return mavlink_msg_gimbal_device_attitude_status_pack_chan(system_id, component_id, chan, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
279}
280
281/**
282 * @brief Encode a gimbal_device_attitude_status struct with provided status structure
283 *
284 * @param system_id ID of this system
285 * @param component_id ID of this component (e.g. 200 for IMU)
286 * @param status MAVLink status structure
287 * @param msg The MAVLink message to compress the data into
288 * @param gimbal_device_attitude_status C-struct to read the message contents from
289 */
290static inline uint16_t mavlink_msg_gimbal_device_attitude_status_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
291{
292 return mavlink_msg_gimbal_device_attitude_status_pack_status(system_id, component_id, _status, msg, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
293}
294
295/**
296 * @brief Send a gimbal_device_attitude_status message
297 * @param chan MAVLink channel to send the message
298 *
299 * @param target_system System ID
300 * @param target_component Component ID
301 * @param time_boot_ms [ms] Timestamp (time since system boot).
302 * @param flags Current gimbal flags set.
303 * @param q Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
304 * @param angular_velocity_x [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
305 * @param angular_velocity_y [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
306 * @param angular_velocity_z [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
307 * @param failure_flags Failure flags (0 for no failure)
308 * @param delta_yaw [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
309 * @param delta_yaw_velocity [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
310 * @param gimbal_device_id This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.
311 */
312#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
313
314static inline void mavlink_msg_gimbal_device_attitude_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
315{
316#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
317 char buf[MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN];
318 _mav_put_uint32_t(buf, 0, time_boot_ms);
319 _mav_put_float(buf, 20, angular_velocity_x);
320 _mav_put_float(buf, 24, angular_velocity_y);
321 _mav_put_float(buf, 28, angular_velocity_z);
322 _mav_put_uint32_t(buf, 32, failure_flags);
323 _mav_put_uint16_t(buf, 36, flags);
324 _mav_put_uint8_t(buf, 38, target_system);
325 _mav_put_uint8_t(buf, 39, target_component);
326 _mav_put_float(buf, 40, delta_yaw);
327 _mav_put_float(buf, 44, delta_yaw_velocity);
328 _mav_put_uint8_t(buf, 48, gimbal_device_id);
329 _mav_put_float_array(buf, 4, q, 4);
330 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
331#else
332 mavlink_gimbal_device_attitude_status_t packet;
333 packet.time_boot_ms = time_boot_ms;
334 packet.angular_velocity_x = angular_velocity_x;
335 packet.angular_velocity_y = angular_velocity_y;
336 packet.angular_velocity_z = angular_velocity_z;
337 packet.failure_flags = failure_flags;
338 packet.flags = flags;
339 packet.target_system = target_system;
340 packet.target_component = target_component;
341 packet.delta_yaw = delta_yaw;
342 packet.delta_yaw_velocity = delta_yaw_velocity;
343 packet.gimbal_device_id = gimbal_device_id;
344 mav_array_memcpy(packet.q, q, sizeof(float)*4);
345 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
346#endif
347}
348
349/**
350 * @brief Send a gimbal_device_attitude_status message
351 * @param chan MAVLink channel to send the message
352 * @param struct The MAVLink struct to serialize
353 */
354static inline void mavlink_msg_gimbal_device_attitude_status_send_struct(mavlink_channel_t chan, const mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
355{
356#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
357 mavlink_msg_gimbal_device_attitude_status_send(chan, gimbal_device_attitude_status->target_system, gimbal_device_attitude_status->target_component, gimbal_device_attitude_status->time_boot_ms, gimbal_device_attitude_status->flags, gimbal_device_attitude_status->q, gimbal_device_attitude_status->angular_velocity_x, gimbal_device_attitude_status->angular_velocity_y, gimbal_device_attitude_status->angular_velocity_z, gimbal_device_attitude_status->failure_flags, gimbal_device_attitude_status->delta_yaw, gimbal_device_attitude_status->delta_yaw_velocity, gimbal_device_attitude_status->gimbal_device_id);
358#else
359 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)gimbal_device_attitude_status, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
360#endif
361}
362
363#if MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
364/*
365 This variant of _send() can be used to save stack space by reusing
366 memory from the receive buffer. The caller provides a
367 mavlink_message_t which is the size of a full mavlink message. This
368 is usually the receive buffer for the channel, and allows a reply to an
369 incoming message with minimum stack space usage.
370 */
371static inline void mavlink_msg_gimbal_device_attitude_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint32_t time_boot_ms, uint16_t flags, const float *q, float angular_velocity_x, float angular_velocity_y, float angular_velocity_z, uint32_t failure_flags, float delta_yaw, float delta_yaw_velocity, uint8_t gimbal_device_id)
372{
373#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
374 char *buf = (char *)msgbuf;
375 _mav_put_uint32_t(buf, 0, time_boot_ms);
376 _mav_put_float(buf, 20, angular_velocity_x);
377 _mav_put_float(buf, 24, angular_velocity_y);
378 _mav_put_float(buf, 28, angular_velocity_z);
379 _mav_put_uint32_t(buf, 32, failure_flags);
380 _mav_put_uint16_t(buf, 36, flags);
381 _mav_put_uint8_t(buf, 38, target_system);
382 _mav_put_uint8_t(buf, 39, target_component);
383 _mav_put_float(buf, 40, delta_yaw);
384 _mav_put_float(buf, 44, delta_yaw_velocity);
385 _mav_put_uint8_t(buf, 48, gimbal_device_id);
386 _mav_put_float_array(buf, 4, q, 4);
387 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
388#else
389 mavlink_gimbal_device_attitude_status_t *packet = (mavlink_gimbal_device_attitude_status_t *)msgbuf;
390 packet->time_boot_ms = time_boot_ms;
391 packet->angular_velocity_x = angular_velocity_x;
392 packet->angular_velocity_y = angular_velocity_y;
393 packet->angular_velocity_z = angular_velocity_z;
394 packet->failure_flags = failure_flags;
395 packet->flags = flags;
396 packet->target_system = target_system;
397 packet->target_component = target_component;
398 packet->delta_yaw = delta_yaw;
399 packet->delta_yaw_velocity = delta_yaw_velocity;
400 packet->gimbal_device_id = gimbal_device_id;
401 mav_array_memcpy(packet->q, q, sizeof(float)*4);
402 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_CRC);
403#endif
404}
405#endif
406
407#endif
408
409// MESSAGE GIMBAL_DEVICE_ATTITUDE_STATUS UNPACKING
410
411
412/**
413 * @brief Get field target_system from gimbal_device_attitude_status message
414 *
415 * @return System ID
416 */
417static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_target_system(const mavlink_message_t* msg)
418{
419 return _MAV_RETURN_uint8_t(msg, 38);
420}
421
422/**
423 * @brief Get field target_component from gimbal_device_attitude_status message
424 *
425 * @return Component ID
426 */
427static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_target_component(const mavlink_message_t* msg)
428{
429 return _MAV_RETURN_uint8_t(msg, 39);
430}
431
432/**
433 * @brief Get field time_boot_ms from gimbal_device_attitude_status message
434 *
435 * @return [ms] Timestamp (time since system boot).
436 */
437static inline uint32_t mavlink_msg_gimbal_device_attitude_status_get_time_boot_ms(const mavlink_message_t* msg)
438{
439 return _MAV_RETURN_uint32_t(msg, 0);
440}
441
442/**
443 * @brief Get field flags from gimbal_device_attitude_status message
444 *
445 * @return Current gimbal flags set.
446 */
447static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_flags(const mavlink_message_t* msg)
448{
449 return _MAV_RETURN_uint16_t(msg, 36);
450}
451
452/**
453 * @brief Get field q from gimbal_device_attitude_status message
454 *
455 * @return Quaternion components, w, x, y, z (1 0 0 0 is the null-rotation). The frame is described in the message description.
456 */
457static inline uint16_t mavlink_msg_gimbal_device_attitude_status_get_q(const mavlink_message_t* msg, float *q)
458{
459 return _MAV_RETURN_float_array(msg, q, 4, 4);
460}
461
462/**
463 * @brief Get field angular_velocity_x from gimbal_device_attitude_status message
464 *
465 * @return [rad/s] X component of angular velocity (positive: rolling to the right). The frame is described in the message description. NaN if unknown.
466 */
467static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_x(const mavlink_message_t* msg)
468{
469 return _MAV_RETURN_float(msg, 20);
470}
471
472/**
473 * @brief Get field angular_velocity_y from gimbal_device_attitude_status message
474 *
475 * @return [rad/s] Y component of angular velocity (positive: pitching up). The frame is described in the message description. NaN if unknown.
476 */
477static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_y(const mavlink_message_t* msg)
478{
479 return _MAV_RETURN_float(msg, 24);
480}
481
482/**
483 * @brief Get field angular_velocity_z from gimbal_device_attitude_status message
484 *
485 * @return [rad/s] Z component of angular velocity (positive: yawing to the right). The frame is described in the message description. NaN if unknown.
486 */
487static inline float mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_z(const mavlink_message_t* msg)
488{
489 return _MAV_RETURN_float(msg, 28);
490}
491
492/**
493 * @brief Get field failure_flags from gimbal_device_attitude_status message
494 *
495 * @return Failure flags (0 for no failure)
496 */
497static inline uint32_t mavlink_msg_gimbal_device_attitude_status_get_failure_flags(const mavlink_message_t* msg)
498{
499 return _MAV_RETURN_uint32_t(msg, 32);
500}
501
502/**
503 * @brief Get field delta_yaw from gimbal_device_attitude_status message
504 *
505 * @return [rad] Yaw angle relating the quaternions in earth and body frames (see message description). NaN if unknown.
506 */
507static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(const mavlink_message_t* msg)
508{
509 return _MAV_RETURN_float(msg, 40);
510}
511
512/**
513 * @brief Get field delta_yaw_velocity from gimbal_device_attitude_status message
514 *
515 * @return [rad/s] Yaw angular velocity relating the angular velocities in earth and body frames (see message description). NaN if unknown.
516 */
517static inline float mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(const mavlink_message_t* msg)
518{
519 return _MAV_RETURN_float(msg, 44);
520}
521
522/**
523 * @brief Get field gimbal_device_id from gimbal_device_attitude_status message
524 *
525 * @return This field is to be used if the gimbal manager and the gimbal device are the same component and hence have the same component ID. This field is then set a number between 1-6. If the component ID is separate, this field is not required and must be set to 0.
526 */
527static inline uint8_t mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(const mavlink_message_t* msg)
528{
529 return _MAV_RETURN_uint8_t(msg, 48);
530}
531
532/**
533 * @brief Decode a gimbal_device_attitude_status message into a struct
534 *
535 * @param msg The message to decode
536 * @param gimbal_device_attitude_status C-struct to decode the message contents into
537 */
538static inline void mavlink_msg_gimbal_device_attitude_status_decode(const mavlink_message_t* msg, mavlink_gimbal_device_attitude_status_t* gimbal_device_attitude_status)
539{
540#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
541 gimbal_device_attitude_status->time_boot_ms = mavlink_msg_gimbal_device_attitude_status_get_time_boot_ms(msg);
542 mavlink_msg_gimbal_device_attitude_status_get_q(msg, gimbal_device_attitude_status->q);
543 gimbal_device_attitude_status->angular_velocity_x = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_x(msg);
544 gimbal_device_attitude_status->angular_velocity_y = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_y(msg);
545 gimbal_device_attitude_status->angular_velocity_z = mavlink_msg_gimbal_device_attitude_status_get_angular_velocity_z(msg);
546 gimbal_device_attitude_status->failure_flags = mavlink_msg_gimbal_device_attitude_status_get_failure_flags(msg);
547 gimbal_device_attitude_status->flags = mavlink_msg_gimbal_device_attitude_status_get_flags(msg);
548 gimbal_device_attitude_status->target_system = mavlink_msg_gimbal_device_attitude_status_get_target_system(msg);
549 gimbal_device_attitude_status->target_component = mavlink_msg_gimbal_device_attitude_status_get_target_component(msg);
550 gimbal_device_attitude_status->delta_yaw = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw(msg);
551 gimbal_device_attitude_status->delta_yaw_velocity = mavlink_msg_gimbal_device_attitude_status_get_delta_yaw_velocity(msg);
552 gimbal_device_attitude_status->gimbal_device_id = mavlink_msg_gimbal_device_attitude_status_get_gimbal_device_id(msg);
553#else
554 uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN;
555 memset(gimbal_device_attitude_status, 0, MAVLINK_MSG_ID_GIMBAL_DEVICE_ATTITUDE_STATUS_LEN);
556 memcpy(gimbal_device_attitude_status, _MAV_PAYLOAD(msg), len);
557#endif
558}