mavlink_msg_set_home_position.h
Go to the documentation of this file.
1 // MESSAGE SET_HOME_POSITION PACKING
2 
3 #define MAVLINK_MSG_ID_SET_HOME_POSITION 243
4 
6 {
7  int32_t latitude; /*< Latitude (WGS84), in degrees * 1E7*/
8  int32_t longitude; /*< Longitude (WGS84, in degrees * 1E7*/
9  int32_t altitude; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
10  float x; /*< Local X position of this position in the local coordinate frame*/
11  float y; /*< Local Y position of this position in the local coordinate frame*/
12  float z; /*< Local Z position of this position in the local coordinate frame*/
13  float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/
14  float approach_x; /*< Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
15  float approach_y; /*< Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
16  float approach_z; /*< Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
17  uint8_t target_system; /*< System ID.*/
19 
20 #define MAVLINK_MSG_ID_SET_HOME_POSITION_LEN 53
21 #define MAVLINK_MSG_ID_243_LEN 53
22 
23 #define MAVLINK_MSG_ID_SET_HOME_POSITION_CRC 85
24 #define MAVLINK_MSG_ID_243_CRC 85
25 
26 #define MAVLINK_MSG_SET_HOME_POSITION_FIELD_Q_LEN 4
27 
28 #define MAVLINK_MESSAGE_INFO_SET_HOME_POSITION { \
29  "SET_HOME_POSITION", \
30  11, \
31  { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_set_home_position_t, latitude) }, \
32  { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_set_home_position_t, longitude) }, \
33  { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_set_home_position_t, altitude) }, \
34  { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_set_home_position_t, x) }, \
35  { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_set_home_position_t, y) }, \
36  { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_set_home_position_t, z) }, \
37  { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_set_home_position_t, q) }, \
38  { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_set_home_position_t, approach_x) }, \
39  { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_set_home_position_t, approach_y) }, \
40  { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_set_home_position_t, approach_z) }, \
41  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_set_home_position_t, target_system) }, \
42  } \
43 }
44 
45 
65 static inline uint16_t mavlink_msg_set_home_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
66  uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
67 {
68 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70  _mav_put_int32_t(buf, 0, latitude);
71  _mav_put_int32_t(buf, 4, longitude);
72  _mav_put_int32_t(buf, 8, altitude);
73  _mav_put_float(buf, 12, x);
74  _mav_put_float(buf, 16, y);
75  _mav_put_float(buf, 20, z);
76  _mav_put_float(buf, 40, approach_x);
77  _mav_put_float(buf, 44, approach_y);
78  _mav_put_float(buf, 48, approach_z);
79  _mav_put_uint8_t(buf, 52, target_system);
80  _mav_put_float_array(buf, 24, q, 4);
82 #else
84  packet.latitude = latitude;
85  packet.longitude = longitude;
86  packet.altitude = altitude;
87  packet.x = x;
88  packet.y = y;
89  packet.z = z;
90  packet.approach_x = approach_x;
91  packet.approach_y = approach_y;
92  packet.approach_z = approach_z;
94  mav_array_memcpy(packet.q, q, sizeof(float)*4);
96 #endif
97 
99 #if MAVLINK_CRC_EXTRA
101 #else
102  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
103 #endif
104 }
105 
125 static inline uint16_t mavlink_msg_set_home_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
126  mavlink_message_t* msg,
127  uint8_t target_system,int32_t latitude,int32_t longitude,int32_t altitude,float x,float y,float z,const float *q,float approach_x,float approach_y,float approach_z)
128 {
129 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
131  _mav_put_int32_t(buf, 0, latitude);
132  _mav_put_int32_t(buf, 4, longitude);
133  _mav_put_int32_t(buf, 8, altitude);
134  _mav_put_float(buf, 12, x);
135  _mav_put_float(buf, 16, y);
136  _mav_put_float(buf, 20, z);
137  _mav_put_float(buf, 40, approach_x);
138  _mav_put_float(buf, 44, approach_y);
139  _mav_put_float(buf, 48, approach_z);
140  _mav_put_uint8_t(buf, 52, target_system);
141  _mav_put_float_array(buf, 24, q, 4);
143 #else
145  packet.latitude = latitude;
146  packet.longitude = longitude;
147  packet.altitude = altitude;
148  packet.x = x;
149  packet.y = y;
150  packet.z = z;
151  packet.approach_x = approach_x;
152  packet.approach_y = approach_y;
153  packet.approach_z = approach_z;
154  packet.target_system = target_system;
155  mav_array_memcpy(packet.q, q, sizeof(float)*4);
157 #endif
158 
160 #if MAVLINK_CRC_EXTRA
162 #else
163  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
164 #endif
165 }
166 
175 static inline uint16_t mavlink_msg_set_home_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
176 {
177  return mavlink_msg_set_home_position_pack(system_id, component_id, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z);
178 }
179 
189 static inline uint16_t mavlink_msg_set_home_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
190 {
191  return mavlink_msg_set_home_position_pack_chan(system_id, component_id, chan, msg, set_home_position->target_system, set_home_position->latitude, set_home_position->longitude, set_home_position->altitude, set_home_position->x, set_home_position->y, set_home_position->z, set_home_position->q, set_home_position->approach_x, set_home_position->approach_y, set_home_position->approach_z);
192 }
193 
210 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
211 
212 static inline void mavlink_msg_set_home_position_send(mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
213 {
214 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
216  _mav_put_int32_t(buf, 0, latitude);
217  _mav_put_int32_t(buf, 4, longitude);
218  _mav_put_int32_t(buf, 8, altitude);
219  _mav_put_float(buf, 12, x);
220  _mav_put_float(buf, 16, y);
221  _mav_put_float(buf, 20, z);
222  _mav_put_float(buf, 40, approach_x);
223  _mav_put_float(buf, 44, approach_y);
224  _mav_put_float(buf, 48, approach_z);
226  _mav_put_float_array(buf, 24, q, 4);
227 #if MAVLINK_CRC_EXTRA
229 #else
230  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, buf, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
231 #endif
232 #else
234  packet.latitude = latitude;
235  packet.longitude = longitude;
236  packet.altitude = altitude;
237  packet.x = x;
238  packet.y = y;
239  packet.z = z;
240  packet.approach_x = approach_x;
241  packet.approach_y = approach_y;
242  packet.approach_z = approach_z;
243  packet.target_system = target_system;
244  mav_array_memcpy(packet.q, q, sizeof(float)*4);
245 #if MAVLINK_CRC_EXTRA
246  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
247 #else
248  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
249 #endif
250 #endif
251 }
252 
253 #if MAVLINK_MSG_ID_SET_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
254 /*
255  This varient of _send() can be used to save stack space by re-using
256  memory from the receive buffer. The caller provides a
257  mavlink_message_t which is the size of a full mavlink message. This
258  is usually the receive buffer for the channel, and allows a reply to an
259  incoming message with minimum stack space usage.
260  */
261 static inline void mavlink_msg_set_home_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z)
262 {
263 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
264  char *buf = (char *)msgbuf;
265  _mav_put_int32_t(buf, 0, latitude);
266  _mav_put_int32_t(buf, 4, longitude);
267  _mav_put_int32_t(buf, 8, altitude);
268  _mav_put_float(buf, 12, x);
269  _mav_put_float(buf, 16, y);
270  _mav_put_float(buf, 20, z);
271  _mav_put_float(buf, 40, approach_x);
272  _mav_put_float(buf, 44, approach_y);
273  _mav_put_float(buf, 48, approach_z);
275  _mav_put_float_array(buf, 24, q, 4);
276 #if MAVLINK_CRC_EXTRA
278 #else
279  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, buf, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
280 #endif
281 #else
283  packet->latitude = latitude;
284  packet->longitude = longitude;
285  packet->altitude = altitude;
286  packet->x = x;
287  packet->y = y;
288  packet->z = z;
289  packet->approach_x = approach_x;
290  packet->approach_y = approach_y;
291  packet->approach_z = approach_z;
292  packet->target_system = target_system;
293  mav_array_memcpy(packet->q, q, sizeof(float)*4);
294 #if MAVLINK_CRC_EXTRA
295  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
296 #else
297  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
298 #endif
299 #endif
300 }
301 #endif
302 
303 #endif
304 
305 // MESSAGE SET_HOME_POSITION UNPACKING
306 
307 
313 static inline uint8_t mavlink_msg_set_home_position_get_target_system(const mavlink_message_t* msg)
314 {
315  return _MAV_RETURN_uint8_t(msg, 52);
316 }
317 
323 static inline int32_t mavlink_msg_set_home_position_get_latitude(const mavlink_message_t* msg)
324 {
325  return _MAV_RETURN_int32_t(msg, 0);
326 }
327 
333 static inline int32_t mavlink_msg_set_home_position_get_longitude(const mavlink_message_t* msg)
334 {
335  return _MAV_RETURN_int32_t(msg, 4);
336 }
337 
343 static inline int32_t mavlink_msg_set_home_position_get_altitude(const mavlink_message_t* msg)
344 {
345  return _MAV_RETURN_int32_t(msg, 8);
346 }
347 
353 static inline float mavlink_msg_set_home_position_get_x(const mavlink_message_t* msg)
354 {
355  return _MAV_RETURN_float(msg, 12);
356 }
357 
363 static inline float mavlink_msg_set_home_position_get_y(const mavlink_message_t* msg)
364 {
365  return _MAV_RETURN_float(msg, 16);
366 }
367 
373 static inline float mavlink_msg_set_home_position_get_z(const mavlink_message_t* msg)
374 {
375  return _MAV_RETURN_float(msg, 20);
376 }
377 
383 static inline uint16_t mavlink_msg_set_home_position_get_q(const mavlink_message_t* msg, float *q)
384 {
385  return _MAV_RETURN_float_array(msg, q, 4, 24);
386 }
387 
393 static inline float mavlink_msg_set_home_position_get_approach_x(const mavlink_message_t* msg)
394 {
395  return _MAV_RETURN_float(msg, 40);
396 }
397 
403 static inline float mavlink_msg_set_home_position_get_approach_y(const mavlink_message_t* msg)
404 {
405  return _MAV_RETURN_float(msg, 44);
406 }
407 
413 static inline float mavlink_msg_set_home_position_get_approach_z(const mavlink_message_t* msg)
414 {
415  return _MAV_RETURN_float(msg, 48);
416 }
417 
424 static inline void mavlink_msg_set_home_position_decode(const mavlink_message_t* msg, mavlink_set_home_position_t* set_home_position)
425 {
426 #if MAVLINK_NEED_BYTE_SWAP
427  set_home_position->latitude = mavlink_msg_set_home_position_get_latitude(msg);
428  set_home_position->longitude = mavlink_msg_set_home_position_get_longitude(msg);
429  set_home_position->altitude = mavlink_msg_set_home_position_get_altitude(msg);
430  set_home_position->x = mavlink_msg_set_home_position_get_x(msg);
431  set_home_position->y = mavlink_msg_set_home_position_get_y(msg);
432  set_home_position->z = mavlink_msg_set_home_position_get_z(msg);
433  mavlink_msg_set_home_position_get_q(msg, set_home_position->q);
438 #else
439  memcpy(set_home_position, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
440 #endif
441 }
#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
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176


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