RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_mount_orientation.h
1#pragma once
2// MESSAGE MOUNT_ORIENTATION PACKING
3
4#define MAVLINK_MSG_ID_MOUNT_ORIENTATION 265
5
6MAVPACKED(
7typedef struct __mavlink_mount_orientation_t {
8 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
9 float roll; /*< Roll in degrees*/
10 float pitch; /*< Pitch in degrees*/
11 float yaw; /*< Yaw in degrees*/
12}) mavlink_mount_orientation_t;
13
14#define MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN 16
15#define MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN 16
16#define MAVLINK_MSG_ID_265_LEN 16
17#define MAVLINK_MSG_ID_265_MIN_LEN 16
18
19#define MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC 26
20#define MAVLINK_MSG_ID_265_CRC 26
21
22
23
24#if MAVLINK_COMMAND_24BIT
25#define MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION { \
26 265, \
27 "MOUNT_ORIENTATION", \
28 4, \
29 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_mount_orientation_t, time_boot_ms) }, \
30 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mount_orientation_t, roll) }, \
31 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mount_orientation_t, pitch) }, \
32 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mount_orientation_t, yaw) }, \
33 } \
34}
35#else
36#define MAVLINK_MESSAGE_INFO_MOUNT_ORIENTATION { \
37 "MOUNT_ORIENTATION", \
38 4, \
39 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_mount_orientation_t, time_boot_ms) }, \
40 { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_mount_orientation_t, roll) }, \
41 { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_mount_orientation_t, pitch) }, \
42 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_mount_orientation_t, yaw) }, \
43 } \
44}
45#endif
46
59static inline uint16_t mavlink_msg_mount_orientation_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60 uint32_t time_boot_ms, float roll, float pitch, float yaw)
61{
62#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf[MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN];
64 _mav_put_uint32_t(buf, 0, time_boot_ms);
65 _mav_put_float(buf, 4, roll);
66 _mav_put_float(buf, 8, pitch);
67 _mav_put_float(buf, 12, yaw);
68
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN);
70#else
71 mavlink_mount_orientation_t packet;
72 packet.time_boot_ms = time_boot_ms;
73 packet.roll = roll;
74 packet.pitch = pitch;
75 packet.yaw = yaw;
76
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN);
78#endif
79
80 msg->msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION;
81 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
82}
83
96static inline uint16_t mavlink_msg_mount_orientation_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
97 mavlink_message_t* msg,
98 uint32_t time_boot_ms,float roll,float pitch,float yaw)
99{
100#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf[MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN];
102 _mav_put_uint32_t(buf, 0, time_boot_ms);
103 _mav_put_float(buf, 4, roll);
104 _mav_put_float(buf, 8, pitch);
105 _mav_put_float(buf, 12, yaw);
106
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN);
108#else
109 mavlink_mount_orientation_t packet;
110 packet.time_boot_ms = time_boot_ms;
111 packet.roll = roll;
112 packet.pitch = pitch;
113 packet.yaw = yaw;
114
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN);
116#endif
117
118 msg->msgid = MAVLINK_MSG_ID_MOUNT_ORIENTATION;
119 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
120}
121
130static inline uint16_t mavlink_msg_mount_orientation_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_orientation_t* mount_orientation)
131{
132 return mavlink_msg_mount_orientation_pack(system_id, component_id, msg, mount_orientation->time_boot_ms, mount_orientation->roll, mount_orientation->pitch, mount_orientation->yaw);
133}
134
144static inline uint16_t mavlink_msg_mount_orientation_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_orientation_t* mount_orientation)
145{
146 return mavlink_msg_mount_orientation_pack_chan(system_id, component_id, chan, msg, mount_orientation->time_boot_ms, mount_orientation->roll, mount_orientation->pitch, mount_orientation->yaw);
147}
148
158#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
159
160static inline void mavlink_msg_mount_orientation_send(mavlink_channel_t chan, uint32_t time_boot_ms, float roll, float pitch, float yaw)
161{
162#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
163 char buf[MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN];
164 _mav_put_uint32_t(buf, 0, time_boot_ms);
165 _mav_put_float(buf, 4, roll);
166 _mav_put_float(buf, 8, pitch);
167 _mav_put_float(buf, 12, yaw);
168
169 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION, buf, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
170#else
171 mavlink_mount_orientation_t packet;
172 packet.time_boot_ms = time_boot_ms;
173 packet.roll = roll;
174 packet.pitch = pitch;
175 packet.yaw = yaw;
176
177 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
178#endif
179}
180
186static inline void mavlink_msg_mount_orientation_send_struct(mavlink_channel_t chan, const mavlink_mount_orientation_t* mount_orientation)
187{
188#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
189 mavlink_msg_mount_orientation_send(chan, mount_orientation->time_boot_ms, mount_orientation->roll, mount_orientation->pitch, mount_orientation->yaw);
190#else
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION, (const char *)mount_orientation, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
192#endif
193}
194
195#if MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
196/*
197 This varient of _send() can be used to save stack space by re-using
198 memory from the receive buffer. The caller provides a
199 mavlink_message_t which is the size of a full mavlink message. This
200 is usually the receive buffer for the channel, and allows a reply to an
201 incoming message with minimum stack space usage.
202 */
203static inline void mavlink_msg_mount_orientation_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, float roll, float pitch, float yaw)
204{
205#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206 char *buf = (char *)msgbuf;
207 _mav_put_uint32_t(buf, 0, time_boot_ms);
208 _mav_put_float(buf, 4, roll);
209 _mav_put_float(buf, 8, pitch);
210 _mav_put_float(buf, 12, yaw);
211
212 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION, buf, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
213#else
214 mavlink_mount_orientation_t *packet = (mavlink_mount_orientation_t *)msgbuf;
215 packet->time_boot_ms = time_boot_ms;
216 packet->roll = roll;
217 packet->pitch = pitch;
218 packet->yaw = yaw;
219
220 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_ORIENTATION, (const char *)packet, MAVLINK_MSG_ID_MOUNT_ORIENTATION_MIN_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN, MAVLINK_MSG_ID_MOUNT_ORIENTATION_CRC);
221#endif
222}
223#endif
224
225#endif
226
227// MESSAGE MOUNT_ORIENTATION UNPACKING
228
229
235static inline uint32_t mavlink_msg_mount_orientation_get_time_boot_ms(const mavlink_message_t* msg)
236{
237 return _MAV_RETURN_uint32_t(msg, 0);
238}
239
245static inline float mavlink_msg_mount_orientation_get_roll(const mavlink_message_t* msg)
246{
247 return _MAV_RETURN_float(msg, 4);
248}
249
255static inline float mavlink_msg_mount_orientation_get_pitch(const mavlink_message_t* msg)
256{
257 return _MAV_RETURN_float(msg, 8);
258}
259
265static inline float mavlink_msg_mount_orientation_get_yaw(const mavlink_message_t* msg)
266{
267 return _MAV_RETURN_float(msg, 12);
268}
269
276static inline void mavlink_msg_mount_orientation_decode(const mavlink_message_t* msg, mavlink_mount_orientation_t* mount_orientation)
277{
278#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
279 mount_orientation->time_boot_ms = mavlink_msg_mount_orientation_get_time_boot_ms(msg);
280 mount_orientation->roll = mavlink_msg_mount_orientation_get_roll(msg);
281 mount_orientation->pitch = mavlink_msg_mount_orientation_get_pitch(msg);
282 mount_orientation->yaw = mavlink_msg_mount_orientation_get_yaw(msg);
283#else
284 uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN;
285 memset(mount_orientation, 0, MAVLINK_MSG_ID_MOUNT_ORIENTATION_LEN);
286 memcpy(mount_orientation, _MAV_PAYLOAD(msg), len);
287#endif
288}