RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_actuator_control_target.h
1#pragma once
2// MESSAGE ACTUATOR_CONTROL_TARGET PACKING
3
4#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET 140
5
6MAVPACKED(
7typedef struct __mavlink_actuator_control_target_t {
8 uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
9 float controls[8]; /*< Actuator controls. Normed to -1..+1 where 0 is neutral position. Throttle for single rotation direction motors is 0..1, negative range for reverse direction. Standard mapping for attitude controls (group 0): (index 0-7): roll, pitch, yaw, throttle, flaps, spoilers, airbrakes, landing gear. Load a pass-through mixer to repurpose them as generic outputs.*/
10 uint8_t group_mlx; /*< Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.*/
11}) mavlink_actuator_control_target_t;
12
13#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN 41
14#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN 41
15#define MAVLINK_MSG_ID_140_LEN 41
16#define MAVLINK_MSG_ID_140_MIN_LEN 41
17
18#define MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC 181
19#define MAVLINK_MSG_ID_140_CRC 181
20
21#define MAVLINK_MSG_ACTUATOR_CONTROL_TARGET_FIELD_CONTROLS_LEN 8
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET { \
25 140, \
26 "ACTUATOR_CONTROL_TARGET", \
27 3, \
28 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_actuator_control_target_t, time_usec) }, \
29 { "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_actuator_control_target_t, group_mlx) }, \
30 { "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_actuator_control_target_t, controls) }, \
31 } \
32}
33#else
34#define MAVLINK_MESSAGE_INFO_ACTUATOR_CONTROL_TARGET { \
35 "ACTUATOR_CONTROL_TARGET", \
36 3, \
37 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_actuator_control_target_t, time_usec) }, \
38 { "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_actuator_control_target_t, group_mlx) }, \
39 { "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_actuator_control_target_t, controls) }, \
40 } \
41}
42#endif
43
55static inline uint16_t mavlink_msg_actuator_control_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
56 uint64_t time_usec, uint8_t group_mlx, const float *controls)
57{
58#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
59 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
60 _mav_put_uint64_t(buf, 0, time_usec);
61 _mav_put_uint8_t(buf, 40, group_mlx);
62 _mav_put_float_array(buf, 8, controls, 8);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
64#else
65 mavlink_actuator_control_target_t packet;
66 packet.time_usec = time_usec;
67 packet.group_mlx = group_mlx;
68 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
70#endif
71
72 msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
73 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
74}
75
87static inline uint16_t mavlink_msg_actuator_control_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
88 mavlink_message_t* msg,
89 uint64_t time_usec,uint8_t group_mlx,const float *controls)
90{
91#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
93 _mav_put_uint64_t(buf, 0, time_usec);
94 _mav_put_uint8_t(buf, 40, group_mlx);
95 _mav_put_float_array(buf, 8, controls, 8);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
97#else
98 mavlink_actuator_control_target_t packet;
99 packet.time_usec = time_usec;
100 packet.group_mlx = group_mlx;
101 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
102 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
103#endif
104
105 msg->msgid = MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET;
106 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
107}
108
117static inline uint16_t mavlink_msg_actuator_control_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
118{
119 return mavlink_msg_actuator_control_target_pack(system_id, component_id, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
120}
121
131static inline uint16_t mavlink_msg_actuator_control_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_actuator_control_target_t* actuator_control_target)
132{
133 return mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, chan, msg, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
134}
135
144#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
145
146static inline void mavlink_msg_actuator_control_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
147{
148#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf[MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN];
150 _mav_put_uint64_t(buf, 0, time_usec);
151 _mav_put_uint8_t(buf, 40, group_mlx);
152 _mav_put_float_array(buf, 8, controls, 8);
153 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
154#else
155 mavlink_actuator_control_target_t packet;
156 packet.time_usec = time_usec;
157 packet.group_mlx = group_mlx;
158 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
159 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
160#endif
161}
162
168static inline void mavlink_msg_actuator_control_target_send_struct(mavlink_channel_t chan, const mavlink_actuator_control_target_t* actuator_control_target)
169{
170#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171 mavlink_msg_actuator_control_target_send(chan, actuator_control_target->time_usec, actuator_control_target->group_mlx, actuator_control_target->controls);
172#else
173 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)actuator_control_target, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
174#endif
175}
176
177#if MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
178/*
179 This varient of _send() can be used to save stack space by re-using
180 memory from the receive buffer. The caller provides a
181 mavlink_message_t which is the size of a full mavlink message. This
182 is usually the receive buffer for the channel, and allows a reply to an
183 incoming message with minimum stack space usage.
184 */
185static inline void mavlink_msg_actuator_control_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, const float *controls)
186{
187#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
188 char *buf = (char *)msgbuf;
189 _mav_put_uint64_t(buf, 0, time_usec);
190 _mav_put_uint8_t(buf, 40, group_mlx);
191 _mav_put_float_array(buf, 8, controls, 8);
192 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
193#else
194 mavlink_actuator_control_target_t *packet = (mavlink_actuator_control_target_t *)msgbuf;
195 packet->time_usec = time_usec;
196 packet->group_mlx = group_mlx;
197 mav_array_memcpy(packet->controls, controls, sizeof(float)*8);
198 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_CRC);
199#endif
200}
201#endif
202
203#endif
204
205// MESSAGE ACTUATOR_CONTROL_TARGET UNPACKING
206
207
213static inline uint64_t mavlink_msg_actuator_control_target_get_time_usec(const mavlink_message_t* msg)
214{
215 return _MAV_RETURN_uint64_t(msg, 0);
216}
217
223static inline uint8_t mavlink_msg_actuator_control_target_get_group_mlx(const mavlink_message_t* msg)
224{
225 return _MAV_RETURN_uint8_t(msg, 40);
226}
227
233static inline uint16_t mavlink_msg_actuator_control_target_get_controls(const mavlink_message_t* msg, float *controls)
234{
235 return _MAV_RETURN_float_array(msg, controls, 8, 8);
236}
237
244static inline void mavlink_msg_actuator_control_target_decode(const mavlink_message_t* msg, mavlink_actuator_control_target_t* actuator_control_target)
245{
246#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247 actuator_control_target->time_usec = mavlink_msg_actuator_control_target_get_time_usec(msg);
248 mavlink_msg_actuator_control_target_get_controls(msg, actuator_control_target->controls);
249 actuator_control_target->group_mlx = mavlink_msg_actuator_control_target_get_group_mlx(msg);
250#else
251 uint8_t len = msg->len < MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN? msg->len : MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN;
252 memset(actuator_control_target, 0, MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_LEN);
253 memcpy(actuator_control_target, _MAV_PAYLOAD(msg), len);
254#endif
255}