Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_set_position_target_local_ned.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE SET_POSITION_TARGET_LOCAL_NED PACKING
3
4#define MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED 84
5
6
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 float x; /*< [m] X Position in NED frame*/
10 float y; /*< [m] Y Position in NED frame*/
11 float z; /*< [m] Z Position in NED frame (note, altitude is negative in NED)*/
12 float vx; /*< [m/s] X velocity in NED frame*/
13 float vy; /*< [m/s] Y velocity in NED frame*/
14 float vz; /*< [m/s] Z velocity in NED frame*/
15 float afx; /*< [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
16 float afy; /*< [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
17 float afz; /*< [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N*/
18 float yaw; /*< [rad] yaw setpoint*/
19 float yaw_rate; /*< [rad/s] yaw rate setpoint*/
20 uint16_t type_mask; /*< Bitmap to indicate which dimensions should be ignored by the vehicle.*/
21 uint8_t target_system; /*< System ID*/
22 uint8_t target_component; /*< Component ID*/
23 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*/
24} mavlink_set_position_target_local_ned_t;
25
26#define MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN 53
27#define MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN 53
28#define MAVLINK_MSG_ID_84_LEN 53
29#define MAVLINK_MSG_ID_84_MIN_LEN 53
30
31#define MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC 143
32#define MAVLINK_MSG_ID_84_CRC 143
33
34
35
36#if MAVLINK_COMMAND_24BIT
37#define MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED {
38 84,
39 "SET_POSITION_TARGET_LOCAL_NED",
40 16,
41 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_position_target_local_ned_t, time_boot_ms) },
42 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_set_position_target_local_ned_t, target_system) },
43 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_set_position_target_local_ned_t, target_component) },
44 { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_set_position_target_local_ned_t, coordinate_frame) },
45 { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_set_position_target_local_ned_t, type_mask) },
46 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_position_target_local_ned_t, x) },
47 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_position_target_local_ned_t, y) },
48 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_position_target_local_ned_t, z) },
49 { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_set_position_target_local_ned_t, vx) },
50 { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_position_target_local_ned_t, vy) },
51 { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_position_target_local_ned_t, vz) },
52 { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_position_target_local_ned_t, afx) },
53 { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_position_target_local_ned_t, afy) },
54 { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_set_position_target_local_ned_t, afz) },
55 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_set_position_target_local_ned_t, yaw) },
56 { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_set_position_target_local_ned_t, yaw_rate) },
57 } \
58}
59#else
60#define MAVLINK_MESSAGE_INFO_SET_POSITION_TARGET_LOCAL_NED {
61 "SET_POSITION_TARGET_LOCAL_NED",
62 16,
63 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_set_position_target_local_ned_t, time_boot_ms) },
64 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 50, offsetof(mavlink_set_position_target_local_ned_t, target_system) },
65 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 51, offsetof(mavlink_set_position_target_local_ned_t, target_component) },
66 { "coordinate_frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_set_position_target_local_ned_t, coordinate_frame) },
67 { "type_mask", NULL, MAVLINK_TYPE_UINT16_T, 0, 48, offsetof(mavlink_set_position_target_local_ned_t, type_mask) },
68 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_set_position_target_local_ned_t, x) },
69 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_set_position_target_local_ned_t, y) },
70 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_position_target_local_ned_t, z) },
71 { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_set_position_target_local_ned_t, vx) },
72 { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_position_target_local_ned_t, vy) },
73 { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_set_position_target_local_ned_t, vz) },
74 { "afx", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_set_position_target_local_ned_t, afx) },
75 { "afy", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_set_position_target_local_ned_t, afy) },
76 { "afz", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_set_position_target_local_ned_t, afz) },
77 { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_set_position_target_local_ned_t, yaw) },
78 { "yaw_rate", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_set_position_target_local_ned_t, yaw_rate) },
79 } \
80}
81#endif
82
83/**
84 * @brief Pack a set_position_target_local_ned message
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param msg The MAVLink message to compress the data into
88 *
89 * @param time_boot_ms [ms] Timestamp (time since system boot).
90 * @param target_system System ID
91 * @param target_component Component ID
92 * @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
93 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
94 * @param x [m] X Position in NED frame
95 * @param y [m] Y Position in NED frame
96 * @param z [m] Z Position in NED frame (note, altitude is negative in NED)
97 * @param vx [m/s] X velocity in NED frame
98 * @param vy [m/s] Y velocity in NED frame
99 * @param vz [m/s] Z velocity in NED frame
100 * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
101 * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
102 * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
103 * @param yaw [rad] yaw setpoint
104 * @param yaw_rate [rad/s] yaw rate setpoint
105 * @return length of the message in bytes (excluding serial stream start sign)
106 */
107static inline uint16_t mavlink_msg_set_position_target_local_ned_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
108 uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, 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)
109{
110#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
112 _mav_put_uint32_t(buf, 0, time_boot_ms);
113 _mav_put_float(buf, 4, x);
114 _mav_put_float(buf, 8, y);
115 _mav_put_float(buf, 12, z);
116 _mav_put_float(buf, 16, vx);
117 _mav_put_float(buf, 20, vy);
118 _mav_put_float(buf, 24, vz);
119 _mav_put_float(buf, 28, afx);
120 _mav_put_float(buf, 32, afy);
121 _mav_put_float(buf, 36, afz);
122 _mav_put_float(buf, 40, yaw);
123 _mav_put_float(buf, 44, yaw_rate);
124 _mav_put_uint16_t(buf, 48, type_mask);
125 _mav_put_uint8_t(buf, 50, target_system);
126 _mav_put_uint8_t(buf, 51, target_component);
127 _mav_put_uint8_t(buf, 52, coordinate_frame);
128
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
130#else
131 mavlink_set_position_target_local_ned_t packet;
132 packet.time_boot_ms = time_boot_ms;
133 packet.x = x;
134 packet.y = y;
135 packet.z = z;
136 packet.vx = vx;
137 packet.vy = vy;
138 packet.vz = vz;
139 packet.afx = afx;
140 packet.afy = afy;
141 packet.afz = afz;
142 packet.yaw = yaw;
143 packet.yaw_rate = yaw_rate;
144 packet.type_mask = type_mask;
145 packet.target_system = target_system;
146 packet.target_component = target_component;
147 packet.coordinate_frame = coordinate_frame;
148
149 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
150#endif
151
154}
155
156/**
157 * @brief Pack a set_position_target_local_ned message
158 * @param system_id ID of this system
159 * @param component_id ID of this component (e.g. 200 for IMU)
160 * @param status MAVLink status structure
161 * @param msg The MAVLink message to compress the data into
162 *
163 * @param time_boot_ms [ms] Timestamp (time since system boot).
164 * @param target_system System ID
165 * @param target_component Component ID
166 * @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
167 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
168 * @param x [m] X Position in NED frame
169 * @param y [m] Y Position in NED frame
170 * @param z [m] Z Position in NED frame (note, altitude is negative in NED)
171 * @param vx [m/s] X velocity in NED frame
172 * @param vy [m/s] Y velocity in NED frame
173 * @param vz [m/s] Z velocity in NED frame
174 * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
175 * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
176 * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
177 * @param yaw [rad] yaw setpoint
178 * @param yaw_rate [rad/s] yaw rate setpoint
179 * @return length of the message in bytes (excluding serial stream start sign)
180 */
181static inline uint16_t mavlink_msg_set_position_target_local_ned_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
182 uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, 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)
183{
184#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
186 _mav_put_uint32_t(buf, 0, time_boot_ms);
187 _mav_put_float(buf, 4, x);
188 _mav_put_float(buf, 8, y);
189 _mav_put_float(buf, 12, z);
190 _mav_put_float(buf, 16, vx);
191 _mav_put_float(buf, 20, vy);
192 _mav_put_float(buf, 24, vz);
193 _mav_put_float(buf, 28, afx);
194 _mav_put_float(buf, 32, afy);
195 _mav_put_float(buf, 36, afz);
196 _mav_put_float(buf, 40, yaw);
197 _mav_put_float(buf, 44, yaw_rate);
198 _mav_put_uint16_t(buf, 48, type_mask);
199 _mav_put_uint8_t(buf, 50, target_system);
200 _mav_put_uint8_t(buf, 51, target_component);
201 _mav_put_uint8_t(buf, 52, coordinate_frame);
202
203 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
204#else
205 mavlink_set_position_target_local_ned_t packet;
206 packet.time_boot_ms = time_boot_ms;
207 packet.x = x;
208 packet.y = y;
209 packet.z = z;
210 packet.vx = vx;
211 packet.vy = vy;
212 packet.vz = vz;
213 packet.afx = afx;
214 packet.afy = afy;
215 packet.afz = afz;
216 packet.yaw = yaw;
217 packet.yaw_rate = yaw_rate;
218 packet.type_mask = type_mask;
219 packet.target_system = target_system;
220 packet.target_component = target_component;
221 packet.coordinate_frame = coordinate_frame;
222
223 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
224#endif
225
227#if MAVLINK_CRC_EXTRA
228 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
229#else
230 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
231#endif
232}
233
234/**
235 * @brief Pack a set_position_target_local_ned message on a channel
236 * @param system_id ID of this system
237 * @param component_id ID of this component (e.g. 200 for IMU)
238 * @param chan The MAVLink channel this message will be sent over
239 * @param msg The MAVLink message to compress the data into
240 * @param time_boot_ms [ms] Timestamp (time since system boot).
241 * @param target_system System ID
242 * @param target_component Component ID
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 Bitmap to indicate which dimensions should be ignored by the vehicle.
245 * @param x [m] X Position in NED frame
246 * @param y [m] Y Position in NED frame
247 * @param z [m] Z Position in NED frame (note, altitude is negative in NED)
248 * @param vx [m/s] X velocity in NED frame
249 * @param vy [m/s] Y velocity in NED frame
250 * @param vz [m/s] Z velocity in NED frame
251 * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
252 * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
253 * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
254 * @param yaw [rad] yaw setpoint
255 * @param yaw_rate [rad/s] yaw rate setpoint
256 * @return length of the message in bytes (excluding serial stream start sign)
257 */
258static inline uint16_t mavlink_msg_set_position_target_local_ned_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
259 mavlink_message_t* msg,
260 uint32_t time_boot_ms,uint8_t target_system,uint8_t target_component,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)
261{
262#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
264 _mav_put_uint32_t(buf, 0, time_boot_ms);
265 _mav_put_float(buf, 4, x);
266 _mav_put_float(buf, 8, y);
267 _mav_put_float(buf, 12, z);
268 _mav_put_float(buf, 16, vx);
269 _mav_put_float(buf, 20, vy);
270 _mav_put_float(buf, 24, vz);
271 _mav_put_float(buf, 28, afx);
272 _mav_put_float(buf, 32, afy);
273 _mav_put_float(buf, 36, afz);
274 _mav_put_float(buf, 40, yaw);
275 _mav_put_float(buf, 44, yaw_rate);
276 _mav_put_uint16_t(buf, 48, type_mask);
277 _mav_put_uint8_t(buf, 50, target_system);
278 _mav_put_uint8_t(buf, 51, target_component);
279 _mav_put_uint8_t(buf, 52, coordinate_frame);
280
281 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
282#else
283 mavlink_set_position_target_local_ned_t packet;
284 packet.time_boot_ms = time_boot_ms;
285 packet.x = x;
286 packet.y = y;
287 packet.z = z;
288 packet.vx = vx;
289 packet.vy = vy;
290 packet.vz = vz;
291 packet.afx = afx;
292 packet.afy = afy;
293 packet.afz = afz;
294 packet.yaw = yaw;
295 packet.yaw_rate = yaw_rate;
296 packet.type_mask = type_mask;
297 packet.target_system = target_system;
298 packet.target_component = target_component;
299 packet.coordinate_frame = coordinate_frame;
300
301 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
302#endif
303
306}
307
308/**
309 * @brief Encode a set_position_target_local_ned struct
310 *
311 * @param system_id ID of this system
312 * @param component_id ID of this component (e.g. 200 for IMU)
313 * @param msg The MAVLink message to compress the data into
314 * @param set_position_target_local_ned C-struct to read the message contents from
315 */
316static inline uint16_t mavlink_msg_set_position_target_local_ned_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_position_target_local_ned_t* set_position_target_local_ned)
317{
318 return mavlink_msg_set_position_target_local_ned_pack(system_id, component_id, msg, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate);
319}
320
321/**
322 * @brief Encode a set_position_target_local_ned struct on a channel
323 *
324 * @param system_id ID of this system
325 * @param component_id ID of this component (e.g. 200 for IMU)
326 * @param chan The MAVLink channel this message will be sent over
327 * @param msg The MAVLink message to compress the data into
328 * @param set_position_target_local_ned C-struct to read the message contents from
329 */
330static inline uint16_t mavlink_msg_set_position_target_local_ned_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_position_target_local_ned_t* set_position_target_local_ned)
331{
332 return mavlink_msg_set_position_target_local_ned_pack_chan(system_id, component_id, chan, msg, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate);
333}
334
335/**
336 * @brief Encode a set_position_target_local_ned struct with provided status structure
337 *
338 * @param system_id ID of this system
339 * @param component_id ID of this component (e.g. 200 for IMU)
340 * @param status MAVLink status structure
341 * @param msg The MAVLink message to compress the data into
342 * @param set_position_target_local_ned C-struct to read the message contents from
343 */
344static inline uint16_t mavlink_msg_set_position_target_local_ned_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_set_position_target_local_ned_t* set_position_target_local_ned)
345{
346 return mavlink_msg_set_position_target_local_ned_pack_status(system_id, component_id, _status, msg, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate);
347}
348
349/**
350 * @brief Send a set_position_target_local_ned message
351 * @param chan MAVLink channel to send the message
352 *
353 * @param time_boot_ms [ms] Timestamp (time since system boot).
354 * @param target_system System ID
355 * @param target_component Component ID
356 * @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
357 * @param type_mask Bitmap to indicate which dimensions should be ignored by the vehicle.
358 * @param x [m] X Position in NED frame
359 * @param y [m] Y Position in NED frame
360 * @param z [m] Z Position in NED frame (note, altitude is negative in NED)
361 * @param vx [m/s] X velocity in NED frame
362 * @param vy [m/s] Y velocity in NED frame
363 * @param vz [m/s] Z velocity in NED frame
364 * @param afx [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
365 * @param afy [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
366 * @param afz [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
367 * @param yaw [rad] yaw setpoint
368 * @param yaw_rate [rad/s] yaw rate setpoint
369 */
370#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
371
372static inline void mavlink_msg_set_position_target_local_ned_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, 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)
373{
374#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 char buf[MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN];
376 _mav_put_uint32_t(buf, 0, time_boot_ms);
377 _mav_put_float(buf, 4, x);
378 _mav_put_float(buf, 8, y);
379 _mav_put_float(buf, 12, z);
380 _mav_put_float(buf, 16, vx);
381 _mav_put_float(buf, 20, vy);
382 _mav_put_float(buf, 24, vz);
383 _mav_put_float(buf, 28, afx);
384 _mav_put_float(buf, 32, afy);
385 _mav_put_float(buf, 36, afz);
386 _mav_put_float(buf, 40, yaw);
387 _mav_put_float(buf, 44, yaw_rate);
388 _mav_put_uint16_t(buf, 48, type_mask);
389 _mav_put_uint8_t(buf, 50, target_system);
390 _mav_put_uint8_t(buf, 51, target_component);
391 _mav_put_uint8_t(buf, 52, coordinate_frame);
392
393 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED, buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
394#else
395 mavlink_set_position_target_local_ned_t packet;
396 packet.time_boot_ms = time_boot_ms;
397 packet.x = x;
398 packet.y = y;
399 packet.z = z;
400 packet.vx = vx;
401 packet.vy = vy;
402 packet.vz = vz;
403 packet.afx = afx;
404 packet.afy = afy;
405 packet.afz = afz;
406 packet.yaw = yaw;
407 packet.yaw_rate = yaw_rate;
408 packet.type_mask = type_mask;
409 packet.target_system = target_system;
410 packet.target_component = target_component;
411 packet.coordinate_frame = coordinate_frame;
412
413 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED, (const char *)&packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
414#endif
415}
416
417/**
418 * @brief Send a set_position_target_local_ned message
419 * @param chan MAVLink channel to send the message
420 * @param struct The MAVLink struct to serialize
421 */
422static inline void mavlink_msg_set_position_target_local_ned_send_struct(mavlink_channel_t chan, const mavlink_set_position_target_local_ned_t* set_position_target_local_ned)
423{
424#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
425 mavlink_msg_set_position_target_local_ned_send(chan, set_position_target_local_ned->time_boot_ms, set_position_target_local_ned->target_system, set_position_target_local_ned->target_component, set_position_target_local_ned->coordinate_frame, set_position_target_local_ned->type_mask, set_position_target_local_ned->x, set_position_target_local_ned->y, set_position_target_local_ned->z, set_position_target_local_ned->vx, set_position_target_local_ned->vy, set_position_target_local_ned->vz, set_position_target_local_ned->afx, set_position_target_local_ned->afy, set_position_target_local_ned->afz, set_position_target_local_ned->yaw, set_position_target_local_ned->yaw_rate);
426#else
427 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED, (const char *)set_position_target_local_ned, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
428#endif
429}
430
431#if MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
432/*
433 This variant of _send() can be used to save stack space by reusing
434 memory from the receive buffer. The caller provides a
435 mavlink_message_t which is the size of a full mavlink message. This
436 is usually the receive buffer for the channel, and allows a reply to an
437 incoming message with minimum stack space usage.
438 */
439static inline void mavlink_msg_set_position_target_local_ned_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t target_system, uint8_t target_component, 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)
440{
441#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
442 char *buf = (char *)msgbuf;
443 _mav_put_uint32_t(buf, 0, time_boot_ms);
444 _mav_put_float(buf, 4, x);
445 _mav_put_float(buf, 8, y);
446 _mav_put_float(buf, 12, z);
447 _mav_put_float(buf, 16, vx);
448 _mav_put_float(buf, 20, vy);
449 _mav_put_float(buf, 24, vz);
450 _mav_put_float(buf, 28, afx);
451 _mav_put_float(buf, 32, afy);
452 _mav_put_float(buf, 36, afz);
453 _mav_put_float(buf, 40, yaw);
454 _mav_put_float(buf, 44, yaw_rate);
455 _mav_put_uint16_t(buf, 48, type_mask);
456 _mav_put_uint8_t(buf, 50, target_system);
457 _mav_put_uint8_t(buf, 51, target_component);
458 _mav_put_uint8_t(buf, 52, coordinate_frame);
459
460 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED, buf, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
461#else
462 mavlink_set_position_target_local_ned_t *packet = (mavlink_set_position_target_local_ned_t *)msgbuf;
463 packet->time_boot_ms = time_boot_ms;
464 packet->x = x;
465 packet->y = y;
466 packet->z = z;
467 packet->vx = vx;
468 packet->vy = vy;
469 packet->vz = vz;
470 packet->afx = afx;
471 packet->afy = afy;
472 packet->afz = afz;
473 packet->yaw = yaw;
474 packet->yaw_rate = yaw_rate;
475 packet->type_mask = type_mask;
476 packet->target_system = target_system;
477 packet->target_component = target_component;
478 packet->coordinate_frame = coordinate_frame;
479
480 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED, (const char *)packet, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_CRC);
481#endif
482}
483#endif
484
485#endif
486
487// MESSAGE SET_POSITION_TARGET_LOCAL_NED UNPACKING
488
489
490/**
491 * @brief Get field time_boot_ms from set_position_target_local_ned message
492 *
493 * @return [ms] Timestamp (time since system boot).
494 */
495static inline uint32_t mavlink_msg_set_position_target_local_ned_get_time_boot_ms(const mavlink_message_t* msg)
496{
497 return _MAV_RETURN_uint32_t(msg, 0);
498}
499
500/**
501 * @brief Get field target_system from set_position_target_local_ned message
502 *
503 * @return System ID
504 */
505static inline uint8_t mavlink_msg_set_position_target_local_ned_get_target_system(const mavlink_message_t* msg)
506{
507 return _MAV_RETURN_uint8_t(msg, 50);
508}
509
510/**
511 * @brief Get field target_component from set_position_target_local_ned message
512 *
513 * @return Component ID
514 */
515static inline uint8_t mavlink_msg_set_position_target_local_ned_get_target_component(const mavlink_message_t* msg)
516{
517 return _MAV_RETURN_uint8_t(msg, 51);
518}
519
520/**
521 * @brief Get field coordinate_frame from set_position_target_local_ned message
522 *
523 * @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
524 */
525static inline uint8_t mavlink_msg_set_position_target_local_ned_get_coordinate_frame(const mavlink_message_t* msg)
526{
527 return _MAV_RETURN_uint8_t(msg, 52);
528}
529
530/**
531 * @brief Get field type_mask from set_position_target_local_ned message
532 *
533 * @return Bitmap to indicate which dimensions should be ignored by the vehicle.
534 */
535static inline uint16_t mavlink_msg_set_position_target_local_ned_get_type_mask(const mavlink_message_t* msg)
536{
537 return _MAV_RETURN_uint16_t(msg, 48);
538}
539
540/**
541 * @brief Get field x from set_position_target_local_ned message
542 *
543 * @return [m] X Position in NED frame
544 */
545static inline float mavlink_msg_set_position_target_local_ned_get_x(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_float(msg, 4);
548}
549
550/**
551 * @brief Get field y from set_position_target_local_ned message
552 *
553 * @return [m] Y Position in NED frame
554 */
555static inline float mavlink_msg_set_position_target_local_ned_get_y(const mavlink_message_t* msg)
556{
557 return _MAV_RETURN_float(msg, 8);
558}
559
560/**
561 * @brief Get field z from set_position_target_local_ned message
562 *
563 * @return [m] Z Position in NED frame (note, altitude is negative in NED)
564 */
565static inline float mavlink_msg_set_position_target_local_ned_get_z(const mavlink_message_t* msg)
566{
567 return _MAV_RETURN_float(msg, 12);
568}
569
570/**
571 * @brief Get field vx from set_position_target_local_ned message
572 *
573 * @return [m/s] X velocity in NED frame
574 */
575static inline float mavlink_msg_set_position_target_local_ned_get_vx(const mavlink_message_t* msg)
576{
577 return _MAV_RETURN_float(msg, 16);
578}
579
580/**
581 * @brief Get field vy from set_position_target_local_ned message
582 *
583 * @return [m/s] Y velocity in NED frame
584 */
585static inline float mavlink_msg_set_position_target_local_ned_get_vy(const mavlink_message_t* msg)
586{
587 return _MAV_RETURN_float(msg, 20);
588}
589
590/**
591 * @brief Get field vz from set_position_target_local_ned message
592 *
593 * @return [m/s] Z velocity in NED frame
594 */
595static inline float mavlink_msg_set_position_target_local_ned_get_vz(const mavlink_message_t* msg)
596{
597 return _MAV_RETURN_float(msg, 24);
598}
599
600/**
601 * @brief Get field afx from set_position_target_local_ned message
602 *
603 * @return [m/s/s] X acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
604 */
605static inline float mavlink_msg_set_position_target_local_ned_get_afx(const mavlink_message_t* msg)
606{
607 return _MAV_RETURN_float(msg, 28);
608}
609
610/**
611 * @brief Get field afy from set_position_target_local_ned message
612 *
613 * @return [m/s/s] Y acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
614 */
615static inline float mavlink_msg_set_position_target_local_ned_get_afy(const mavlink_message_t* msg)
616{
617 return _MAV_RETURN_float(msg, 32);
618}
619
620/**
621 * @brief Get field afz from set_position_target_local_ned message
622 *
623 * @return [m/s/s] Z acceleration or force (if bit 10 of type_mask is set) in NED frame in meter / s^2 or N
624 */
625static inline float mavlink_msg_set_position_target_local_ned_get_afz(const mavlink_message_t* msg)
626{
627 return _MAV_RETURN_float(msg, 36);
628}
629
630/**
631 * @brief Get field yaw from set_position_target_local_ned message
632 *
633 * @return [rad] yaw setpoint
634 */
635static inline float mavlink_msg_set_position_target_local_ned_get_yaw(const mavlink_message_t* msg)
636{
637 return _MAV_RETURN_float(msg, 40);
638}
639
640/**
641 * @brief Get field yaw_rate from set_position_target_local_ned message
642 *
643 * @return [rad/s] yaw rate setpoint
644 */
645static inline float mavlink_msg_set_position_target_local_ned_get_yaw_rate(const mavlink_message_t* msg)
646{
647 return _MAV_RETURN_float(msg, 44);
648}
649
650/**
651 * @brief Decode a set_position_target_local_ned message into a struct
652 *
653 * @param msg The message to decode
654 * @param set_position_target_local_ned C-struct to decode the message contents into
655 */
656static inline void mavlink_msg_set_position_target_local_ned_decode(const mavlink_message_t* msg, mavlink_set_position_target_local_ned_t* set_position_target_local_ned)
657{
658#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
659 set_position_target_local_ned->time_boot_ms = mavlink_msg_set_position_target_local_ned_get_time_boot_ms(msg);
660 set_position_target_local_ned->x = mavlink_msg_set_position_target_local_ned_get_x(msg);
661 set_position_target_local_ned->y = mavlink_msg_set_position_target_local_ned_get_y(msg);
662 set_position_target_local_ned->z = mavlink_msg_set_position_target_local_ned_get_z(msg);
663 set_position_target_local_ned->vx = mavlink_msg_set_position_target_local_ned_get_vx(msg);
664 set_position_target_local_ned->vy = mavlink_msg_set_position_target_local_ned_get_vy(msg);
665 set_position_target_local_ned->vz = mavlink_msg_set_position_target_local_ned_get_vz(msg);
666 set_position_target_local_ned->afx = mavlink_msg_set_position_target_local_ned_get_afx(msg);
667 set_position_target_local_ned->afy = mavlink_msg_set_position_target_local_ned_get_afy(msg);
668 set_position_target_local_ned->afz = mavlink_msg_set_position_target_local_ned_get_afz(msg);
669 set_position_target_local_ned->yaw = mavlink_msg_set_position_target_local_ned_get_yaw(msg);
670 set_position_target_local_ned->yaw_rate = mavlink_msg_set_position_target_local_ned_get_yaw_rate(msg);
671 set_position_target_local_ned->type_mask = mavlink_msg_set_position_target_local_ned_get_type_mask(msg);
672 set_position_target_local_ned->target_system = mavlink_msg_set_position_target_local_ned_get_target_system(msg);
673 set_position_target_local_ned->target_component = mavlink_msg_set_position_target_local_ned_get_target_component(msg);
674 set_position_target_local_ned->coordinate_frame = mavlink_msg_set_position_target_local_ned_get_coordinate_frame(msg);
675#else
676 uint8_t len = msg->len < MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN? msg->len : MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN;
677 memset(set_position_target_local_ned, 0, MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_LEN);
678 memcpy(set_position_target_local_ned, _MAV_PAYLOAD(msg), len);
679#endif
680}