RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_mount_control.h
1#pragma once
2// MESSAGE MOUNT_CONTROL PACKING
3
4#define MAVLINK_MSG_ID_MOUNT_CONTROL 157
5
6MAVPACKED(
7typedef struct __mavlink_mount_control_t {
8 int32_t input_a; /*< pitch(deg*100) or lat, depending on mount mode*/
9 int32_t input_b; /*< roll(deg*100) or lon depending on mount mode*/
10 int32_t input_c; /*< yaw(deg*100) or alt (in cm) depending on mount mode*/
11 uint8_t target_system; /*< System ID*/
12 uint8_t target_component; /*< Component ID*/
13 uint8_t save_position; /*< if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)*/
14}) mavlink_mount_control_t;
15
16#define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15
17#define MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN 15
18#define MAVLINK_MSG_ID_157_LEN 15
19#define MAVLINK_MSG_ID_157_MIN_LEN 15
20
21#define MAVLINK_MSG_ID_MOUNT_CONTROL_CRC 21
22#define MAVLINK_MSG_ID_157_CRC 21
23
24
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
28 157, \
29 "MOUNT_CONTROL", \
30 6, \
31 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \
32 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \
33 { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \
34 { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \
35 { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \
36 { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
41 "MOUNT_CONTROL", \
42 6, \
43 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \
45 { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \
46 { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \
47 { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \
48 { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
49 } \
50}
51#endif
52
67static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
72 _mav_put_int32_t(buf, 0, input_a);
73 _mav_put_int32_t(buf, 4, input_b);
74 _mav_put_int32_t(buf, 8, input_c);
75 _mav_put_uint8_t(buf, 12, target_system);
76 _mav_put_uint8_t(buf, 13, target_component);
77 _mav_put_uint8_t(buf, 14, save_position);
78
79 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
80#else
81 mavlink_mount_control_t packet;
82 packet.input_a = input_a;
83 packet.input_b = input_b;
84 packet.input_c = input_c;
85 packet.target_system = target_system;
86 packet.target_component = target_component;
87 packet.save_position = save_position;
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
90#endif
91
92 msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
93 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
94}
95
110static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
111 mavlink_message_t* msg,
112 uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position)
113{
114#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115 char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
116 _mav_put_int32_t(buf, 0, input_a);
117 _mav_put_int32_t(buf, 4, input_b);
118 _mav_put_int32_t(buf, 8, input_c);
119 _mav_put_uint8_t(buf, 12, target_system);
120 _mav_put_uint8_t(buf, 13, target_component);
121 _mav_put_uint8_t(buf, 14, save_position);
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
124#else
125 mavlink_mount_control_t packet;
126 packet.input_a = input_a;
127 packet.input_b = input_b;
128 packet.input_c = input_c;
129 packet.target_system = target_system;
130 packet.target_component = target_component;
131 packet.save_position = save_position;
132
133 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
134#endif
135
136 msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
137 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
138}
139
148static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
149{
150 return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
151}
152
162static inline uint16_t mavlink_msg_mount_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
163{
164 return mavlink_msg_mount_control_pack_chan(system_id, component_id, chan, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
165}
166
178#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179
180static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN];
184 _mav_put_int32_t(buf, 0, input_a);
185 _mav_put_int32_t(buf, 4, input_b);
186 _mav_put_int32_t(buf, 8, input_c);
187 _mav_put_uint8_t(buf, 12, target_system);
188 _mav_put_uint8_t(buf, 13, target_component);
189 _mav_put_uint8_t(buf, 14, save_position);
190
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
192#else
193 mavlink_mount_control_t packet;
194 packet.input_a = input_a;
195 packet.input_b = input_b;
196 packet.input_c = input_c;
197 packet.target_system = target_system;
198 packet.target_component = target_component;
199 packet.save_position = save_position;
200
201 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
202#endif
203}
204
210static inline void mavlink_msg_mount_control_send_struct(mavlink_channel_t chan, const mavlink_mount_control_t* mount_control)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 mavlink_msg_mount_control_send(chan, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
214#else
215 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)mount_control, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
216#endif
217}
218
219#if MAVLINK_MSG_ID_MOUNT_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
220/*
221 This varient of _send() can be used to save stack space by re-using
222 memory from the receive buffer. The caller provides a
223 mavlink_message_t which is the size of a full mavlink message. This
224 is usually the receive buffer for the channel, and allows a reply to an
225 incoming message with minimum stack space usage.
226 */
227static inline void mavlink_msg_mount_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 char *buf = (char *)msgbuf;
231 _mav_put_int32_t(buf, 0, input_a);
232 _mav_put_int32_t(buf, 4, input_b);
233 _mav_put_int32_t(buf, 8, input_c);
234 _mav_put_uint8_t(buf, 12, target_system);
235 _mav_put_uint8_t(buf, 13, target_component);
236 _mav_put_uint8_t(buf, 14, save_position);
237
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
239#else
240 mavlink_mount_control_t *packet = (mavlink_mount_control_t *)msgbuf;
241 packet->input_a = input_a;
242 packet->input_b = input_b;
243 packet->input_c = input_c;
244 packet->target_system = target_system;
245 packet->target_component = target_component;
246 packet->save_position = save_position;
247
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_MIN_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC);
249#endif
250}
251#endif
252
253#endif
254
255// MESSAGE MOUNT_CONTROL UNPACKING
256
257
263static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg)
264{
265 return _MAV_RETURN_uint8_t(msg, 12);
266}
267
273static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg)
274{
275 return _MAV_RETURN_uint8_t(msg, 13);
276}
277
283static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg)
284{
285 return _MAV_RETURN_int32_t(msg, 0);
286}
287
293static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg)
294{
295 return _MAV_RETURN_int32_t(msg, 4);
296}
297
303static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg)
304{
305 return _MAV_RETURN_int32_t(msg, 8);
306}
307
313static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg)
314{
315 return _MAV_RETURN_uint8_t(msg, 14);
316}
317
324static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control)
325{
326#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
327 mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg);
328 mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg);
329 mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg);
330 mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg);
331 mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg);
332 mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg);
333#else
334 uint8_t len = msg->len < MAVLINK_MSG_ID_MOUNT_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_MOUNT_CONTROL_LEN;
335 memset(mount_control, 0, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN);
336 memcpy(mount_control, _MAV_PAYLOAD(msg), len);
337#endif
338}