mavlink_msg_nav_controller_output.h
Go to the documentation of this file.
1 // MESSAGE NAV_CONTROLLER_OUTPUT PACKING
2 
3 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62
4 
6 {
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*/
16 
17 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN 26
18 #define MAVLINK_MSG_ID_62_LEN 26
19 
20 #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_CRC 183
21 #define MAVLINK_MSG_ID_62_CRC 183
22 
23 
24 
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  } \
37 }
38 
39 
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)
58 {
59 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
69 
71 #else
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;
80  packet.wp_dist = wp_dist;
81 
83 #endif
84 
86 #if MAVLINK_CRC_EXTRA
88 #else
89  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
90 #endif
91 }
92 
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)
112 {
113 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
123 
125 #else
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;
134  packet.wp_dist = wp_dist;
135 
137 #endif
138 
140 #if MAVLINK_CRC_EXTRA
142 #else
143  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN);
144 #endif
145 }
146 
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)
156 {
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);
158 }
159 
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)
170 {
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);
172 }
173 
187 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
188 
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)
190 {
191 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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);
200  _mav_put_uint16_t(buf, 24, wp_dist);
201 
202 #if MAVLINK_CRC_EXTRA
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
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;
216  packet.wp_dist = wp_dist;
217 
218 #if MAVLINK_CRC_EXTRA
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
224 }
225 
226 #if MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
227 /*
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.
233  */
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)
235 {
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);
245  _mav_put_uint16_t(buf, 24, wp_dist);
246 
247 #if MAVLINK_CRC_EXTRA
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
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;
262 
263 #if MAVLINK_CRC_EXTRA
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
269 }
270 #endif
271 
272 #endif
273 
274 // MESSAGE NAV_CONTROLLER_OUTPUT UNPACKING
275 
276 
282 static inline float mavlink_msg_nav_controller_output_get_nav_roll(const mavlink_message_t* msg)
283 {
284  return _MAV_RETURN_float(msg, 0);
285 }
286 
292 static inline float mavlink_msg_nav_controller_output_get_nav_pitch(const mavlink_message_t* msg)
293 {
294  return _MAV_RETURN_float(msg, 4);
295 }
296 
302 static inline int16_t mavlink_msg_nav_controller_output_get_nav_bearing(const mavlink_message_t* msg)
303 {
304  return _MAV_RETURN_int16_t(msg, 20);
305 }
306 
312 static inline int16_t mavlink_msg_nav_controller_output_get_target_bearing(const mavlink_message_t* msg)
313 {
314  return _MAV_RETURN_int16_t(msg, 22);
315 }
316 
322 static inline uint16_t mavlink_msg_nav_controller_output_get_wp_dist(const mavlink_message_t* msg)
323 {
324  return _MAV_RETURN_uint16_t(msg, 24);
325 }
326 
332 static inline float mavlink_msg_nav_controller_output_get_alt_error(const mavlink_message_t* msg)
333 {
334  return _MAV_RETURN_float(msg, 8);
335 }
336 
342 static inline float mavlink_msg_nav_controller_output_get_aspd_error(const mavlink_message_t* msg)
343 {
344  return _MAV_RETURN_float(msg, 12);
345 }
346 
352 static inline float mavlink_msg_nav_controller_output_get_xtrack_error(const mavlink_message_t* msg)
353 {
354  return _MAV_RETURN_float(msg, 16);
355 }
356 
363 static inline void mavlink_msg_nav_controller_output_decode(const mavlink_message_t* msg, mavlink_nav_controller_output_t* nav_controller_output)
364 {
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);
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
377 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:145
#define _mav_put_int16_t(buf, wire_offset, b)
Definition: protocol.h:146


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:18