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