Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_set_home_position.h
blobea7d2d0f266fedd55c603ea27ba9cb230553d83a
1 #pragma once
2 // MESSAGE SET_HOME_POSITION PACKING
4 #define MAVLINK_MSG_ID_SET_HOME_POSITION 243
6 MAVPACKED(
7 typedef 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*/
12 float y; /*< [m] Local Y position of this position in the local coordinate frame*/
13 float z; /*< [m] Local Z position of this position in the local coordinate frame*/
14 float q[4]; /*< World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground*/
15 float approach_x; /*< [m] Local X position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
16 float approach_y; /*< [m] Local Y position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
17 float approach_z; /*< [m] Local Z position of the end of the approach vector. Multicopters should set this position based on their takeoff path. Grass-landing fixed wing aircraft should set it the same way as multicopters. Runway-landing fixed wing aircraft should set it to the opposite direction of the takeoff, assuming the takeoff happened from the threshold / touchdown zone.*/
18 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;
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
27 #define MAVLINK_MSG_ID_SET_HOME_POSITION_CRC 85
28 #define MAVLINK_MSG_ID_243_CRC 85
30 #define MAVLINK_MSG_SET_HOME_POSITION_FIELD_Q_LEN 4
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 } \
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 } \
69 #endif
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
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
82 * @param y [m] Local Y position of this position in the local coordinate frame
83 * @param z [m] Local Z position of this position in the local coordinate frame
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)
91 static 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)
94 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
95 char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
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
126 msg->msgid = MAVLINK_MSG_ID_SET_HOME_POSITION;
127 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN, MAVLINK_MSG_ID_SET_HOME_POSITION_CRC);
131 * @brief Pack a set_home_position message on a channel
132 * @param system_id ID of this system
133 * @param component_id ID of this component (e.g. 200 for IMU)
134 * @param chan The MAVLink channel this message will be sent over
135 * @param msg The MAVLink message to compress the data into
136 * @param target_system System ID.
137 * @param latitude [degE7] Latitude (WGS84)
138 * @param longitude [degE7] Longitude (WGS84)
139 * @param altitude [mm] Altitude (MSL). Positive for up.
140 * @param x [m] Local X position of this position in the local coordinate frame
141 * @param y [m] Local Y position of this position in the local coordinate frame
142 * @param z [m] Local Z position of this position in the local coordinate frame
143 * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
144 * @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.
145 * @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.
146 * @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.
147 * @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.
148 * @return length of the message in bytes (excluding serial stream start sign)
150 static inline uint16_t mavlink_msg_set_home_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
151 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)
154 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
155 char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
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
186 msg->msgid = MAVLINK_MSG_ID_SET_HOME_POSITION;
187 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);
191 * @brief Encode a set_home_position struct
193 * @param system_id ID of this system
194 * @param component_id ID of this component (e.g. 200 for IMU)
195 * @param msg The MAVLink message to compress the data into
196 * @param set_home_position C-struct to read the message contents from
198 static inline uint16_t mavlink_msg_set_home_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
200 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);
204 * @brief Encode a set_home_position struct on a channel
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param chan The MAVLink channel this message will be sent over
209 * @param msg The MAVLink message to compress the data into
210 * @param set_home_position C-struct to read the message contents from
212 static inline uint16_t mavlink_msg_set_home_position_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_home_position_t* set_home_position)
214 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);
218 * @brief Send a set_home_position message
219 * @param chan MAVLink channel to send the message
221 * @param target_system System ID.
222 * @param latitude [degE7] Latitude (WGS84)
223 * @param longitude [degE7] Longitude (WGS84)
224 * @param altitude [mm] Altitude (MSL). Positive for up.
225 * @param x [m] Local X position of this position in the local coordinate frame
226 * @param y [m] Local Y position of this position in the local coordinate frame
227 * @param z [m] Local Z position of this position in the local coordinate frame
228 * @param q World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
229 * @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.
230 * @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.
231 * @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.
232 * @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.
234 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
236 static inline void mavlink_msg_set_home_position_send(mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z, uint64_t time_usec)
238 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
239 char buf[MAVLINK_MSG_ID_SET_HOME_POSITION_LEN];
240 _mav_put_int32_t(buf, 0, latitude);
241 _mav_put_int32_t(buf, 4, longitude);
242 _mav_put_int32_t(buf, 8, altitude);
243 _mav_put_float(buf, 12, x);
244 _mav_put_float(buf, 16, y);
245 _mav_put_float(buf, 20, z);
246 _mav_put_float(buf, 40, approach_x);
247 _mav_put_float(buf, 44, approach_y);
248 _mav_put_float(buf, 48, approach_z);
249 _mav_put_uint8_t(buf, 52, target_system);
250 _mav_put_uint64_t(buf, 53, time_usec);
251 _mav_put_float_array(buf, 24, q, 4);
252 _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);
253 #else
254 mavlink_set_home_position_t packet;
255 packet.latitude = latitude;
256 packet.longitude = longitude;
257 packet.altitude = altitude;
258 packet.x = x;
259 packet.y = y;
260 packet.z = z;
261 packet.approach_x = approach_x;
262 packet.approach_y = approach_y;
263 packet.approach_z = approach_z;
264 packet.target_system = target_system;
265 packet.time_usec = time_usec;
266 mav_array_memcpy(packet.q, q, sizeof(float)*4);
267 _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);
268 #endif
272 * @brief Send a set_home_position message
273 * @param chan MAVLink channel to send the message
274 * @param struct The MAVLink struct to serialize
276 static inline void mavlink_msg_set_home_position_send_struct(mavlink_channel_t chan, const mavlink_set_home_position_t* set_home_position)
278 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
279 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);
280 #else
281 _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);
282 #endif
285 #if MAVLINK_MSG_ID_SET_HOME_POSITION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
287 This varient of _send() can be used to save stack space by re-using
288 memory from the receive buffer. The caller provides a
289 mavlink_message_t which is the size of a full mavlink message. This
290 is usually the receive buffer for the channel, and allows a reply to an
291 incoming message with minimum stack space usage.
293 static inline void mavlink_msg_set_home_position_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, int32_t latitude, int32_t longitude, int32_t altitude, float x, float y, float z, const float *q, float approach_x, float approach_y, float approach_z, uint64_t time_usec)
295 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
296 char *buf = (char *)msgbuf;
297 _mav_put_int32_t(buf, 0, latitude);
298 _mav_put_int32_t(buf, 4, longitude);
299 _mav_put_int32_t(buf, 8, altitude);
300 _mav_put_float(buf, 12, x);
301 _mav_put_float(buf, 16, y);
302 _mav_put_float(buf, 20, z);
303 _mav_put_float(buf, 40, approach_x);
304 _mav_put_float(buf, 44, approach_y);
305 _mav_put_float(buf, 48, approach_z);
306 _mav_put_uint8_t(buf, 52, target_system);
307 _mav_put_uint64_t(buf, 53, time_usec);
308 _mav_put_float_array(buf, 24, q, 4);
309 _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);
310 #else
311 mavlink_set_home_position_t *packet = (mavlink_set_home_position_t *)msgbuf;
312 packet->latitude = latitude;
313 packet->longitude = longitude;
314 packet->altitude = altitude;
315 packet->x = x;
316 packet->y = y;
317 packet->z = z;
318 packet->approach_x = approach_x;
319 packet->approach_y = approach_y;
320 packet->approach_z = approach_z;
321 packet->target_system = target_system;
322 packet->time_usec = time_usec;
323 mav_array_memcpy(packet->q, q, sizeof(float)*4);
324 _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);
325 #endif
327 #endif
329 #endif
331 // MESSAGE SET_HOME_POSITION UNPACKING
335 * @brief Get field target_system from set_home_position message
337 * @return System ID.
339 static inline uint8_t mavlink_msg_set_home_position_get_target_system(const mavlink_message_t* msg)
341 return _MAV_RETURN_uint8_t(msg, 52);
345 * @brief Get field latitude from set_home_position message
347 * @return [degE7] Latitude (WGS84)
349 static inline int32_t mavlink_msg_set_home_position_get_latitude(const mavlink_message_t* msg)
351 return _MAV_RETURN_int32_t(msg, 0);
355 * @brief Get field longitude from set_home_position message
357 * @return [degE7] Longitude (WGS84)
359 static inline int32_t mavlink_msg_set_home_position_get_longitude(const mavlink_message_t* msg)
361 return _MAV_RETURN_int32_t(msg, 4);
365 * @brief Get field altitude from set_home_position message
367 * @return [mm] Altitude (MSL). Positive for up.
369 static inline int32_t mavlink_msg_set_home_position_get_altitude(const mavlink_message_t* msg)
371 return _MAV_RETURN_int32_t(msg, 8);
375 * @brief Get field x from set_home_position message
377 * @return [m] Local X position of this position in the local coordinate frame
379 static inline float mavlink_msg_set_home_position_get_x(const mavlink_message_t* msg)
381 return _MAV_RETURN_float(msg, 12);
385 * @brief Get field y from set_home_position message
387 * @return [m] Local Y position of this position in the local coordinate frame
389 static inline float mavlink_msg_set_home_position_get_y(const mavlink_message_t* msg)
391 return _MAV_RETURN_float(msg, 16);
395 * @brief Get field z from set_home_position message
397 * @return [m] Local Z position of this position in the local coordinate frame
399 static inline float mavlink_msg_set_home_position_get_z(const mavlink_message_t* msg)
401 return _MAV_RETURN_float(msg, 20);
405 * @brief Get field q from set_home_position message
407 * @return World to surface normal and heading transformation of the takeoff position. Used to indicate the heading and slope of the ground
409 static inline uint16_t mavlink_msg_set_home_position_get_q(const mavlink_message_t* msg, float *q)
411 return _MAV_RETURN_float_array(msg, q, 4, 24);
415 * @brief Get field approach_x from set_home_position message
417 * @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.
419 static inline float mavlink_msg_set_home_position_get_approach_x(const mavlink_message_t* msg)
421 return _MAV_RETURN_float(msg, 40);
425 * @brief Get field approach_y from set_home_position message
427 * @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.
429 static inline float mavlink_msg_set_home_position_get_approach_y(const mavlink_message_t* msg)
431 return _MAV_RETURN_float(msg, 44);
435 * @brief Get field approach_z from set_home_position message
437 * @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.
439 static inline float mavlink_msg_set_home_position_get_approach_z(const mavlink_message_t* msg)
441 return _MAV_RETURN_float(msg, 48);
445 * @brief Get field time_usec from set_home_position message
447 * @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.
449 static inline uint64_t mavlink_msg_set_home_position_get_time_usec(const mavlink_message_t* msg)
451 return _MAV_RETURN_uint64_t(msg, 53);
455 * @brief Decode a set_home_position message into a struct
457 * @param msg The message to decode
458 * @param set_home_position C-struct to decode the message contents into
460 static inline void mavlink_msg_set_home_position_decode(const mavlink_message_t* msg, mavlink_set_home_position_t* set_home_position)
462 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
463 set_home_position->latitude = mavlink_msg_set_home_position_get_latitude(msg);
464 set_home_position->longitude = mavlink_msg_set_home_position_get_longitude(msg);
465 set_home_position->altitude = mavlink_msg_set_home_position_get_altitude(msg);
466 set_home_position->x = mavlink_msg_set_home_position_get_x(msg);
467 set_home_position->y = mavlink_msg_set_home_position_get_y(msg);
468 set_home_position->z = mavlink_msg_set_home_position_get_z(msg);
469 mavlink_msg_set_home_position_get_q(msg, set_home_position->q);
470 set_home_position->approach_x = mavlink_msg_set_home_position_get_approach_x(msg);
471 set_home_position->approach_y = mavlink_msg_set_home_position_get_approach_y(msg);
472 set_home_position->approach_z = mavlink_msg_set_home_position_get_approach_z(msg);
473 set_home_position->target_system = mavlink_msg_set_home_position_get_target_system(msg);
474 set_home_position->time_usec = mavlink_msg_set_home_position_get_time_usec(msg);
475 #else
476 uint8_t len = msg->len < MAVLINK_MSG_ID_SET_HOME_POSITION_LEN? msg->len : MAVLINK_MSG_ID_SET_HOME_POSITION_LEN;
477 memset(set_home_position, 0, MAVLINK_MSG_ID_SET_HOME_POSITION_LEN);
478 memcpy(set_home_position, _MAV_PAYLOAD(msg), len);
479 #endif