Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_home_position.h
Go to the documentation of this file.
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; /*< [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 (NED)*/
12 float y; /*< [m] Local Y position of this position in the local coordinate frame (NED)*/
13 float z; /*< [m] Local Z position of this position in the local coordinate frame (NED: positive "down")*/
14 float q[4]; /*<
15 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
16 Used to indicate the heading and slope of the ground.
17 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
18 */
19 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.*/
20 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.*/
21 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.*/
22 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.*/
23}) mavlink_home_position_t;
24
25#define MAVLINK_MSG_ID_HOME_POSITION_LEN 60
26#define MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN 52
27#define MAVLINK_MSG_ID_242_LEN 60
28#define MAVLINK_MSG_ID_242_MIN_LEN 52
29
30#define MAVLINK_MSG_ID_HOME_POSITION_CRC 104
31#define MAVLINK_MSG_ID_242_CRC 104
32
33#define MAVLINK_MSG_HOME_POSITION_FIELD_Q_LEN 4
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_HOME_POSITION {
37 242,
38 "HOME_POSITION",
39 11,
40 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_home_position_t, latitude) },
41 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_home_position_t, longitude) },
42 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_home_position_t, altitude) },
43 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_home_position_t, x) },
44 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_home_position_t, y) },
45 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_home_position_t, z) },
46 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_home_position_t, q) },
47 { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_home_position_t, approach_x) },
48 { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_home_position_t, approach_y) },
49 { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_home_position_t, approach_z) },
50 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 52, offsetof(mavlink_home_position_t, time_usec) },
51 } \
52}
53#else
54#define MAVLINK_MESSAGE_INFO_HOME_POSITION {
55 "HOME_POSITION",
56 11,
57 { { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_home_position_t, latitude) },
58 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_home_position_t, longitude) },
59 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_home_position_t, altitude) },
60 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_home_position_t, x) },
61 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_home_position_t, y) },
62 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_home_position_t, z) },
63 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 24, offsetof(mavlink_home_position_t, q) },
64 { "approach_x", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_home_position_t, approach_x) },
65 { "approach_y", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_home_position_t, approach_y) },
66 { "approach_z", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_home_position_t, approach_z) },
67 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 52, offsetof(mavlink_home_position_t, time_usec) },
68 } \
69}
70#endif
71
72/**
73 * @brief Pack a home_position message
74 * @param system_id ID of this system
75 * @param component_id ID of this component (e.g. 200 for IMU)
76 * @param msg The MAVLink message to compress the data into
77 *
78 * @param latitude [degE7] Latitude (WGS84)
79 * @param longitude [degE7] Longitude (WGS84)
80 * @param altitude [mm] Altitude (MSL). Positive for up.
81 * @param x [m] Local X position of this position in the local coordinate frame (NED)
82 * @param y [m] Local Y position of this position in the local coordinate frame (NED)
83 * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down")
84 * @param q
85 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
86 Used to indicate the heading and slope of the ground.
87 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
88
89 * @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.
90 * @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.
91 * @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.
92 * @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.
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static inline uint16_t mavlink_msg_home_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 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)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 _mav_put_int32_t(buf, 0, latitude);
101 _mav_put_int32_t(buf, 4, longitude);
102 _mav_put_int32_t(buf, 8, altitude);
103 _mav_put_float(buf, 12, x);
104 _mav_put_float(buf, 16, y);
105 _mav_put_float(buf, 20, z);
106 _mav_put_float(buf, 40, approach_x);
107 _mav_put_float(buf, 44, approach_y);
108 _mav_put_float(buf, 48, approach_z);
109 _mav_put_uint64_t(buf, 52, time_usec);
110 _mav_put_float_array(buf, 24, q, 4);
111 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN);
112#else
113 mavlink_home_position_t packet;
114 packet.latitude = latitude;
115 packet.longitude = longitude;
116 packet.altitude = altitude;
117 packet.x = x;
118 packet.y = y;
119 packet.z = z;
120 packet.approach_x = approach_x;
121 packet.approach_y = approach_y;
122 packet.approach_z = approach_z;
123 packet.time_usec = time_usec;
124 mav_array_memcpy(packet.q, q, sizeof(float)*4);
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN);
126#endif
127
128 msg->msgid = MAVLINK_MSG_ID_HOME_POSITION;
129 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);
130}
131
132/**
133 * @brief Pack a home_position message
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param status MAVLink status structure
137 * @param msg The MAVLink message to compress the data into
138 *
139 * @param latitude [degE7] Latitude (WGS84)
140 * @param longitude [degE7] Longitude (WGS84)
141 * @param altitude [mm] Altitude (MSL). Positive for up.
142 * @param x [m] Local X position of this position in the local coordinate frame (NED)
143 * @param y [m] Local Y position of this position in the local coordinate frame (NED)
144 * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down")
145 * @param q
146 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
147 Used to indicate the heading and slope of the ground.
148 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
149
150 * @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.
151 * @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.
152 * @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.
153 * @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.
154 * @return length of the message in bytes (excluding serial stream start sign)
155 */
156static inline uint16_t mavlink_msg_home_position_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
157 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)
158{
159#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
161 _mav_put_int32_t(buf, 0, latitude);
162 _mav_put_int32_t(buf, 4, longitude);
163 _mav_put_int32_t(buf, 8, altitude);
164 _mav_put_float(buf, 12, x);
165 _mav_put_float(buf, 16, y);
166 _mav_put_float(buf, 20, z);
167 _mav_put_float(buf, 40, approach_x);
168 _mav_put_float(buf, 44, approach_y);
169 _mav_put_float(buf, 48, approach_z);
170 _mav_put_uint64_t(buf, 52, time_usec);
171 _mav_put_float_array(buf, 24, q, 4);
172 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN);
173#else
174 mavlink_home_position_t packet;
175 packet.latitude = latitude;
176 packet.longitude = longitude;
177 packet.altitude = altitude;
178 packet.x = x;
179 packet.y = y;
180 packet.z = z;
181 packet.approach_x = approach_x;
182 packet.approach_y = approach_y;
183 packet.approach_z = approach_z;
184 packet.time_usec = time_usec;
185 mav_array_memcpy(packet.q, q, sizeof(float)*4);
186 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN);
187#endif
188
189 msg->msgid = MAVLINK_MSG_ID_HOME_POSITION;
190#if MAVLINK_CRC_EXTRA
191 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN, MAVLINK_MSG_ID_HOME_POSITION_CRC);
192#else
193 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_HOME_POSITION_LEN);
194#endif
195}
196
197/**
198 * @brief Pack a home_position message on a channel
199 * @param system_id ID of this system
200 * @param component_id ID of this component (e.g. 200 for IMU)
201 * @param chan The MAVLink channel this message will be sent over
202 * @param msg The MAVLink message to compress the data into
203 * @param latitude [degE7] Latitude (WGS84)
204 * @param longitude [degE7] Longitude (WGS84)
205 * @param altitude [mm] Altitude (MSL). Positive for up.
206 * @param x [m] Local X position of this position in the local coordinate frame (NED)
207 * @param y [m] Local Y position of this position in the local coordinate frame (NED)
208 * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down")
209 * @param q
210 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
211 Used to indicate the heading and slope of the ground.
212 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
213
214 * @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.
215 * @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.
216 * @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.
217 * @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.
218 * @return length of the message in bytes (excluding serial stream start sign)
219 */
220static inline uint16_t mavlink_msg_home_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
221 mavlink_message_t* msg,
222 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)
223{
224#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226 _mav_put_int32_t(buf, 0, latitude);
227 _mav_put_int32_t(buf, 4, longitude);
228 _mav_put_int32_t(buf, 8, altitude);
229 _mav_put_float(buf, 12, x);
230 _mav_put_float(buf, 16, y);
231 _mav_put_float(buf, 20, z);
232 _mav_put_float(buf, 40, approach_x);
233 _mav_put_float(buf, 44, approach_y);
234 _mav_put_float(buf, 48, approach_z);
235 _mav_put_uint64_t(buf, 52, time_usec);
236 _mav_put_float_array(buf, 24, q, 4);
237 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HOME_POSITION_LEN);
238#else
239 mavlink_home_position_t packet;
240 packet.latitude = latitude;
241 packet.longitude = longitude;
242 packet.altitude = altitude;
243 packet.x = x;
244 packet.y = y;
245 packet.z = z;
246 packet.approach_x = approach_x;
247 packet.approach_y = approach_y;
248 packet.approach_z = approach_z;
249 packet.time_usec = time_usec;
250 mav_array_memcpy(packet.q, q, sizeof(float)*4);
251 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HOME_POSITION_LEN);
252#endif
253
254 msg->msgid = MAVLINK_MSG_ID_HOME_POSITION;
255 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);
256}
257
258/**
259 * @brief Encode a home_position struct
260 *
261 * @param system_id ID of this system
262 * @param component_id ID of this component (e.g. 200 for IMU)
263 * @param msg The MAVLink message to compress the data into
264 * @param home_position C-struct to read the message contents from
265 */
266static 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)
267{
268 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);
269}
270
271/**
272 * @brief Encode a home_position struct on a channel
273 *
274 * @param system_id ID of this system
275 * @param component_id ID of this component (e.g. 200 for IMU)
276 * @param chan The MAVLink channel this message will be sent over
277 * @param msg The MAVLink message to compress the data into
278 * @param home_position C-struct to read the message contents from
279 */
280static 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)
281{
282 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);
283}
284
285/**
286 * @brief Encode a home_position struct with provided status structure
287 *
288 * @param system_id ID of this system
289 * @param component_id ID of this component (e.g. 200 for IMU)
290 * @param status MAVLink status structure
291 * @param msg The MAVLink message to compress the data into
292 * @param home_position C-struct to read the message contents from
293 */
294static inline uint16_t mavlink_msg_home_position_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_home_position_t* home_position)
295{
296 return mavlink_msg_home_position_pack_status(system_id, component_id, _status, 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);
297}
298
299/**
300 * @brief Send a home_position message
301 * @param chan MAVLink channel to send the message
302 *
303 * @param latitude [degE7] Latitude (WGS84)
304 * @param longitude [degE7] Longitude (WGS84)
305 * @param altitude [mm] Altitude (MSL). Positive for up.
306 * @param x [m] Local X position of this position in the local coordinate frame (NED)
307 * @param y [m] Local Y position of this position in the local coordinate frame (NED)
308 * @param z [m] Local Z position of this position in the local coordinate frame (NED: positive "down")
309 * @param q
310 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
311 Used to indicate the heading and slope of the ground.
312 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
313
314 * @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.
315 * @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.
316 * @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.
317 * @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.
318 */
319#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
320
321static 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)
322{
323#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
324 char buf[MAVLINK_MSG_ID_HOME_POSITION_LEN];
325 _mav_put_int32_t(buf, 0, latitude);
326 _mav_put_int32_t(buf, 4, longitude);
327 _mav_put_int32_t(buf, 8, altitude);
328 _mav_put_float(buf, 12, x);
329 _mav_put_float(buf, 16, y);
330 _mav_put_float(buf, 20, z);
331 _mav_put_float(buf, 40, approach_x);
332 _mav_put_float(buf, 44, approach_y);
333 _mav_put_float(buf, 48, approach_z);
334 _mav_put_uint64_t(buf, 52, time_usec);
335 _mav_put_float_array(buf, 24, q, 4);
336 _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);
337#else
338 mavlink_home_position_t packet;
339 packet.latitude = latitude;
340 packet.longitude = longitude;
341 packet.altitude = altitude;
342 packet.x = x;
343 packet.y = y;
344 packet.z = z;
345 packet.approach_x = approach_x;
346 packet.approach_y = approach_y;
347 packet.approach_z = approach_z;
348 packet.time_usec = time_usec;
349 mav_array_memcpy(packet.q, q, sizeof(float)*4);
350 _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);
351#endif
352}
353
354/**
355 * @brief Send a home_position message
356 * @param chan MAVLink channel to send the message
357 * @param struct The MAVLink struct to serialize
358 */
359static inline void mavlink_msg_home_position_send_struct(mavlink_channel_t chan, const mavlink_home_position_t* home_position)
360{
361#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
362 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);
363#else
364 _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);
365#endif
366}
367
368#if MAVLINK_MSG_ID_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
369/*
370 This variant of _send() can be used to save stack space by reusing
371 memory from the receive buffer. The caller provides a
372 mavlink_message_t which is the size of a full mavlink message. This
373 is usually the receive buffer for the channel, and allows a reply to an
374 incoming message with minimum stack space usage.
375 */
376static 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)
377{
378#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
379 char *buf = (char *)msgbuf;
380 _mav_put_int32_t(buf, 0, latitude);
381 _mav_put_int32_t(buf, 4, longitude);
382 _mav_put_int32_t(buf, 8, altitude);
383 _mav_put_float(buf, 12, x);
384 _mav_put_float(buf, 16, y);
385 _mav_put_float(buf, 20, z);
386 _mav_put_float(buf, 40, approach_x);
387 _mav_put_float(buf, 44, approach_y);
388 _mav_put_float(buf, 48, approach_z);
389 _mav_put_uint64_t(buf, 52, time_usec);
390 _mav_put_float_array(buf, 24, q, 4);
391 _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);
392#else
393 mavlink_home_position_t *packet = (mavlink_home_position_t *)msgbuf;
394 packet->latitude = latitude;
395 packet->longitude = longitude;
396 packet->altitude = altitude;
397 packet->x = x;
398 packet->y = y;
399 packet->z = z;
400 packet->approach_x = approach_x;
401 packet->approach_y = approach_y;
402 packet->approach_z = approach_z;
403 packet->time_usec = time_usec;
404 mav_array_memcpy(packet->q, q, sizeof(float)*4);
405 _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);
406#endif
407}
408#endif
409
410#endif
411
412// MESSAGE HOME_POSITION UNPACKING
413
414
415/**
416 * @brief Get field latitude from home_position message
417 *
418 * @return [degE7] Latitude (WGS84)
419 */
420static inline int32_t mavlink_msg_home_position_get_latitude(const mavlink_message_t* msg)
421{
422 return _MAV_RETURN_int32_t(msg, 0);
423}
424
425/**
426 * @brief Get field longitude from home_position message
427 *
428 * @return [degE7] Longitude (WGS84)
429 */
430static inline int32_t mavlink_msg_home_position_get_longitude(const mavlink_message_t* msg)
431{
432 return _MAV_RETURN_int32_t(msg, 4);
433}
434
435/**
436 * @brief Get field altitude from home_position message
437 *
438 * @return [mm] Altitude (MSL). Positive for up.
439 */
440static inline int32_t mavlink_msg_home_position_get_altitude(const mavlink_message_t* msg)
441{
442 return _MAV_RETURN_int32_t(msg, 8);
443}
444
445/**
446 * @brief Get field x from home_position message
447 *
448 * @return [m] Local X position of this position in the local coordinate frame (NED)
449 */
450static inline float mavlink_msg_home_position_get_x(const mavlink_message_t* msg)
451{
452 return _MAV_RETURN_float(msg, 12);
453}
454
455/**
456 * @brief Get field y from home_position message
457 *
458 * @return [m] Local Y position of this position in the local coordinate frame (NED)
459 */
460static inline float mavlink_msg_home_position_get_y(const mavlink_message_t* msg)
461{
462 return _MAV_RETURN_float(msg, 16);
463}
464
465/**
466 * @brief Get field z from home_position message
467 *
468 * @return [m] Local Z position of this position in the local coordinate frame (NED: positive "down")
469 */
470static inline float mavlink_msg_home_position_get_z(const mavlink_message_t* msg)
471{
472 return _MAV_RETURN_float(msg, 20);
473}
474
475/**
476 * @brief Get field q from home_position message
477 *
478 * @return
479 Quaternion indicating world-to-surface-normal and heading transformation of the takeoff position.
480 Used to indicate the heading and slope of the ground.
481 All fields should be set to NaN if an accurate quaternion for both heading and surface slope cannot be supplied.
482
483 */
484static inline uint16_t mavlink_msg_home_position_get_q(const mavlink_message_t* msg, float *q)
485{
486 return _MAV_RETURN_float_array(msg, q, 4, 24);
487}
488
489/**
490 * @brief Get field approach_x from home_position message
491 *
492 * @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.
493 */
494static inline float mavlink_msg_home_position_get_approach_x(const mavlink_message_t* msg)
495{
496 return _MAV_RETURN_float(msg, 40);
497}
498
499/**
500 * @brief Get field approach_y from home_position message
501 *
502 * @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.
503 */
504static inline float mavlink_msg_home_position_get_approach_y(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_float(msg, 44);
507}
508
509/**
510 * @brief Get field approach_z from home_position message
511 *
512 * @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.
513 */
514static inline float mavlink_msg_home_position_get_approach_z(const mavlink_message_t* msg)
515{
516 return _MAV_RETURN_float(msg, 48);
517}
518
519/**
520 * @brief Get field time_usec from home_position message
521 *
522 * @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.
523 */
524static inline uint64_t mavlink_msg_home_position_get_time_usec(const mavlink_message_t* msg)
525{
526 return _MAV_RETURN_uint64_t(msg, 52);
527}
528
529/**
530 * @brief Decode a home_position message into a struct
531 *
532 * @param msg The message to decode
533 * @param home_position C-struct to decode the message contents into
534 */
535static inline void mavlink_msg_home_position_decode(const mavlink_message_t* msg, mavlink_home_position_t* home_position)
536{
537#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
538 home_position->latitude = mavlink_msg_home_position_get_latitude(msg);
539 home_position->longitude = mavlink_msg_home_position_get_longitude(msg);
540 home_position->altitude = mavlink_msg_home_position_get_altitude(msg);
541 home_position->x = mavlink_msg_home_position_get_x(msg);
542 home_position->y = mavlink_msg_home_position_get_y(msg);
543 home_position->z = mavlink_msg_home_position_get_z(msg);
544 mavlink_msg_home_position_get_q(msg, home_position->q);
545 home_position->approach_x = mavlink_msg_home_position_get_approach_x(msg);
546 home_position->approach_y = mavlink_msg_home_position_get_approach_y(msg);
547 home_position->approach_z = mavlink_msg_home_position_get_approach_z(msg);
548 home_position->time_usec = mavlink_msg_home_position_get_time_usec(msg);
549#else
550 uint8_t len = msg->len < MAVLINK_MSG_ID_HOME_POSITION_LEN? msg->len : MAVLINK_MSG_ID_HOME_POSITION_LEN;
551 memset(home_position, 0, MAVLINK_MSG_ID_HOME_POSITION_LEN);
552 memcpy(home_position, _MAV_PAYLOAD(msg), len);
553#endif
554}