mavlink_msg_attitude_quaternion.h
Go to the documentation of this file.
1 // MESSAGE ATTITUDE_QUATERNION PACKING
2 
3 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION 31
4 
6 {
7  uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
8  float q1; /*< Quaternion component 1, w (1 in null-rotation)*/
9  float q2; /*< Quaternion component 2, x (0 in null-rotation)*/
10  float q3; /*< Quaternion component 3, y (0 in null-rotation)*/
11  float q4; /*< Quaternion component 4, z (0 in null-rotation)*/
12  float rollspeed; /*< Roll angular speed (rad/s)*/
13  float pitchspeed; /*< Pitch angular speed (rad/s)*/
14  float yawspeed; /*< Yaw angular speed (rad/s)*/
16 
17 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN 32
18 #define MAVLINK_MSG_ID_31_LEN 32
19 
20 #define MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC 246
21 #define MAVLINK_MSG_ID_31_CRC 246
22 
23 
24 
25 #define MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION { \
26  "ATTITUDE_QUATERNION", \
27  8, \
28  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_attitude_quaternion_t, time_boot_ms) }, \
29  { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_attitude_quaternion_t, q1) }, \
30  { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_quaternion_t, q2) }, \
31  { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_quaternion_t, q3) }, \
32  { "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_quaternion_t, q4) }, \
33  { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_quaternion_t, rollspeed) }, \
34  { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_quaternion_t, pitchspeed) }, \
35  { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_quaternion_t, yawspeed) }, \
36  } \
37 }
38 
39 
56 static inline uint16_t mavlink_msg_attitude_quaternion_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
57  uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
58 {
59 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
61  _mav_put_uint32_t(buf, 0, time_boot_ms);
62  _mav_put_float(buf, 4, q1);
63  _mav_put_float(buf, 8, q2);
64  _mav_put_float(buf, 12, q3);
65  _mav_put_float(buf, 16, q4);
66  _mav_put_float(buf, 20, rollspeed);
67  _mav_put_float(buf, 24, pitchspeed);
68  _mav_put_float(buf, 28, yawspeed);
69 
71 #else
73  packet.time_boot_ms = time_boot_ms;
74  packet.q1 = q1;
75  packet.q2 = q2;
76  packet.q3 = q3;
77  packet.q4 = q4;
78  packet.rollspeed = rollspeed;
79  packet.pitchspeed = pitchspeed;
80  packet.yawspeed = yawspeed;
81 
83 #endif
84 
86 #if MAVLINK_CRC_EXTRA
88 #else
89  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
90 #endif
91 }
92 
109 static inline uint16_t mavlink_msg_attitude_quaternion_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
110  mavlink_message_t* msg,
111  uint32_t time_boot_ms,float q1,float q2,float q3,float q4,float rollspeed,float pitchspeed,float yawspeed)
112 {
113 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115  _mav_put_uint32_t(buf, 0, time_boot_ms);
116  _mav_put_float(buf, 4, q1);
117  _mav_put_float(buf, 8, q2);
118  _mav_put_float(buf, 12, q3);
119  _mav_put_float(buf, 16, q4);
120  _mav_put_float(buf, 20, rollspeed);
121  _mav_put_float(buf, 24, pitchspeed);
122  _mav_put_float(buf, 28, yawspeed);
123 
125 #else
127  packet.time_boot_ms = time_boot_ms;
128  packet.q1 = q1;
129  packet.q2 = q2;
130  packet.q3 = q3;
131  packet.q4 = q4;
132  packet.rollspeed = rollspeed;
133  packet.pitchspeed = pitchspeed;
134  packet.yawspeed = yawspeed;
135 
137 #endif
138 
140 #if MAVLINK_CRC_EXTRA
142 #else
143  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
144 #endif
145 }
146 
155 static inline uint16_t mavlink_msg_attitude_quaternion_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_quaternion_t* attitude_quaternion)
156 {
157  return mavlink_msg_attitude_quaternion_pack(system_id, component_id, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed);
158 }
159 
169 static inline uint16_t mavlink_msg_attitude_quaternion_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_attitude_quaternion_t* attitude_quaternion)
170 {
171  return mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, chan, msg, attitude_quaternion->time_boot_ms, attitude_quaternion->q1, attitude_quaternion->q2, attitude_quaternion->q3, attitude_quaternion->q4, attitude_quaternion->rollspeed, attitude_quaternion->pitchspeed, attitude_quaternion->yawspeed);
172 }
173 
187 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
188 
189 static inline void mavlink_msg_attitude_quaternion_send(mavlink_channel_t chan, uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
190 {
191 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
194  _mav_put_float(buf, 4, q1);
195  _mav_put_float(buf, 8, q2);
196  _mav_put_float(buf, 12, q3);
197  _mav_put_float(buf, 16, q4);
198  _mav_put_float(buf, 20, rollspeed);
199  _mav_put_float(buf, 24, pitchspeed);
200  _mav_put_float(buf, 28, yawspeed);
201 
202 #if MAVLINK_CRC_EXTRA
204 #else
205  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
206 #endif
207 #else
209  packet.time_boot_ms = time_boot_ms;
210  packet.q1 = q1;
211  packet.q2 = q2;
212  packet.q3 = q3;
213  packet.q4 = q4;
214  packet.rollspeed = rollspeed;
215  packet.pitchspeed = pitchspeed;
216  packet.yawspeed = yawspeed;
217 
218 #if MAVLINK_CRC_EXTRA
219  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_CRC);
220 #else
221  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
222 #endif
223 #endif
224 }
225 
226 #if MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
227 /*
228  This varient of _send() can be used to save stack space by re-using
229  memory from the receive buffer. The caller provides a
230  mavlink_message_t which is the size of a full mavlink message. This
231  is usually the receive buffer for the channel, and allows a reply to an
232  incoming message with minimum stack space usage.
233  */
234 static inline void mavlink_msg_attitude_quaternion_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float q1, float q2, float q3, float q4, float rollspeed, float pitchspeed, float yawspeed)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237  char *buf = (char *)msgbuf;
239  _mav_put_float(buf, 4, q1);
240  _mav_put_float(buf, 8, q2);
241  _mav_put_float(buf, 12, q3);
242  _mav_put_float(buf, 16, q4);
243  _mav_put_float(buf, 20, rollspeed);
244  _mav_put_float(buf, 24, pitchspeed);
245  _mav_put_float(buf, 28, yawspeed);
246 
247 #if MAVLINK_CRC_EXTRA
249 #else
250  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, buf, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
251 #endif
252 #else
254  packet->time_boot_ms = time_boot_ms;
255  packet->q1 = q1;
256  packet->q2 = q2;
257  packet->q3 = q3;
258  packet->q4 = q4;
259  packet->rollspeed = rollspeed;
260  packet->pitchspeed = pitchspeed;
261  packet->yawspeed = yawspeed;
262 
263 #if MAVLINK_CRC_EXTRA
265 #else
266  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE_QUATERNION, (const char *)packet, MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
267 #endif
268 #endif
269 }
270 #endif
271 
272 #endif
273 
274 // MESSAGE ATTITUDE_QUATERNION UNPACKING
275 
276 
282 static inline uint32_t mavlink_msg_attitude_quaternion_get_time_boot_ms(const mavlink_message_t* msg)
283 {
284  return _MAV_RETURN_uint32_t(msg, 0);
285 }
286 
292 static inline float mavlink_msg_attitude_quaternion_get_q1(const mavlink_message_t* msg)
293 {
294  return _MAV_RETURN_float(msg, 4);
295 }
296 
302 static inline float mavlink_msg_attitude_quaternion_get_q2(const mavlink_message_t* msg)
303 {
304  return _MAV_RETURN_float(msg, 8);
305 }
306 
312 static inline float mavlink_msg_attitude_quaternion_get_q3(const mavlink_message_t* msg)
313 {
314  return _MAV_RETURN_float(msg, 12);
315 }
316 
322 static inline float mavlink_msg_attitude_quaternion_get_q4(const mavlink_message_t* msg)
323 {
324  return _MAV_RETURN_float(msg, 16);
325 }
326 
332 static inline float mavlink_msg_attitude_quaternion_get_rollspeed(const mavlink_message_t* msg)
333 {
334  return _MAV_RETURN_float(msg, 20);
335 }
336 
342 static inline float mavlink_msg_attitude_quaternion_get_pitchspeed(const mavlink_message_t* msg)
343 {
344  return _MAV_RETURN_float(msg, 24);
345 }
346 
352 static inline float mavlink_msg_attitude_quaternion_get_yawspeed(const mavlink_message_t* msg)
353 {
354  return _MAV_RETURN_float(msg, 28);
355 }
356 
363 static inline void mavlink_msg_attitude_quaternion_decode(const mavlink_message_t* msg, mavlink_attitude_quaternion_t* attitude_quaternion)
364 {
365 #if MAVLINK_NEED_BYTE_SWAP
367  attitude_quaternion->q1 = mavlink_msg_attitude_quaternion_get_q1(msg);
368  attitude_quaternion->q2 = mavlink_msg_attitude_quaternion_get_q2(msg);
369  attitude_quaternion->q3 = mavlink_msg_attitude_quaternion_get_q3(msg);
370  attitude_quaternion->q4 = mavlink_msg_attitude_quaternion_get_q4(msg);
371  attitude_quaternion->rollspeed = mavlink_msg_attitude_quaternion_get_rollspeed(msg);
373  attitude_quaternion->yawspeed = mavlink_msg_attitude_quaternion_get_yawspeed(msg);
374 #else
375  memcpy(attitude_quaternion, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_ATTITUDE_QUATERNION_LEN);
376 #endif
377 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:18