mavlink_msg_safety_set_allowed_area.h
Go to the documentation of this file.
1 // MESSAGE SAFETY_SET_ALLOWED_AREA PACKING
2 
3 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA 54
4 
6 {
7  float p1x; /*< x position 1 / Latitude 1*/
8  float p1y; /*< y position 1 / Longitude 1*/
9  float p1z; /*< z position 1 / Altitude 1*/
10  float p2x; /*< x position 2 / Latitude 2*/
11  float p2y; /*< y position 2 / Longitude 2*/
12  float p2z; /*< z position 2 / Altitude 2*/
13  uint8_t target_system; /*< System ID*/
14  uint8_t target_component; /*< Component ID*/
15  uint8_t frame; /*< Coordinate frame, as defined by MAV_FRAME enum in mavlink_types.h. Can be either global, GPS, right-handed with Z axis up or local, right handed, Z axis down.*/
17 
18 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN 27
19 #define MAVLINK_MSG_ID_54_LEN 27
20 
21 #define MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_CRC 15
22 #define MAVLINK_MSG_ID_54_CRC 15
23 
24 
25 
26 #define MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA { \
27  "SAFETY_SET_ALLOWED_AREA", \
28  9, \
29  { { "p1x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_safety_set_allowed_area_t, p1x) }, \
30  { "p1y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_safety_set_allowed_area_t, p1y) }, \
31  { "p1z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_safety_set_allowed_area_t, p1z) }, \
32  { "p2x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_safety_set_allowed_area_t, p2x) }, \
33  { "p2y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_safety_set_allowed_area_t, p2y) }, \
34  { "p2z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_safety_set_allowed_area_t, p2z) }, \
35  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_safety_set_allowed_area_t, target_system) }, \
36  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_safety_set_allowed_area_t, target_component) }, \
37  { "frame", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_safety_set_allowed_area_t, frame) }, \
38  } \
39 }
40 
41 
59 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60  uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
61 {
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
64  _mav_put_float(buf, 0, p1x);
65  _mav_put_float(buf, 4, p1y);
66  _mav_put_float(buf, 8, p1z);
67  _mav_put_float(buf, 12, p2x);
68  _mav_put_float(buf, 16, p2y);
69  _mav_put_float(buf, 20, p2z);
70  _mav_put_uint8_t(buf, 24, target_system);
71  _mav_put_uint8_t(buf, 25, target_component);
72  _mav_put_uint8_t(buf, 26, frame);
73 
75 #else
77  packet.p1x = p1x;
78  packet.p1y = p1y;
79  packet.p1z = p1z;
80  packet.p2x = p2x;
81  packet.p2y = p2y;
82  packet.p2z = p2z;
85  packet.frame = frame;
86 
88 #endif
89 
91 #if MAVLINK_CRC_EXTRA
93 #else
94  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
95 #endif
96 }
97 
115 static inline uint16_t mavlink_msg_safety_set_allowed_area_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
116  mavlink_message_t* msg,
117  uint8_t target_system,uint8_t target_component,uint8_t frame,float p1x,float p1y,float p1z,float p2x,float p2y,float p2z)
118 {
119 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
121  _mav_put_float(buf, 0, p1x);
122  _mav_put_float(buf, 4, p1y);
123  _mav_put_float(buf, 8, p1z);
124  _mav_put_float(buf, 12, p2x);
125  _mav_put_float(buf, 16, p2y);
126  _mav_put_float(buf, 20, p2z);
127  _mav_put_uint8_t(buf, 24, target_system);
128  _mav_put_uint8_t(buf, 25, target_component);
129  _mav_put_uint8_t(buf, 26, frame);
130 
132 #else
134  packet.p1x = p1x;
135  packet.p1y = p1y;
136  packet.p1z = p1z;
137  packet.p2x = p2x;
138  packet.p2y = p2y;
139  packet.p2z = p2z;
140  packet.target_system = target_system;
142  packet.frame = frame;
143 
145 #endif
146 
148 #if MAVLINK_CRC_EXTRA
150 #else
151  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
152 #endif
153 }
154 
163 static inline uint16_t mavlink_msg_safety_set_allowed_area_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
164 {
165  return mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z);
166 }
167 
177 static inline uint16_t mavlink_msg_safety_set_allowed_area_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
178 {
179  return mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, chan, msg, safety_set_allowed_area->target_system, safety_set_allowed_area->target_component, safety_set_allowed_area->frame, safety_set_allowed_area->p1x, safety_set_allowed_area->p1y, safety_set_allowed_area->p1z, safety_set_allowed_area->p2x, safety_set_allowed_area->p2y, safety_set_allowed_area->p2z);
180 }
181 
196 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
197 
198 static inline void mavlink_msg_safety_set_allowed_area_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
199 {
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
202  _mav_put_float(buf, 0, p1x);
203  _mav_put_float(buf, 4, p1y);
204  _mav_put_float(buf, 8, p1z);
205  _mav_put_float(buf, 12, p2x);
206  _mav_put_float(buf, 16, p2y);
207  _mav_put_float(buf, 20, p2z);
210  _mav_put_uint8_t(buf, 26, frame);
211 
212 #if MAVLINK_CRC_EXTRA
214 #else
215  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
216 #endif
217 #else
219  packet.p1x = p1x;
220  packet.p1y = p1y;
221  packet.p1z = p1z;
222  packet.p2x = p2x;
223  packet.p2y = p2y;
224  packet.p2z = p2z;
225  packet.target_system = target_system;
227  packet.frame = frame;
228 
229 #if MAVLINK_CRC_EXTRA
231 #else
232  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)&packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
233 #endif
234 #endif
235 }
236 
237 #if MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN <= MAVLINK_MAX_PAYLOAD_LEN
238 /*
239  This varient of _send() can be used to save stack space by re-using
240  memory from the receive buffer. The caller provides a
241  mavlink_message_t which is the size of a full mavlink message. This
242  is usually the receive buffer for the channel, and allows a reply to an
243  incoming message with minimum stack space usage.
244  */
245 static inline void mavlink_msg_safety_set_allowed_area_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t frame, float p1x, float p1y, float p1z, float p2x, float p2y, float p2z)
246 {
247 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
248  char *buf = (char *)msgbuf;
249  _mav_put_float(buf, 0, p1x);
250  _mav_put_float(buf, 4, p1y);
251  _mav_put_float(buf, 8, p1z);
252  _mav_put_float(buf, 12, p2x);
253  _mav_put_float(buf, 16, p2y);
254  _mav_put_float(buf, 20, p2z);
257  _mav_put_uint8_t(buf, 26, frame);
258 
259 #if MAVLINK_CRC_EXTRA
261 #else
262  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, buf, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
263 #endif
264 #else
266  packet->p1x = p1x;
267  packet->p1y = p1y;
268  packet->p1z = p1z;
269  packet->p2x = p2x;
270  packet->p2y = p2y;
271  packet->p2z = p2z;
272  packet->target_system = target_system;
274  packet->frame = frame;
275 
276 #if MAVLINK_CRC_EXTRA
278 #else
279  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA, (const char *)packet, MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
280 #endif
281 #endif
282 }
283 #endif
284 
285 #endif
286 
287 // MESSAGE SAFETY_SET_ALLOWED_AREA UNPACKING
288 
289 
295 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_system(const mavlink_message_t* msg)
296 {
297  return _MAV_RETURN_uint8_t(msg, 24);
298 }
299 
305 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_target_component(const mavlink_message_t* msg)
306 {
307  return _MAV_RETURN_uint8_t(msg, 25);
308 }
309 
315 static inline uint8_t mavlink_msg_safety_set_allowed_area_get_frame(const mavlink_message_t* msg)
316 {
317  return _MAV_RETURN_uint8_t(msg, 26);
318 }
319 
325 static inline float mavlink_msg_safety_set_allowed_area_get_p1x(const mavlink_message_t* msg)
326 {
327  return _MAV_RETURN_float(msg, 0);
328 }
329 
335 static inline float mavlink_msg_safety_set_allowed_area_get_p1y(const mavlink_message_t* msg)
336 {
337  return _MAV_RETURN_float(msg, 4);
338 }
339 
345 static inline float mavlink_msg_safety_set_allowed_area_get_p1z(const mavlink_message_t* msg)
346 {
347  return _MAV_RETURN_float(msg, 8);
348 }
349 
355 static inline float mavlink_msg_safety_set_allowed_area_get_p2x(const mavlink_message_t* msg)
356 {
357  return _MAV_RETURN_float(msg, 12);
358 }
359 
365 static inline float mavlink_msg_safety_set_allowed_area_get_p2y(const mavlink_message_t* msg)
366 {
367  return _MAV_RETURN_float(msg, 16);
368 }
369 
375 static inline float mavlink_msg_safety_set_allowed_area_get_p2z(const mavlink_message_t* msg)
376 {
377  return _MAV_RETURN_float(msg, 20);
378 }
379 
386 static inline void mavlink_msg_safety_set_allowed_area_decode(const mavlink_message_t* msg, mavlink_safety_set_allowed_area_t* safety_set_allowed_area)
387 {
388 #if MAVLINK_NEED_BYTE_SWAP
389  safety_set_allowed_area->p1x = mavlink_msg_safety_set_allowed_area_get_p1x(msg);
390  safety_set_allowed_area->p1y = mavlink_msg_safety_set_allowed_area_get_p1y(msg);
391  safety_set_allowed_area->p1z = mavlink_msg_safety_set_allowed_area_get_p1z(msg);
392  safety_set_allowed_area->p2x = mavlink_msg_safety_set_allowed_area_get_p2x(msg);
393  safety_set_allowed_area->p2y = mavlink_msg_safety_set_allowed_area_get_p2y(msg);
394  safety_set_allowed_area->p2z = mavlink_msg_safety_set_allowed_area_get_p2z(msg);
397  safety_set_allowed_area->frame = mavlink_msg_safety_set_allowed_area_get_frame(msg);
398 #else
399  memcpy(safety_set_allowed_area, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_LEN);
400 #endif
401 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25