RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_home_position.h
1#pragma once
2// MESSAGE HOME_POSITION PACKING
3
4#define MAVLINK_MSG_ID_HOME_POSITION 242
5
6MAVPACKED(
7typedef struct __mavlink_home_position_t {
8 int32_t latitude; /*< Latitude (WGS84), in degrees * 1E7*/
9 int32_t longitude; /*< Longitude (WGS84, in degrees * 1E7*/
10 int32_t altitude; /*< Altitude (AMSL), in meters * 1000 (positive for up)*/
11 float x; /*< Local X position of this position in the local coordinate frame*/
12 float y; /*< Local Y position of this position in the local coordinate frame*/
13 float z; /*< 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; /*< 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; /*< 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; /*< 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; /*< Timestamp (microseconds since UNIX epoch or microseconds since system boot)*/
19}) mavlink_home_position_t;
20
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
25
26#define MAVLINK_MSG_ID_HOME_POSITION_CRC 104
27#define MAVLINK_MSG_ID_242_CRC 104
28
29#define MAVLINK_MSG_HOME_POSITION_FIELD_Q_LEN 4
30
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 } \
48}
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 } \
65}
66#endif
67
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
73 *
74 * @param latitude Latitude (WGS84), in degrees * 1E7
75 * @param longitude Longitude (WGS84, in degrees * 1E7
76 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
77 * @param x Local X position of this position in the local coordinate frame
78 * @param y Local Y position of this position in the local coordinate frame
79 * @param z 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 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 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 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 Timestamp (microseconds since UNIX epoch or microseconds since system boot)
85 * @return length of the message in bytes (excluding serial stream start sign)
86 */
87static 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)
89{
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
119
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);
122}
123
124/**
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 Latitude (WGS84), in degrees * 1E7
131 * @param longitude Longitude (WGS84, in degrees * 1E7
132 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
133 * @param x Local X position of this position in the local coordinate frame
134 * @param y Local Y position of this position in the local coordinate frame
135 * @param z 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 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 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 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 Timestamp (microseconds since UNIX epoch or microseconds since system boot)
141 * @return length of the message in bytes (excluding serial stream start sign)
142 */
143static 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)
146{
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
176
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);
179}
180
181/**
182 * @brief Encode a home_position struct
183 *
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
188 */
189static 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)
190{
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);
192}
193
194/**
195 * @brief Encode a home_position struct on a channel
196 *
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
202 */
203static 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)
204{
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);
206}
207
208/**
209 * @brief Send a home_position message
210 * @param chan MAVLink channel to send the message
211 *
212 * @param latitude Latitude (WGS84), in degrees * 1E7
213 * @param longitude Longitude (WGS84, in degrees * 1E7
214 * @param altitude Altitude (AMSL), in meters * 1000 (positive for up)
215 * @param x Local X position of this position in the local coordinate frame
216 * @param y Local Y position of this position in the local coordinate frame
217 * @param z 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 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 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 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 Timestamp (microseconds since UNIX epoch or microseconds since system boot)
223 */
224#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
225
226static 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)
227{
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
257}
258
259/**
260 * @brief Send a home_position message
261 * @param chan MAVLink channel to send the message
262 * @param struct The MAVLink struct to serialize
263 */
264static inline void mavlink_msg_home_position_send_struct(mavlink_channel_t chan, const mavlink_home_position_t* home_position)
265{
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
271}
272
273#if MAVLINK_MSG_ID_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
274/*
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.
280 */
281static 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)
282{
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
312}
313#endif
314
315#endif
316
317// MESSAGE HOME_POSITION UNPACKING
318
319
320/**
321 * @brief Get field latitude from home_position message
322 *
323 * @return Latitude (WGS84), in degrees * 1E7
324 */
325static inline int32_t mavlink_msg_home_position_get_latitude(const mavlink_message_t* msg)
326{
327 return _MAV_RETURN_int32_t(msg, 0);
328}
329
330/**
331 * @brief Get field longitude from home_position message
332 *
333 * @return Longitude (WGS84, in degrees * 1E7
334 */
335static inline int32_t mavlink_msg_home_position_get_longitude(const mavlink_message_t* msg)
336{
337 return _MAV_RETURN_int32_t(msg, 4);
338}
339
340/**
341 * @brief Get field altitude from home_position message
342 *
343 * @return Altitude (AMSL), in meters * 1000 (positive for up)
344 */
345static inline int32_t mavlink_msg_home_position_get_altitude(const mavlink_message_t* msg)
346{
347 return _MAV_RETURN_int32_t(msg, 8);
348}
349
350/**
351 * @brief Get field x from home_position message
352 *
353 * @return Local X position of this position in the local coordinate frame
354 */
355static inline float mavlink_msg_home_position_get_x(const mavlink_message_t* msg)
356{
357 return _MAV_RETURN_float(msg, 12);
358}
359
360/**
361 * @brief Get field y from home_position message
362 *
363 * @return Local Y position of this position in the local coordinate frame
364 */
365static inline float mavlink_msg_home_position_get_y(const mavlink_message_t* msg)
366{
367 return _MAV_RETURN_float(msg, 16);
368}
369
370/**
371 * @brief Get field z from home_position message
372 *
373 * @return Local Z position of this position in the local coordinate frame
374 */
375static inline float mavlink_msg_home_position_get_z(const mavlink_message_t* msg)
376{
377 return _MAV_RETURN_float(msg, 20);
378}
379
380/**
381 * @brief Get field q from home_position message
382 *
383 * @return World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
384 */
385static inline uint16_t mavlink_msg_home_position_get_q(const mavlink_message_t* msg, float *q)
386{
387 return _MAV_RETURN_float_array(msg, q, 4, 24);
388}
389
390/**
391 * @brief Get field approach_x from home_position message
392 *
393 * @return 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.
394 */
395static inline float mavlink_msg_home_position_get_approach_x(const mavlink_message_t* msg)
396{
397 return _MAV_RETURN_float(msg, 40);
398}
399
400/**
401 * @brief Get field approach_y from home_position message
402 *
403 * @return 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.
404 */
405static inline float mavlink_msg_home_position_get_approach_y(const mavlink_message_t* msg)
406{
407 return _MAV_RETURN_float(msg, 44);
408}
409
410/**
411 * @brief Get field approach_z from home_position message
412 *
413 * @return 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.
414 */
415static inline float mavlink_msg_home_position_get_approach_z(const mavlink_message_t* msg)
416{
417 return _MAV_RETURN_float(msg, 48);
418}
419
420/**
421 * @brief Get field time_usec from home_position message
422 *
423 * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
424 */
425static inline uint64_t mavlink_msg_home_position_get_time_usec(const mavlink_message_t* msg)
426{
427 return _MAV_RETURN_uint64_t(msg, 52);
428}
429
430/**
431 * @brief Decode a home_position message into a struct
432 *
433 * @param msg The message to decode
434 * @param home_position C-struct to decode the message contents into
435 */
436static inline void mavlink_msg_home_position_decode(const mavlink_message_t* msg, mavlink_home_position_t* home_position)
437{
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
455}