source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_position_target_local_ned.h@ 76

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

Change the version of mavlink generated messages and rename it to include

File size: 27.0 KB
Line 
1// MESSAGE POSITION_TARGET_LOCAL_NED PACKING
2
3#define MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED 85
4
5typedef struct MAVLINK_PACKED __mavlink_position_target_local_ned_t
6{
7 uint32_t time_boot_ms; /*< Timestamp in milliseconds since system boot*/
8 float x; /*< X Position in NED frame in meters*/
9 float y; /*< Y Position in NED frame in meters*/
10 float z; /*< Z Position in NED frame in meters (note, altitude is negative in NED)*/
11 float vx; /*< X velocity in NED frame in meter / s*/
12 float vy; /*< Y velocity in NED frame in meter / s*/
13 float vz; /*< Z velocity in NED frame in meter / s*/
14 float afx; /*< X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
15 float afy; /*< Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
16 float afz; /*< Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
17 float yaw; /*< yaw setpoint in rad*/
18 float yaw_rate; /*< yaw rate setpoint in rad/s*/
19 uint16_t type_mask; /*< Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate*/
20 uint8_t coordinate_frame; /*< Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9*/
21} mavlink_position_target_local_ned_t;
22
23#define MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN 51
24#define MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN 51
25#define MAVLINK_MSG_ID_85_LEN 51
26#define MAVLINK_MSG_ID_85_MIN_LEN 51
27
28#define MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC 140
29#define MAVLINK_MSG_ID_85_CRC 140
30
31
32
33#if MAVLINK_COMMAND_24BIT
34#define MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED { \
35 85, \
36 "POSITION_TARGET_LOCAL_NED", \
37 14, \
38 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_position_target_local_ned_t, time_boot_ms) }, \
39 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_position_target_local_ned_t, x) }, \
40 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_position_target_local_ned_t, y) }, \
41 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_position_target_local_ned_t, z) }, \
42 { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_position_target_local_ned_t, vx) }, \
43 { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_position_target_local_ned_t, vy) }, \
44 { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_position_target_local_ned_t, vz) }, \
45 { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_position_target_local_ned_t, afx) }, \
46 { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_position_target_local_ned_t, afy) }, \
47 { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_position_target_local_ned_t, afz) }, \
48 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_position_target_local_ned_t, yaw) }, \
49 { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_position_target_local_ned_t, yaw_rate) }, \
50 { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_position_target_local_ned_t, type_mask) }, \
51 { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_position_target_local_ned_t, coordinate_frame) }, \
52 } \
53}
54#else
55#define MAVLINK_MESSAGE_INFO_POSITION_TARGET_LOCAL_NED { \
56 "POSITION_TARGET_LOCAL_NED", \
57 14, \
58 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_position_target_local_ned_t, time_boot_ms) }, \
59 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_position_target_local_ned_t, x) }, \
60 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_position_target_local_ned_t, y) }, \
61 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_position_target_local_ned_t, z) }, \
62 { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_position_target_local_ned_t, vx) }, \
63 { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_position_target_local_ned_t, vy) }, \
64 { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_position_target_local_ned_t, vz) }, \
65 { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_position_target_local_ned_t, afx) }, \
66 { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_position_target_local_ned_t, afy) }, \
67 { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_position_target_local_ned_t, afz) }, \
68 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_position_target_local_ned_t, yaw) }, \
69 { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_position_target_local_ned_t, yaw_rate) }, \
70 { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_position_target_local_ned_t, type_mask) }, \
71 { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_position_target_local_ned_t, coordinate_frame) }, \
72 } \
73}
74#endif
75
76/**
77 * @brief Pack a position_target_local_ned message
78 * @param system_id ID of this system
79 * @param component_id ID of this component (e.g. 200 for IMU)
80 * @param msg The MAVLink message to compress the data into
81 *
82 * @param time_boot_ms Timestamp in milliseconds since system boot
83 * @param coordinate_frame Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9
84 * @param type_mask Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate
85 * @param x X Position in NED frame in meters
86 * @param y Y Position in NED frame in meters
87 * @param z Z Position in NED frame in meters (note, altitude is negative in NED)
88 * @param vx X velocity in NED frame in meter / s
89 * @param vy Y velocity in NED frame in meter / s
90 * @param vz Z velocity in NED frame in meter / s
91 * @param afx X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
92 * @param afy Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
93 * @param afz Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
94 * @param yaw yaw setpoint in rad
95 * @param yaw_rate yaw rate setpoint in rad/s
96 * @return length of the message in bytes (excluding serial stream start sign)
97 */
98static inline uint16_t mavlink_msg_position_target_local_ned_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
99 uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, float x, float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
100{
101#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
102 char buf[MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN];
103 _mav_put_uint32_t(buf, 0, time_boot_ms);
104 _mav_put_float(buf, 4, x);
105 _mav_put_float(buf, 8, y);
106 _mav_put_float(buf, 12, z);
107 _mav_put_float(buf, 16, vx);
108 _mav_put_float(buf, 20, vy);
109 _mav_put_float(buf, 24, vz);
110 _mav_put_float(buf, 28, afx);
111 _mav_put_float(buf, 32, afy);
112 _mav_put_float(buf, 36, afz);
113 _mav_put_float(buf, 40, yaw);
114 _mav_put_float(buf, 44, yaw_rate);
115 _mav_put_uint16_t(buf, 48, type_mask);
116 _mav_put_uint8_t(buf, 50, coordinate_frame);
117
118 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN);
119#else
120 mavlink_position_target_local_ned_t packet;
121 packet.time_boot_ms = time_boot_ms;
122 packet.x = x;
123 packet.y = y;
124 packet.z = z;
125 packet.vx = vx;
126 packet.vy = vy;
127 packet.vz = vz;
128 packet.afx = afx;
129 packet.afy = afy;
130 packet.afz = afz;
131 packet.yaw = yaw;
132 packet.yaw_rate = yaw_rate;
133 packet.type_mask = type_mask;
134 packet.coordinate_frame = coordinate_frame;
135
136 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN);
137#endif
138
139 msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
140 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
141}
142
143/**
144 * @brief Pack a position_target_local_ned message on a channel
145 * @param system_id ID of this system
146 * @param component_id ID of this component (e.g. 200 for IMU)
147 * @param chan The MAVLink channel this message will be sent over
148 * @param msg The MAVLink message to compress the data into
149 * @param time_boot_ms Timestamp in milliseconds since system boot
150 * @param coordinate_frame Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9
151 * @param type_mask Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate
152 * @param x X Position in NED frame in meters
153 * @param y Y Position in NED frame in meters
154 * @param z Z Position in NED frame in meters (note, altitude is negative in NED)
155 * @param vx X velocity in NED frame in meter / s
156 * @param vy Y velocity in NED frame in meter / s
157 * @param vz Z velocity in NED frame in meter / s
158 * @param afx X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
159 * @param afy Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
160 * @param afz Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
161 * @param yaw yaw setpoint in rad
162 * @param yaw_rate yaw rate setpoint in rad/s
163 * @return length of the message in bytes (excluding serial stream start sign)
164 */
165static inline uint16_t mavlink_msg_position_target_local_ned_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
166 mavlink_message_t* msg,
167 uint32_t time_boot_ms,uint8_t coordinate_frame,uint16_t type_mask,float x,float y,float z,float vx,float vy,float vz,float afx,float afy,float afz,float yaw,float yaw_rate)
168{
169#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
170 char buf[MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN];
171 _mav_put_uint32_t(buf, 0, time_boot_ms);
172 _mav_put_float(buf, 4, x);
173 _mav_put_float(buf, 8, y);
174 _mav_put_float(buf, 12, z);
175 _mav_put_float(buf, 16, vx);
176 _mav_put_float(buf, 20, vy);
177 _mav_put_float(buf, 24, vz);
178 _mav_put_float(buf, 28, afx);
179 _mav_put_float(buf, 32, afy);
180 _mav_put_float(buf, 36, afz);
181 _mav_put_float(buf, 40, yaw);
182 _mav_put_float(buf, 44, yaw_rate);
183 _mav_put_uint16_t(buf, 48, type_mask);
184 _mav_put_uint8_t(buf, 50, coordinate_frame);
185
186 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN);
187#else
188 mavlink_position_target_local_ned_t packet;
189 packet.time_boot_ms = time_boot_ms;
190 packet.x = x;
191 packet.y = y;
192 packet.z = z;
193 packet.vx = vx;
194 packet.vy = vy;
195 packet.vz = vz;
196 packet.afx = afx;
197 packet.afy = afy;
198 packet.afz = afz;
199 packet.yaw = yaw;
200 packet.yaw_rate = yaw_rate;
201 packet.type_mask = type_mask;
202 packet.coordinate_frame = coordinate_frame;
203
204 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN);
205#endif
206
207 msg->msgid = MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED;
208 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
209}
210
211/**
212 * @brief Encode a position_target_local_ned struct
213 *
214 * @param system_id ID of this system
215 * @param component_id ID of this component (e.g. 200 for IMU)
216 * @param msg The MAVLink message to compress the data into
217 * @param position_target_local_ned C-struct to read the message contents from
218 */
219static inline uint16_t mavlink_msg_position_target_local_ned_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_position_target_local_ned_t* position_target_local_ned)
220{
221 return mavlink_msg_position_target_local_ned_pack(system_id, component_id, msg, position_target_local_ned->time_boot_ms, position_target_local_ned->coordinate_frame, position_target_local_ned->type_mask, position_target_local_ned->x, position_target_local_ned->y, position_target_local_ned->z, position_target_local_ned->vx, position_target_local_ned->vy, position_target_local_ned->vz, position_target_local_ned->afx, position_target_local_ned->afy, position_target_local_ned->afz, position_target_local_ned->yaw, position_target_local_ned->yaw_rate);
222}
223
224/**
225 * @brief Encode a position_target_local_ned struct on a channel
226 *
227 * @param system_id ID of this system
228 * @param component_id ID of this component (e.g. 200 for IMU)
229 * @param chan The MAVLink channel this message will be sent over
230 * @param msg The MAVLink message to compress the data into
231 * @param position_target_local_ned C-struct to read the message contents from
232 */
233static inline uint16_t mavlink_msg_position_target_local_ned_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_position_target_local_ned_t* position_target_local_ned)
234{
235 return mavlink_msg_position_target_local_ned_pack_chan(system_id, component_id, chan, msg, position_target_local_ned->time_boot_ms, position_target_local_ned->coordinate_frame, position_target_local_ned->type_mask, position_target_local_ned->x, position_target_local_ned->y, position_target_local_ned->z, position_target_local_ned->vx, position_target_local_ned->vy, position_target_local_ned->vz, position_target_local_ned->afx, position_target_local_ned->afy, position_target_local_ned->afz, position_target_local_ned->yaw, position_target_local_ned->yaw_rate);
236}
237
238/**
239 * @brief Send a position_target_local_ned message
240 * @param chan MAVLink channel to send the message
241 *
242 * @param time_boot_ms Timestamp in milliseconds since system boot
243 * @param coordinate_frame Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9
244 * @param type_mask Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate
245 * @param x X Position in NED frame in meters
246 * @param y Y Position in NED frame in meters
247 * @param z Z Position in NED frame in meters (note, altitude is negative in NED)
248 * @param vx X velocity in NED frame in meter / s
249 * @param vy Y velocity in NED frame in meter / s
250 * @param vz Z velocity in NED frame in meter / s
251 * @param afx X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
252 * @param afy Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
253 * @param afz Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
254 * @param yaw yaw setpoint in rad
255 * @param yaw_rate yaw rate setpoint in rad/s
256 */
257#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
258
259static inline void mavlink_msg_position_target_local_ned_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, float x, float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
260{
261#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
262 char buf[MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN];
263 _mav_put_uint32_t(buf, 0, time_boot_ms);
264 _mav_put_float(buf, 4, x);
265 _mav_put_float(buf, 8, y);
266 _mav_put_float(buf, 12, z);
267 _mav_put_float(buf, 16, vx);
268 _mav_put_float(buf, 20, vy);
269 _mav_put_float(buf, 24, vz);
270 _mav_put_float(buf, 28, afx);
271 _mav_put_float(buf, 32, afy);
272 _mav_put_float(buf, 36, afz);
273 _mav_put_float(buf, 40, yaw);
274 _mav_put_float(buf, 44, yaw_rate);
275 _mav_put_uint16_t(buf, 48, type_mask);
276 _mav_put_uint8_t(buf, 50, coordinate_frame);
277
278 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED, buf, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
279#else
280 mavlink_position_target_local_ned_t packet;
281 packet.time_boot_ms = time_boot_ms;
282 packet.x = x;
283 packet.y = y;
284 packet.z = z;
285 packet.vx = vx;
286 packet.vy = vy;
287 packet.vz = vz;
288 packet.afx = afx;
289 packet.afy = afy;
290 packet.afz = afz;
291 packet.yaw = yaw;
292 packet.yaw_rate = yaw_rate;
293 packet.type_mask = type_mask;
294 packet.coordinate_frame = coordinate_frame;
295
296 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED, (const char *)&packet, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
297#endif
298}
299
300/**
301 * @brief Send a position_target_local_ned message
302 * @param chan MAVLink channel to send the message
303 * @param struct The MAVLink struct to serialize
304 */
305static inline void mavlink_msg_position_target_local_ned_send_struct(mavlink_channel_t chan, const mavlink_position_target_local_ned_t* position_target_local_ned)
306{
307#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
308 mavlink_msg_position_target_local_ned_send(chan, position_target_local_ned->time_boot_ms, position_target_local_ned->coordinate_frame, position_target_local_ned->type_mask, position_target_local_ned->x, position_target_local_ned->y, position_target_local_ned->z, position_target_local_ned->vx, position_target_local_ned->vy, position_target_local_ned->vz, position_target_local_ned->afx, position_target_local_ned->afy, position_target_local_ned->afz, position_target_local_ned->yaw, position_target_local_ned->yaw_rate);
309#else
310 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED, (const char *)position_target_local_ned, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
311#endif
312}
313
314#if MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
315/*
316 This varient of _send() can be used to save stack space by re-using
317 memory from the receive buffer. The caller provides a
318 mavlink_message_t which is the size of a full mavlink message. This
319 is usually the receive buffer for the channel, and allows a reply to an
320 incoming message with minimum stack space usage.
321 */
322static inline void mavlink_msg_position_target_local_ned_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t coordinate_frame, uint16_t type_mask, float x, float y, float z, float vx, float vy, float vz, float afx, float afy, float afz, float yaw, float yaw_rate)
323{
324#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
325 char *buf = (char *)msgbuf;
326 _mav_put_uint32_t(buf, 0, time_boot_ms);
327 _mav_put_float(buf, 4, x);
328 _mav_put_float(buf, 8, y);
329 _mav_put_float(buf, 12, z);
330 _mav_put_float(buf, 16, vx);
331 _mav_put_float(buf, 20, vy);
332 _mav_put_float(buf, 24, vz);
333 _mav_put_float(buf, 28, afx);
334 _mav_put_float(buf, 32, afy);
335 _mav_put_float(buf, 36, afz);
336 _mav_put_float(buf, 40, yaw);
337 _mav_put_float(buf, 44, yaw_rate);
338 _mav_put_uint16_t(buf, 48, type_mask);
339 _mav_put_uint8_t(buf, 50, coordinate_frame);
340
341 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED, buf, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
342#else
343 mavlink_position_target_local_ned_t *packet = (mavlink_position_target_local_ned_t *)msgbuf;
344 packet->time_boot_ms = time_boot_ms;
345 packet->x = x;
346 packet->y = y;
347 packet->z = z;
348 packet->vx = vx;
349 packet->vy = vy;
350 packet->vz = vz;
351 packet->afx = afx;
352 packet->afy = afy;
353 packet->afz = afz;
354 packet->yaw = yaw;
355 packet->yaw_rate = yaw_rate;
356 packet->type_mask = type_mask;
357 packet->coordinate_frame = coordinate_frame;
358
359 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED, (const char *)packet, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_CRC);
360#endif
361}
362#endif
363
364#endif
365
366// MESSAGE POSITION_TARGET_LOCAL_NED UNPACKING
367
368
369/**
370 * @brief Get field time_boot_ms from position_target_local_ned message
371 *
372 * @return Timestamp in milliseconds since system boot
373 */
374static inline uint32_t mavlink_msg_position_target_local_ned_get_time_boot_ms(const mavlink_message_t* msg)
375{
376 return _MAV_RETURN_uint32_t(msg, 0);
377}
378
379/**
380 * @brief Get field coordinate_frame from position_target_local_ned message
381 *
382 * @return Valid options are: MAV_FRAME_LOCAL_NED = 1, MAV_FRAME_LOCAL_OFFSET_NED = 7, MAV_FRAME_BODY_NED = 8, MAV_FRAME_BODY_OFFSET_NED = 9
383 */
384static inline uint8_t mavlink_msg_position_target_local_ned_get_coordinate_frame(const mavlink_message_t* msg)
385{
386 return _MAV_RETURN_uint8_t(msg, 50);
387}
388
389/**
390 * @brief Get field type_mask from position_target_local_ned message
391 *
392 * @return Bitmask to indicate which dimensions should be ignored by the vehicle: a value of 0b0000000000000000 or 0b0000001000000000 indicates that none of the setpoint dimensions should be ignored. If bit 10 is set the floats afx afy afz should be interpreted as force instead of acceleration. Mapping: bit 1: x, bit 2: y, bit 3: z, bit 4: vx, bit 5: vy, bit 6: vz, bit 7: ax, bit 8: ay, bit 9: az, bit 10: is force setpoint, bit 11: yaw, bit 12: yaw rate
393 */
394static inline uint16_t mavlink_msg_position_target_local_ned_get_type_mask(const mavlink_message_t* msg)
395{
396 return _MAV_RETURN_uint16_t(msg, 48);
397}
398
399/**
400 * @brief Get field x from position_target_local_ned message
401 *
402 * @return X Position in NED frame in meters
403 */
404static inline float mavlink_msg_position_target_local_ned_get_x(const mavlink_message_t* msg)
405{
406 return _MAV_RETURN_float(msg, 4);
407}
408
409/**
410 * @brief Get field y from position_target_local_ned message
411 *
412 * @return Y Position in NED frame in meters
413 */
414static inline float mavlink_msg_position_target_local_ned_get_y(const mavlink_message_t* msg)
415{
416 return _MAV_RETURN_float(msg, 8);
417}
418
419/**
420 * @brief Get field z from position_target_local_ned message
421 *
422 * @return Z Position in NED frame in meters (note, altitude is negative in NED)
423 */
424static inline float mavlink_msg_position_target_local_ned_get_z(const mavlink_message_t* msg)
425{
426 return _MAV_RETURN_float(msg, 12);
427}
428
429/**
430 * @brief Get field vx from position_target_local_ned message
431 *
432 * @return X velocity in NED frame in meter / s
433 */
434static inline float mavlink_msg_position_target_local_ned_get_vx(const mavlink_message_t* msg)
435{
436 return _MAV_RETURN_float(msg, 16);
437}
438
439/**
440 * @brief Get field vy from position_target_local_ned message
441 *
442 * @return Y velocity in NED frame in meter / s
443 */
444static inline float mavlink_msg_position_target_local_ned_get_vy(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_float(msg, 20);
447}
448
449/**
450 * @brief Get field vz from position_target_local_ned message
451 *
452 * @return Z velocity in NED frame in meter / s
453 */
454static inline float mavlink_msg_position_target_local_ned_get_vz(const mavlink_message_t* msg)
455{
456 return _MAV_RETURN_float(msg, 24);
457}
458
459/**
460 * @brief Get field afx from position_target_local_ned message
461 *
462 * @return X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
463 */
464static inline float mavlink_msg_position_target_local_ned_get_afx(const mavlink_message_t* msg)
465{
466 return _MAV_RETURN_float(msg, 28);
467}
468
469/**
470 * @brief Get field afy from position_target_local_ned message
471 *
472 * @return Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
473 */
474static inline float mavlink_msg_position_target_local_ned_get_afy(const mavlink_message_t* msg)
475{
476 return _MAV_RETURN_float(msg, 32);
477}
478
479/**
480 * @brief Get field afz from position_target_local_ned message
481 *
482 * @return Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
483 */
484static inline float mavlink_msg_position_target_local_ned_get_afz(const mavlink_message_t* msg)
485{
486 return _MAV_RETURN_float(msg, 36);
487}
488
489/**
490 * @brief Get field yaw from position_target_local_ned message
491 *
492 * @return yaw setpoint in rad
493 */
494static inline float mavlink_msg_position_target_local_ned_get_yaw(const mavlink_message_t* msg)
495{
496 return _MAV_RETURN_float(msg, 40);
497}
498
499/**
500 * @brief Get field yaw_rate from position_target_local_ned message
501 *
502 * @return yaw rate setpoint in rad/s
503 */
504static inline float mavlink_msg_position_target_local_ned_get_yaw_rate(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_float(msg, 44);
507}
508
509/**
510 * @brief Decode a position_target_local_ned message into a struct
511 *
512 * @param msg The message to decode
513 * @param position_target_local_ned C-struct to decode the message contents into
514 */
515static inline void mavlink_msg_position_target_local_ned_decode(const mavlink_message_t* msg, mavlink_position_target_local_ned_t* position_target_local_ned)
516{
517#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
518 position_target_local_ned->time_boot_ms = mavlink_msg_position_target_local_ned_get_time_boot_ms(msg);
519 position_target_local_ned->x = mavlink_msg_position_target_local_ned_get_x(msg);
520 position_target_local_ned->y = mavlink_msg_position_target_local_ned_get_y(msg);
521 position_target_local_ned->z = mavlink_msg_position_target_local_ned_get_z(msg);
522 position_target_local_ned->vx = mavlink_msg_position_target_local_ned_get_vx(msg);
523 position_target_local_ned->vy = mavlink_msg_position_target_local_ned_get_vy(msg);
524 position_target_local_ned->vz = mavlink_msg_position_target_local_ned_get_vz(msg);
525 position_target_local_ned->afx = mavlink_msg_position_target_local_ned_get_afx(msg);
526 position_target_local_ned->afy = mavlink_msg_position_target_local_ned_get_afy(msg);
527 position_target_local_ned->afz = mavlink_msg_position_target_local_ned_get_afz(msg);
528 position_target_local_ned->yaw = mavlink_msg_position_target_local_ned_get_yaw(msg);
529 position_target_local_ned->yaw_rate = mavlink_msg_position_target_local_ned_get_yaw_rate(msg);
530 position_target_local_ned->type_mask = mavlink_msg_position_target_local_ned_get_type_mask(msg);
531 position_target_local_ned->coordinate_frame = mavlink_msg_position_target_local_ned_get_coordinate_frame(msg);
532#else
533 uint8_t len = msg->len < MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN? msg->len : MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN;
534 memset(position_target_local_ned, 0, MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_LEN);
535 memcpy(position_target_local_ned, _MAV_PAYLOAD(msg), len);
536#endif
537}
Note: See TracBrowser for help on using the repository browser.