source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/mavlink_generated_messages/common/mavlink_msg_set_actuator_control_target.h@ 46

Last change on this file since 46 was 46, checked in by Thomas Fuhrmann, 8 years ago

Add the mavlink branch

File size: 16.9 KB
Line 
1// MESSAGE SET_ACTUATOR_CONTROL_TARGET PACKING
2
3#define MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET 139
4
5MAVPACKED(
6typedef struct __mavlink_set_actuator_control_target_t {
7 uint64_t time_usec; /*< Timestamp (micros since boot or Unix epoch)*/
8 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.*/
9 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.*/
10 uint8_t target_system; /*< System ID*/
11 uint8_t target_component; /*< Component ID*/
12}) mavlink_set_actuator_control_target_t;
13
14#define MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN 43
15#define MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN 43
16#define MAVLINK_MSG_ID_139_LEN 43
17#define MAVLINK_MSG_ID_139_MIN_LEN 43
18
19#define MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC 168
20#define MAVLINK_MSG_ID_139_CRC 168
21
22#define MAVLINK_MSG_SET_ACTUATOR_CONTROL_TARGET_FIELD_CONTROLS_LEN 8
23
24#if MAVLINK_COMMAND_24BIT
25#define MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET { \
26 139, \
27 "SET_ACTUATOR_CONTROL_TARGET", \
28 5, \
29 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_set_actuator_control_target_t, time_usec) }, \
30 { "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_set_actuator_control_target_t, controls) }, \
31 { "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_set_actuator_control_target_t, group_mlx) }, \
32 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_set_actuator_control_target_t, target_system) }, \
33 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_set_actuator_control_target_t, target_component) }, \
34 } \
35}
36#else
37#define MAVLINK_MESSAGE_INFO_SET_ACTUATOR_CONTROL_TARGET { \
38 "SET_ACTUATOR_CONTROL_TARGET", \
39 5, \
40 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_set_actuator_control_target_t, time_usec) }, \
41 { "controls", NULL, MAVLINK_TYPE_FLOAT, 8, 8, offsetof(mavlink_set_actuator_control_target_t, controls) }, \
42 { "group_mlx", NULL, MAVLINK_TYPE_UINT8_T, 0, 40, offsetof(mavlink_set_actuator_control_target_t, group_mlx) }, \
43 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 41, offsetof(mavlink_set_actuator_control_target_t, target_system) }, \
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_set_actuator_control_target_t, target_component) }, \
45 } \
46}
47#endif
48
49/**
50 * @brief Pack a set_actuator_control_target message
51 * @param system_id ID of this system
52 * @param component_id ID of this component (e.g. 200 for IMU)
53 * @param msg The MAVLink message to compress the data into
54 *
55 * @param time_usec Timestamp (micros since boot or Unix epoch)
56 * @param 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.
57 * @param target_system System ID
58 * @param target_component Component ID
59 * @param controls 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.
60 * @return length of the message in bytes (excluding serial stream start sign)
61 */
62static inline uint16_t mavlink_msg_set_actuator_control_target_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63 uint64_t time_usec, uint8_t group_mlx, uint8_t target_system, uint8_t target_component, const float *controls)
64{
65#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66 char buf[MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN];
67 _mav_put_uint64_t(buf, 0, time_usec);
68 _mav_put_uint8_t(buf, 40, group_mlx);
69 _mav_put_uint8_t(buf, 41, target_system);
70 _mav_put_uint8_t(buf, 42, target_component);
71 _mav_put_float_array(buf, 8, controls, 8);
72 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN);
73#else
74 mavlink_set_actuator_control_target_t packet;
75 packet.time_usec = time_usec;
76 packet.group_mlx = group_mlx;
77 packet.target_system = target_system;
78 packet.target_component = target_component;
79 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
80 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN);
81#endif
82
83 msg->msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET;
84 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
85}
86
87/**
88 * @brief Pack a set_actuator_control_target message on a channel
89 * @param system_id ID of this system
90 * @param component_id ID of this component (e.g. 200 for IMU)
91 * @param chan The MAVLink channel this message will be sent over
92 * @param msg The MAVLink message to compress the data into
93 * @param time_usec Timestamp (micros since boot or Unix epoch)
94 * @param 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.
95 * @param target_system System ID
96 * @param target_component Component ID
97 * @param controls 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.
98 * @return length of the message in bytes (excluding serial stream start sign)
99 */
100static inline uint16_t mavlink_msg_set_actuator_control_target_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
101 mavlink_message_t* msg,
102 uint64_t time_usec,uint8_t group_mlx,uint8_t target_system,uint8_t target_component,const float *controls)
103{
104#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
105 char buf[MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN];
106 _mav_put_uint64_t(buf, 0, time_usec);
107 _mav_put_uint8_t(buf, 40, group_mlx);
108 _mav_put_uint8_t(buf, 41, target_system);
109 _mav_put_uint8_t(buf, 42, target_component);
110 _mav_put_float_array(buf, 8, controls, 8);
111 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN);
112#else
113 mavlink_set_actuator_control_target_t packet;
114 packet.time_usec = time_usec;
115 packet.group_mlx = group_mlx;
116 packet.target_system = target_system;
117 packet.target_component = target_component;
118 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
119 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN);
120#endif
121
122 msg->msgid = MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET;
123 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
124}
125
126/**
127 * @brief Encode a set_actuator_control_target struct
128 *
129 * @param system_id ID of this system
130 * @param component_id ID of this component (e.g. 200 for IMU)
131 * @param msg The MAVLink message to compress the data into
132 * @param set_actuator_control_target C-struct to read the message contents from
133 */
134static inline uint16_t mavlink_msg_set_actuator_control_target_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_actuator_control_target_t* set_actuator_control_target)
135{
136 return mavlink_msg_set_actuator_control_target_pack(system_id, component_id, msg, set_actuator_control_target->time_usec, set_actuator_control_target->group_mlx, set_actuator_control_target->target_system, set_actuator_control_target->target_component, set_actuator_control_target->controls);
137}
138
139/**
140 * @brief Encode a set_actuator_control_target struct on a channel
141 *
142 * @param system_id ID of this system
143 * @param component_id ID of this component (e.g. 200 for IMU)
144 * @param chan The MAVLink channel this message will be sent over
145 * @param msg The MAVLink message to compress the data into
146 * @param set_actuator_control_target C-struct to read the message contents from
147 */
148static inline uint16_t mavlink_msg_set_actuator_control_target_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_actuator_control_target_t* set_actuator_control_target)
149{
150 return mavlink_msg_set_actuator_control_target_pack_chan(system_id, component_id, chan, msg, set_actuator_control_target->time_usec, set_actuator_control_target->group_mlx, set_actuator_control_target->target_system, set_actuator_control_target->target_component, set_actuator_control_target->controls);
151}
152
153/**
154 * @brief Send a set_actuator_control_target message
155 * @param chan MAVLink channel to send the message
156 *
157 * @param time_usec Timestamp (micros since boot or Unix epoch)
158 * @param 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.
159 * @param target_system System ID
160 * @param target_component Component ID
161 * @param controls 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.
162 */
163#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
164
165static inline void mavlink_msg_set_actuator_control_target_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, uint8_t target_system, uint8_t target_component, const float *controls)
166{
167#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
168 char buf[MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN];
169 _mav_put_uint64_t(buf, 0, time_usec);
170 _mav_put_uint8_t(buf, 40, group_mlx);
171 _mav_put_uint8_t(buf, 41, target_system);
172 _mav_put_uint8_t(buf, 42, target_component);
173 _mav_put_float_array(buf, 8, controls, 8);
174 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
175#else
176 mavlink_set_actuator_control_target_t packet;
177 packet.time_usec = time_usec;
178 packet.group_mlx = group_mlx;
179 packet.target_system = target_system;
180 packet.target_component = target_component;
181 mav_array_memcpy(packet.controls, controls, sizeof(float)*8);
182 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, (const char *)&packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
183#endif
184}
185
186/**
187 * @brief Send a set_actuator_control_target message
188 * @param chan MAVLink channel to send the message
189 * @param struct The MAVLink struct to serialize
190 */
191static inline void mavlink_msg_set_actuator_control_target_send_struct(mavlink_channel_t chan, const mavlink_set_actuator_control_target_t* set_actuator_control_target)
192{
193#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
194 mavlink_msg_set_actuator_control_target_send(chan, set_actuator_control_target->time_usec, set_actuator_control_target->group_mlx, set_actuator_control_target->target_system, set_actuator_control_target->target_component, set_actuator_control_target->controls);
195#else
196 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, (const char *)set_actuator_control_target, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
197#endif
198}
199
200#if MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
201/*
202 This varient of _send() can be used to save stack space by re-using
203 memory from the receive buffer. The caller provides a
204 mavlink_message_t which is the size of a full mavlink message. This
205 is usually the receive buffer for the channel, and allows a reply to an
206 incoming message with minimum stack space usage.
207 */
208static inline void mavlink_msg_set_actuator_control_target_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t group_mlx, uint8_t target_system, uint8_t target_component, const float *controls)
209{
210#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211 char *buf = (char *)msgbuf;
212 _mav_put_uint64_t(buf, 0, time_usec);
213 _mav_put_uint8_t(buf, 40, group_mlx);
214 _mav_put_uint8_t(buf, 41, target_system);
215 _mav_put_uint8_t(buf, 42, target_component);
216 _mav_put_float_array(buf, 8, controls, 8);
217 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, buf, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
218#else
219 mavlink_set_actuator_control_target_t *packet = (mavlink_set_actuator_control_target_t *)msgbuf;
220 packet->time_usec = time_usec;
221 packet->group_mlx = group_mlx;
222 packet->target_system = target_system;
223 packet->target_component = target_component;
224 mav_array_memcpy(packet->controls, controls, sizeof(float)*8);
225 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET, (const char *)packet, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_CRC);
226#endif
227}
228#endif
229
230#endif
231
232// MESSAGE SET_ACTUATOR_CONTROL_TARGET UNPACKING
233
234
235/**
236 * @brief Get field time_usec from set_actuator_control_target message
237 *
238 * @return Timestamp (micros since boot or Unix epoch)
239 */
240static inline uint64_t mavlink_msg_set_actuator_control_target_get_time_usec(const mavlink_message_t* msg)
241{
242 return _MAV_RETURN_uint64_t(msg, 0);
243}
244
245/**
246 * @brief Get field group_mlx from set_actuator_control_target message
247 *
248 * @return Actuator group. The "_mlx" indicates this is a multi-instance message and a MAVLink parser should use this field to difference between instances.
249 */
250static inline uint8_t mavlink_msg_set_actuator_control_target_get_group_mlx(const mavlink_message_t* msg)
251{
252 return _MAV_RETURN_uint8_t(msg, 40);
253}
254
255/**
256 * @brief Get field target_system from set_actuator_control_target message
257 *
258 * @return System ID
259 */
260static inline uint8_t mavlink_msg_set_actuator_control_target_get_target_system(const mavlink_message_t* msg)
261{
262 return _MAV_RETURN_uint8_t(msg, 41);
263}
264
265/**
266 * @brief Get field target_component from set_actuator_control_target message
267 *
268 * @return Component ID
269 */
270static inline uint8_t mavlink_msg_set_actuator_control_target_get_target_component(const mavlink_message_t* msg)
271{
272 return _MAV_RETURN_uint8_t(msg, 42);
273}
274
275/**
276 * @brief Get field controls from set_actuator_control_target message
277 *
278 * @return 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.
279 */
280static inline uint16_t mavlink_msg_set_actuator_control_target_get_controls(const mavlink_message_t* msg, float *controls)
281{
282 return _MAV_RETURN_float_array(msg, controls, 8, 8);
283}
284
285/**
286 * @brief Decode a set_actuator_control_target message into a struct
287 *
288 * @param msg The message to decode
289 * @param set_actuator_control_target C-struct to decode the message contents into
290 */
291static inline void mavlink_msg_set_actuator_control_target_decode(const mavlink_message_t* msg, mavlink_set_actuator_control_target_t* set_actuator_control_target)
292{
293#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
294 set_actuator_control_target->time_usec = mavlink_msg_set_actuator_control_target_get_time_usec(msg);
295 mavlink_msg_set_actuator_control_target_get_controls(msg, set_actuator_control_target->controls);
296 set_actuator_control_target->group_mlx = mavlink_msg_set_actuator_control_target_get_group_mlx(msg);
297 set_actuator_control_target->target_system = mavlink_msg_set_actuator_control_target_get_target_system(msg);
298 set_actuator_control_target->target_component = mavlink_msg_set_actuator_control_target_get_target_component(msg);
299#else
300 uint8_t len = msg->len < MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN? msg->len : MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN;
301 memset(set_actuator_control_target, 0, MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_LEN);
302 memcpy(set_actuator_control_target, _MAV_PAYLOAD(msg), len);
303#endif
304}
Note: See TracBrowser for help on using the repository browser.