Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_nav_controller_output.h
blobb9a748b22238666fe88bdde95bb57a38820ebbfc
1 // MESSAGE NAV_CONTROLLER_OUTPUT PACKING
3 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62
5 typedef struct __mavlink_nav_controller_output_t
7 float nav_roll; ///< Current desired roll in degrees
8 float nav_pitch; ///< Current desired pitch in degrees
9 float alt_error; ///< Current altitude error in meters
10 float aspd_error; ///< Current airspeed error in meters/second
11 float xtrack_error; ///< Current crosstrack error on x-y plane in meters
12 int16_t nav_bearing; ///< Current desired heading in degrees
13 int16_t target_bearing; ///< Bearing to current MISSION/target in degrees
14 uint16_t wp_dist; ///< Distance to active MISSION in meters
15 } mavlink_nav_controller_output_t;
17 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN 26
18 #define MAVLINK_MSG_ID_62_LEN 26
20 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC 183
21 #define MAVLINK_MSG_ID_62_CRC 183
25 #define MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT { \
26 "NAV_CONTROLLER_OUTPUT", \
27 8, \
28 { { "nav_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_nav_controller_output_t, nav_roll) }, \
29 { "nav_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_nav_controller_output_t, nav_pitch) }, \
30 { "alt_error", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_nav_controller_output_t, alt_error) }, \
31 { "aspd_error", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_nav_controller_output_t, aspd_error) }, \
32 { "xtrack_error", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_nav_controller_output_t, xtrack_error) }, \
33 { "nav_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_nav_controller_output_t, nav_bearing) }, \
34 { "target_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_nav_controller_output_t, target_bearing) }, \
35 { "wp_dist", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_nav_controller_output_t, wp_dist) }, \
36 } \
40 /**
41 * @brief Pack a nav_controller_output message
42 * @param system_id ID of this system
43 * @param component_id ID of this component (e.g. 200 for IMU)
44 * @param msg The MAVLink message to compress the data into
46 * @param nav_roll Current desired roll in degrees
47 * @param nav_pitch Current desired pitch in degrees
48 * @param nav_bearing Current desired heading in degrees
49 * @param target_bearing Bearing to current MISSION/target in degrees
50 * @param wp_dist Distance to active MISSION in meters
51 * @param alt_error Current altitude error in meters
52 * @param aspd_error Current airspeed error in meters/second
53 * @param xtrack_error Current crosstrack error on x-y plane in meters
54 * @return length of the message in bytes (excluding serial stream start sign)
56 static inline uint16_t mavlink_msg_nav_controller_output_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
57 float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error)
59 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
60 char buf[MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN];
61 _mav_put_float(buf, 0, nav_roll);
62 _mav_put_float(buf, 4, nav_pitch);
63 _mav_put_float(buf, 8, alt_error);
64 _mav_put_float(buf, 12, aspd_error);
65 _mav_put_float(buf, 16, xtrack_error);
66 _mav_put_int16_t(buf, 20, nav_bearing);
67 _mav_put_int16_t(buf, 22, target_bearing);
68 _mav_put_uint16_t(buf, 24, wp_dist);
70 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
71 #else
72 mavlink_nav_controller_output_t packet;
73 packet.nav_roll = nav_roll;
74 packet.nav_pitch = nav_pitch;
75 packet.alt_error = alt_error;
76 packet.aspd_error = aspd_error;
77 packet.xtrack_error = xtrack_error;
78 packet.nav_bearing = nav_bearing;
79 packet.target_bearing = target_bearing;
80 packet.wp_dist = wp_dist;
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
83 #endif
85 msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
86 #if MAVLINK_CRC_EXTRA
87 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
88 #else
89 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
90 #endif
93 /**
94 * @brief Pack a nav_controller_output message on a channel
95 * @param system_id ID of this system
96 * @param component_id ID of this component (e.g. 200 for IMU)
97 * @param chan The MAVLink channel this message will be sent over
98 * @param msg The MAVLink message to compress the data into
99 * @param nav_roll Current desired roll in degrees
100 * @param nav_pitch Current desired pitch in degrees
101 * @param nav_bearing Current desired heading in degrees
102 * @param target_bearing Bearing to current MISSION/target in degrees
103 * @param wp_dist Distance to active MISSION in meters
104 * @param alt_error Current altitude error in meters
105 * @param aspd_error Current airspeed error in meters/second
106 * @param xtrack_error Current crosstrack error on x-y plane in meters
107 * @return length of the message in bytes (excluding serial stream start sign)
109 static inline uint16_t mavlink_msg_nav_controller_output_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
110 mavlink_message_t* msg,
111 float nav_roll,float nav_pitch,int16_t nav_bearing,int16_t target_bearing,uint16_t wp_dist,float alt_error,float aspd_error,float xtrack_error)
113 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
114 char buf[MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN];
115 _mav_put_float(buf, 0, nav_roll);
116 _mav_put_float(buf, 4, nav_pitch);
117 _mav_put_float(buf, 8, alt_error);
118 _mav_put_float(buf, 12, aspd_error);
119 _mav_put_float(buf, 16, xtrack_error);
120 _mav_put_int16_t(buf, 20, nav_bearing);
121 _mav_put_int16_t(buf, 22, target_bearing);
122 _mav_put_uint16_t(buf, 24, wp_dist);
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
125 #else
126 mavlink_nav_controller_output_t packet;
127 packet.nav_roll = nav_roll;
128 packet.nav_pitch = nav_pitch;
129 packet.alt_error = alt_error;
130 packet.aspd_error = aspd_error;
131 packet.xtrack_error = xtrack_error;
132 packet.nav_bearing = nav_bearing;
133 packet.target_bearing = target_bearing;
134 packet.wp_dist = wp_dist;
136 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
137 #endif
139 msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT;
140 #if MAVLINK_CRC_EXTRA
141 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
142 #else
143 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
144 #endif
148 * @brief Encode a nav_controller_output struct
150 * @param system_id ID of this system
151 * @param component_id ID of this component (e.g. 200 for IMU)
152 * @param msg The MAVLink message to compress the data into
153 * @param nav_controller_output C-struct to read the message contents from
155 static inline uint16_t mavlink_msg_nav_controller_output_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_nav_controller_output_t* nav_controller_output)
157 return mavlink_msg_nav_controller_output_pack(system_id, component_id, msg, nav_controller_output->nav_roll, nav_controller_output->nav_pitch, nav_controller_output->nav_bearing, nav_controller_output->target_bearing, nav_controller_output->wp_dist, nav_controller_output->alt_error, nav_controller_output->aspd_error, nav_controller_output->xtrack_error);
161 * @brief Encode a nav_controller_output struct on a channel
163 * @param system_id ID of this system
164 * @param component_id ID of this component (e.g. 200 for IMU)
165 * @param chan The MAVLink channel this message will be sent over
166 * @param msg The MAVLink message to compress the data into
167 * @param nav_controller_output C-struct to read the message contents from
169 static inline uint16_t mavlink_msg_nav_controller_output_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_nav_controller_output_t* nav_controller_output)
171 return mavlink_msg_nav_controller_output_pack_chan(system_id, component_id, chan, msg, nav_controller_output->nav_roll, nav_controller_output->nav_pitch, nav_controller_output->nav_bearing, nav_controller_output->target_bearing, nav_controller_output->wp_dist, nav_controller_output->alt_error, nav_controller_output->aspd_error, nav_controller_output->xtrack_error);
175 * @brief Send a nav_controller_output message
176 * @param chan MAVLink channel to send the message
178 * @param nav_roll Current desired roll in degrees
179 * @param nav_pitch Current desired pitch in degrees
180 * @param nav_bearing Current desired heading in degrees
181 * @param target_bearing Bearing to current MISSION/target in degrees
182 * @param wp_dist Distance to active MISSION in meters
183 * @param alt_error Current altitude error in meters
184 * @param aspd_error Current airspeed error in meters/second
185 * @param xtrack_error Current crosstrack error on x-y plane in meters
187 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189 static inline void mavlink_msg_nav_controller_output_send(mavlink_channel_t chan, float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error)
191 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
192 char buf[MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN];
193 _mav_put_float(buf, 0, nav_roll);
194 _mav_put_float(buf, 4, nav_pitch);
195 _mav_put_float(buf, 8, alt_error);
196 _mav_put_float(buf, 12, aspd_error);
197 _mav_put_float(buf, 16, xtrack_error);
198 _mav_put_int16_t(buf, 20, nav_bearing);
199 _mav_put_int16_t(buf, 22, target_bearing);
200 _mav_put_uint16_t(buf, 24, wp_dist);
202 #if MAVLINK_CRC_EXTRA
203 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
204 #else
205 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
206 #endif
207 #else
208 mavlink_nav_controller_output_t packet;
209 packet.nav_roll = nav_roll;
210 packet.nav_pitch = nav_pitch;
211 packet.alt_error = alt_error;
212 packet.aspd_error = aspd_error;
213 packet.xtrack_error = xtrack_error;
214 packet.nav_bearing = nav_bearing;
215 packet.target_bearing = target_bearing;
216 packet.wp_dist = wp_dist;
218 #if MAVLINK_CRC_EXTRA
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)&packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
220 #else
221 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)&packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
222 #endif
223 #endif
226 #if MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
228 This varient of _send() can be used to save stack space by re-using
229 memory from the receive buffer. The caller provides a
230 mavlink_message_t which is the size of a full mavlink message. This
231 is usually the receive buffer for the channel, and allows a reply to an
232 incoming message with minimum stack space usage.
234 static inline void mavlink_msg_nav_controller_output_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float nav_roll, float nav_pitch, int16_t nav_bearing, int16_t target_bearing, uint16_t wp_dist, float alt_error, float aspd_error, float xtrack_error)
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 char *buf = (char *)msgbuf;
238 _mav_put_float(buf, 0, nav_roll);
239 _mav_put_float(buf, 4, nav_pitch);
240 _mav_put_float(buf, 8, alt_error);
241 _mav_put_float(buf, 12, aspd_error);
242 _mav_put_float(buf, 16, xtrack_error);
243 _mav_put_int16_t(buf, 20, nav_bearing);
244 _mav_put_int16_t(buf, 22, target_bearing);
245 _mav_put_uint16_t(buf, 24, wp_dist);
247 #if MAVLINK_CRC_EXTRA
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
249 #else
250 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
251 #endif
252 #else
253 mavlink_nav_controller_output_t *packet = (mavlink_nav_controller_output_t *)msgbuf;
254 packet->nav_roll = nav_roll;
255 packet->nav_pitch = nav_pitch;
256 packet->alt_error = alt_error;
257 packet->aspd_error = aspd_error;
258 packet->xtrack_error = xtrack_error;
259 packet->nav_bearing = nav_bearing;
260 packet->target_bearing = target_bearing;
261 packet->wp_dist = wp_dist;
263 #if MAVLINK_CRC_EXTRA
264 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC);
265 #else
266 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)packet, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
267 #endif
268 #endif
270 #endif
272 #endif
274 // MESSAGE NAV_CONTROLLER_OUTPUT UNPACKING
278 * @brief Get field nav_roll from nav_controller_output message
280 * @return Current desired roll in degrees
282 static inline float mavlink_msg_nav_controller_output_get_nav_roll(const mavlink_message_t* msg)
284 return _MAV_RETURN_float(msg, 0);
288 * @brief Get field nav_pitch from nav_controller_output message
290 * @return Current desired pitch in degrees
292 static inline float mavlink_msg_nav_controller_output_get_nav_pitch(const mavlink_message_t* msg)
294 return _MAV_RETURN_float(msg, 4);
298 * @brief Get field nav_bearing from nav_controller_output message
300 * @return Current desired heading in degrees
302 static inline int16_t mavlink_msg_nav_controller_output_get_nav_bearing(const mavlink_message_t* msg)
304 return _MAV_RETURN_int16_t(msg, 20);
308 * @brief Get field target_bearing from nav_controller_output message
310 * @return Bearing to current MISSION/target in degrees
312 static inline int16_t mavlink_msg_nav_controller_output_get_target_bearing(const mavlink_message_t* msg)
314 return _MAV_RETURN_int16_t(msg, 22);
318 * @brief Get field wp_dist from nav_controller_output message
320 * @return Distance to active MISSION in meters
322 static inline uint16_t mavlink_msg_nav_controller_output_get_wp_dist(const mavlink_message_t* msg)
324 return _MAV_RETURN_uint16_t(msg, 24);
328 * @brief Get field alt_error from nav_controller_output message
330 * @return Current altitude error in meters
332 static inline float mavlink_msg_nav_controller_output_get_alt_error(const mavlink_message_t* msg)
334 return _MAV_RETURN_float(msg, 8);
338 * @brief Get field aspd_error from nav_controller_output message
340 * @return Current airspeed error in meters/second
342 static inline float mavlink_msg_nav_controller_output_get_aspd_error(const mavlink_message_t* msg)
344 return _MAV_RETURN_float(msg, 12);
348 * @brief Get field xtrack_error from nav_controller_output message
350 * @return Current crosstrack error on x-y plane in meters
352 static inline float mavlink_msg_nav_controller_output_get_xtrack_error(const mavlink_message_t* msg)
354 return _MAV_RETURN_float(msg, 16);
358 * @brief Decode a nav_controller_output message into a struct
360 * @param msg The message to decode
361 * @param nav_controller_output C-struct to decode the message contents into
363 static inline void mavlink_msg_nav_controller_output_decode(const mavlink_message_t* msg, mavlink_nav_controller_output_t* nav_controller_output)
365 #if MAVLINK_NEED_BYTE_SWAP
366 nav_controller_output->nav_roll = mavlink_msg_nav_controller_output_get_nav_roll(msg);
367 nav_controller_output->nav_pitch = mavlink_msg_nav_controller_output_get_nav_pitch(msg);
368 nav_controller_output->alt_error = mavlink_msg_nav_controller_output_get_alt_error(msg);
369 nav_controller_output->aspd_error = mavlink_msg_nav_controller_output_get_aspd_error(msg);
370 nav_controller_output->xtrack_error = mavlink_msg_nav_controller_output_get_xtrack_error(msg);
371 nav_controller_output->nav_bearing = mavlink_msg_nav_controller_output_get_nav_bearing(msg);
372 nav_controller_output->target_bearing = mavlink_msg_nav_controller_output_get_target_bearing(msg);
373 nav_controller_output->wp_dist = mavlink_msg_nav_controller_output_get_wp_dist(msg);
374 #else
375 memcpy(nav_controller_output, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
376 #endif