Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_home_position.h
blobab5130b8101615fa458a1e84921abf0abb0e75c8
1 #pragma once
2 // MESSAGE HOME_POSITION PACKING
4 #define MAVLINK_MSG_ID_HOME_POSITION 242
6 MAVPACKED(
7 typedef struct __mavlink_home_position_t {
8 int32_t latitude; /*< [degE7] Latitude (WGS84)*/
9 int32_t longitude; /*< [degE7] Longitude (WGS84)*/
10 int32_t altitude; /*< [mm] Altitude (MSL). Positive for up.*/
11 float x; /*< [m] Local X position of this position in the local coordinate frame*/
12 float y; /*< [m] Local Y position of this position in the local coordinate frame*/
13 float z; /*< [m] Local Z position of this position in the local coordinate frame*/
14 float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/
15 float approach_x; /*< [m] 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.*/
16 float approach_y; /*< [m] 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.*/
17 float approach_z; /*< [m] 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.*/
18 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
19 }) mavlink_home_position_t;
21 #define MAVLINK_MSG_ID_HOME_POSITION_LEN 60
22 #define MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN 52
23 #define MAVLINK_MSG_ID_242_LEN 60
24 #define MAVLINK_MSG_ID_242_MIN_LEN 52
26 #define MAVLINK_MSG_ID_HOME_POSITION_CRC 104
27 #define MAVLINK_MSG_ID_242_CRC 104
29 #define MAVLINK_MSG_HOME_POSITION_FIELD_Q_LEN 4
31 #if MAVLINK_COMMAND_24BIT
32 #define MAVLINK_MESSAGE_INFO_HOME_POSITION { \
33 242, \
34 "HOME_POSITION", \
35 11, \
36 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_home_position_t, latitude) }, \
37 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_home_position_t, longitude) }, \
38 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_home_position_t, altitude) }, \
39 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_home_position_t, x) }, \
40 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_home_position_t, y) }, \
41 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_home_position_t, z) }, \
42 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_home_position_t, q) }, \
43 { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_home_position_t, approach_x) }, \
44 { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_home_position_t, approach_y) }, \
45 { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_home_position_t, approach_z) }, \
46 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 52, offsetof(mavlink_home_position_t, time_usec) }, \
47 } \
49 #else
50 #define MAVLINK_MESSAGE_INFO_HOME_POSITION { \
51 "HOME_POSITION", \
52 11, \
53 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_home_position_t, latitude) }, \
54 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_home_position_t, longitude) }, \
55 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_home_position_t, altitude) }, \
56 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_home_position_t, x) }, \
57 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_home_position_t, y) }, \
58 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_home_position_t, z) }, \
59 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_home_position_t, q) }, \
60 { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_home_position_t, approach_x) }, \
61 { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_home_position_t, approach_y) }, \
62 { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_home_position_t, approach_z) }, \
63 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 52, offsetof(mavlink_home_position_t, time_usec) }, \
64 } \
66 #endif
68 /**
69 * @brief Pack a home_position message
70 * @param system_id ID of this system
71 * @param component_id ID of this component (e.g. 200 for IMU)
72 * @param msg The MAVLink message to compress the data into
74 * @param latitude [degE7] Latitude (WGS84)
75 * @param longitude [degE7] Longitude (WGS84)
76 * @param altitude [mm] Altitude (MSL). Positive for up.
77 * @param x [m] Local X position of this position in the local coordinate frame
78 * @param y [m] Local Y position of this position in the local coordinate frame
79 * @param z [m] Local Z position of this position in the local coordinate frame
80 * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
81 * @param approach_x [m] 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.
82 * @param approach_y [m] 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.
83 * @param approach_z [m] 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.
84 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
85 * @return length of the message in bytes (excluding serial stream start sign)
87 static inline uint16_t mavlink_msg_home_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
88 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, uint64_t time_usec)
90 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
91 char buf[MAVLINK_MSG_ID_HOME_POSITION_LEN];
92 _mav_put_int32_t(buf, 0, latitude);
93 _mav_put_int32_t(buf, 4, longitude);
94 _mav_put_int32_t(buf, 8, altitude);
95 _mav_put_float(buf, 12, x);
96 _mav_put_float(buf, 16, y);
97 _mav_put_float(buf, 20, z);
98 _mav_put_float(buf, 40, approach_x);
99 _mav_put_float(buf, 44, approach_y);
100 _mav_put_float(buf, 48, approach_z);
101 _mav_put_uint64_t(buf, 52, time_usec);
102 _mav_put_float_array(buf, 24, q, 4);
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN);
104 #else
105 mavlink_home_position_t packet;
106 packet.latitude = latitude;
107 packet.longitude = longitude;
108 packet.altitude = altitude;
109 packet.x = x;
110 packet.y = y;
111 packet.z = z;
112 packet.approach_x = approach_x;
113 packet.approach_y = approach_y;
114 packet.approach_z = approach_z;
115 packet.time_usec = time_usec;
116 mav_array_memcpy(packet.q, q, sizeof(float)*4);
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN);
118 #endif
120 msg->msgid = MAVLINK_MSG_ID_HOME_POSITION;
121 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
125 * @brief Pack a home_position message on a channel
126 * @param system_id ID of this system
127 * @param component_id ID of this component (e.g. 200 for IMU)
128 * @param chan The MAVLink channel this message will be sent over
129 * @param msg The MAVLink message to compress the data into
130 * @param latitude [degE7] Latitude (WGS84)
131 * @param longitude [degE7] Longitude (WGS84)
132 * @param altitude [mm] Altitude (MSL). Positive for up.
133 * @param x [m] Local X position of this position in the local coordinate frame
134 * @param y [m] Local Y position of this position in the local coordinate frame
135 * @param z [m] Local Z position of this position in the local coordinate frame
136 * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
137 * @param approach_x [m] 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.
138 * @param approach_y [m] 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.
139 * @param approach_z [m] 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.
140 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
141 * @return length of the message in bytes (excluding serial stream start sign)
143 static inline uint16_t mavlink_msg_home_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
144 mavlink_message_t* msg,
145 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,uint64_t time_usec)
147 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
148 char buf[MAVLINK_MSG_ID_HOME_POSITION_LEN];
149 _mav_put_int32_t(buf, 0, latitude);
150 _mav_put_int32_t(buf, 4, longitude);
151 _mav_put_int32_t(buf, 8, altitude);
152 _mav_put_float(buf, 12, x);
153 _mav_put_float(buf, 16, y);
154 _mav_put_float(buf, 20, z);
155 _mav_put_float(buf, 40, approach_x);
156 _mav_put_float(buf, 44, approach_y);
157 _mav_put_float(buf, 48, approach_z);
158 _mav_put_uint64_t(buf, 52, time_usec);
159 _mav_put_float_array(buf, 24, q, 4);
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN);
161 #else
162 mavlink_home_position_t packet;
163 packet.latitude = latitude;
164 packet.longitude = longitude;
165 packet.altitude = altitude;
166 packet.x = x;
167 packet.y = y;
168 packet.z = z;
169 packet.approach_x = approach_x;
170 packet.approach_y = approach_y;
171 packet.approach_z = approach_z;
172 packet.time_usec = time_usec;
173 mav_array_memcpy(packet.q, q, sizeof(float)*4);
174 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN);
175 #endif
177 msg->msgid = MAVLINK_MSG_ID_HOME_POSITION;
178 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
182 * @brief Encode a home_position struct
184 * @param system_id ID of this system
185 * @param component_id ID of this component (e.g. 200 for IMU)
186 * @param msg The MAVLink message to compress the data into
187 * @param home_position C-struct to read the message contents from
189 static inline uint16_t mavlink_msg_home_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_home_position_t* home_position)
191 return mavlink_msg_home_position_pack(system_id, component_id, msg, home_position->latitude, home_position->longitude, home_position->altitude, home_position->x, home_position->y, home_position->z, home_position->q, home_position->approach_x, home_position->approach_y, home_position->approach_z, home_position->time_usec);
195 * @brief Encode a home_position struct on a channel
197 * @param system_id ID of this system
198 * @param component_id ID of this component (e.g. 200 for IMU)
199 * @param chan The MAVLink channel this message will be sent over
200 * @param msg The MAVLink message to compress the data into
201 * @param home_position C-struct to read the message contents from
203 static inline uint16_t mavlink_msg_home_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_home_position_t* home_position)
205 return mavlink_msg_home_position_pack_chan(system_id, component_id, chan, msg, home_position->latitude, home_position->longitude, home_position->altitude, home_position->x, home_position->y, home_position->z, home_position->q, home_position->approach_x, home_position->approach_y, home_position->approach_z, home_position->time_usec);
209 * @brief Send a home_position message
210 * @param chan MAVLink channel to send the message
212 * @param latitude [degE7] Latitude (WGS84)
213 * @param longitude [degE7] Longitude (WGS84)
214 * @param altitude [mm] Altitude (MSL). Positive for up.
215 * @param x [m] Local X position of this position in the local coordinate frame
216 * @param y [m] Local Y position of this position in the local coordinate frame
217 * @param z [m] Local Z position of this position in the local coordinate frame
218 * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
219 * @param approach_x [m] 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.
220 * @param approach_y [m] 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.
221 * @param approach_z [m] 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.
222 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
224 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
226 static inline void mavlink_msg_home_position_send(mavlink_channel_t chan, 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, uint64_t time_usec)
228 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
229 char buf[MAVLINK_MSG_ID_HOME_POSITION_LEN];
230 _mav_put_int32_t(buf, 0, latitude);
231 _mav_put_int32_t(buf, 4, longitude);
232 _mav_put_int32_t(buf, 8, altitude);
233 _mav_put_float(buf, 12, x);
234 _mav_put_float(buf, 16, y);
235 _mav_put_float(buf, 20, z);
236 _mav_put_float(buf, 40, approach_x);
237 _mav_put_float(buf, 44, approach_y);
238 _mav_put_float(buf, 48, approach_z);
239 _mav_put_uint64_t(buf, 52, time_usec);
240 _mav_put_float_array(buf, 24, q, 4);
241 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, buf, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
242 #else
243 mavlink_home_position_t packet;
244 packet.latitude = latitude;
245 packet.longitude = longitude;
246 packet.altitude = altitude;
247 packet.x = x;
248 packet.y = y;
249 packet.z = z;
250 packet.approach_x = approach_x;
251 packet.approach_y = approach_y;
252 packet.approach_z = approach_z;
253 packet.time_usec = time_usec;
254 mav_array_memcpy(packet.q, q, sizeof(float)*4);
255 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, (const char *)&packet, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
256 #endif
260 * @brief Send a home_position message
261 * @param chan MAVLink channel to send the message
262 * @param struct The MAVLink struct to serialize
264 static inline void mavlink_msg_home_position_send_struct(mavlink_channel_t chan, const mavlink_home_position_t* home_position)
266 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
267 mavlink_msg_home_position_send(chan, home_position->latitude, home_position->longitude, home_position->altitude, home_position->x, home_position->y, home_position->z, home_position->q, home_position->approach_x, home_position->approach_y, home_position->approach_z, home_position->time_usec);
268 #else
269 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, (const char *)home_position, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
270 #endif
273 #if MAVLINK_MSG_ID_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
275 This varient of _send() can be used to save stack space by re-using
276 memory from the receive buffer. The caller provides a
277 mavlink_message_t which is the size of a full mavlink message. This
278 is usually the receive buffer for the channel, and allows a reply to an
279 incoming message with minimum stack space usage.
281 static inline void mavlink_msg_home_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, 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, uint64_t time_usec)
283 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
284 char *buf = (char *)msgbuf;
285 _mav_put_int32_t(buf, 0, latitude);
286 _mav_put_int32_t(buf, 4, longitude);
287 _mav_put_int32_t(buf, 8, altitude);
288 _mav_put_float(buf, 12, x);
289 _mav_put_float(buf, 16, y);
290 _mav_put_float(buf, 20, z);
291 _mav_put_float(buf, 40, approach_x);
292 _mav_put_float(buf, 44, approach_y);
293 _mav_put_float(buf, 48, approach_z);
294 _mav_put_uint64_t(buf, 52, time_usec);
295 _mav_put_float_array(buf, 24, q, 4);
296 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, buf, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
297 #else
298 mavlink_home_position_t *packet = (mavlink_home_position_t *)msgbuf;
299 packet->latitude = latitude;
300 packet->longitude = longitude;
301 packet->altitude = altitude;
302 packet->x = x;
303 packet->y = y;
304 packet->z = z;
305 packet->approach_x = approach_x;
306 packet->approach_y = approach_y;
307 packet->approach_z = approach_z;
308 packet->time_usec = time_usec;
309 mav_array_memcpy(packet->q, q, sizeof(float)*4);
310 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HOME_POSITION, (const char *)packet, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
311 #endif
313 #endif
315 #endif
317 // MESSAGE HOME_POSITION UNPACKING
321 * @brief Get field latitude from home_position message
323 * @return [degE7] Latitude (WGS84)
325 static inline int32_t mavlink_msg_home_position_get_latitude(const mavlink_message_t* msg)
327 return _MAV_RETURN_int32_t(msg, 0);
331 * @brief Get field longitude from home_position message
333 * @return [degE7] Longitude (WGS84)
335 static inline int32_t mavlink_msg_home_position_get_longitude(const mavlink_message_t* msg)
337 return _MAV_RETURN_int32_t(msg, 4);
341 * @brief Get field altitude from home_position message
343 * @return [mm] Altitude (MSL). Positive for up.
345 static inline int32_t mavlink_msg_home_position_get_altitude(const mavlink_message_t* msg)
347 return _MAV_RETURN_int32_t(msg, 8);
351 * @brief Get field x from home_position message
353 * @return [m] Local X position of this position in the local coordinate frame
355 static inline float mavlink_msg_home_position_get_x(const mavlink_message_t* msg)
357 return _MAV_RETURN_float(msg, 12);
361 * @brief Get field y from home_position message
363 * @return [m] Local Y position of this position in the local coordinate frame
365 static inline float mavlink_msg_home_position_get_y(const mavlink_message_t* msg)
367 return _MAV_RETURN_float(msg, 16);
371 * @brief Get field z from home_position message
373 * @return [m] Local Z position of this position in the local coordinate frame
375 static inline float mavlink_msg_home_position_get_z(const mavlink_message_t* msg)
377 return _MAV_RETURN_float(msg, 20);
381 * @brief Get field q from home_position message
383 * @return World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
385 static inline uint16_t mavlink_msg_home_position_get_q(const mavlink_message_t* msg, float *q)
387 return _MAV_RETURN_float_array(msg, q, 4, 24);
391 * @brief Get field approach_x from home_position message
393 * @return [m] 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.
395 static inline float mavlink_msg_home_position_get_approach_x(const mavlink_message_t* msg)
397 return _MAV_RETURN_float(msg, 40);
401 * @brief Get field approach_y from home_position message
403 * @return [m] 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.
405 static inline float mavlink_msg_home_position_get_approach_y(const mavlink_message_t* msg)
407 return _MAV_RETURN_float(msg, 44);
411 * @brief Get field approach_z from home_position message
413 * @return [m] 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.
415 static inline float mavlink_msg_home_position_get_approach_z(const mavlink_message_t* msg)
417 return _MAV_RETURN_float(msg, 48);
421 * @brief Get field time_usec from home_position message
423 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
425 static inline uint64_t mavlink_msg_home_position_get_time_usec(const mavlink_message_t* msg)
427 return _MAV_RETURN_uint64_t(msg, 52);
431 * @brief Decode a home_position message into a struct
433 * @param msg The message to decode
434 * @param home_position C-struct to decode the message contents into
436 static inline void mavlink_msg_home_position_decode(const mavlink_message_t* msg, mavlink_home_position_t* home_position)
438 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
439 home_position->latitude = mavlink_msg_home_position_get_latitude(msg);
440 home_position->longitude = mavlink_msg_home_position_get_longitude(msg);
441 home_position->altitude = mavlink_msg_home_position_get_altitude(msg);
442 home_position->x = mavlink_msg_home_position_get_x(msg);
443 home_position->y = mavlink_msg_home_position_get_y(msg);
444 home_position->z = mavlink_msg_home_position_get_z(msg);
445 mavlink_msg_home_position_get_q(msg, home_position->q);
446 home_position->approach_x = mavlink_msg_home_position_get_approach_x(msg);
447 home_position->approach_y = mavlink_msg_home_position_get_approach_y(msg);
448 home_position->approach_z = mavlink_msg_home_position_get_approach_z(msg);
449 home_position->time_usec = mavlink_msg_home_position_get_time_usec(msg);
450 #else
451 uint8_t len = msg->len < MAVLINK_MSG_ID_HOME_POSITION_LEN? msg->len : MAVLINK_MSG_ID_HOME_POSITION_LEN;
452 memset(home_position, 0, MAVLINK_MSG_ID_HOME_POSITION_LEN);
453 memcpy(home_position, _MAV_PAYLOAD(msg), len);
454 #endif