Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | // MESSAGE NAV_CONTROLLER_OUTPUT PACKING |
2 | |||
3 | #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT 62 |
||
4 | |||
5 | typedef struct __mavlink_nav_controller_output_t |
||
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 |
||
15 | } mavlink_nav_controller_output_t; |
||
16 | |||
17 | #define MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_LEN 26 |
||
18 | #define MAVLINK_MSG_ID_62_LEN 26 |
||
19 | |||
20 | |||
21 | |||
22 | #define MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT { \ |
||
23 | "NAV_CONTROLLER_OUTPUT", \ |
||
24 | 8, \ |
||
25 | { { "nav_roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_nav_controller_output_t, nav_roll) }, \ |
||
26 | { "nav_pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_nav_controller_output_t, nav_pitch) }, \ |
||
27 | { "alt_error", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_nav_controller_output_t, alt_error) }, \ |
||
28 | { "aspd_error", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_nav_controller_output_t, aspd_error) }, \ |
||
29 | { "xtrack_error", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_nav_controller_output_t, xtrack_error) }, \ |
||
30 | { "nav_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_nav_controller_output_t, nav_bearing) }, \ |
||
31 | { "target_bearing", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_nav_controller_output_t, target_bearing) }, \ |
||
32 | { "wp_dist", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_nav_controller_output_t, wp_dist) }, \ |
||
33 | } \ |
||
34 | } |
||
35 | |||
36 | |||
37 | /** |
||
38 | * @brief Pack a nav_controller_output message |
||
39 | * @param system_id ID of this system |
||
40 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
41 | * @param msg The MAVLink message to compress the data into |
||
42 | * |
||
43 | * @param nav_roll Current desired roll in degrees |
||
44 | * @param nav_pitch Current desired pitch in degrees |
||
45 | * @param nav_bearing Current desired heading in degrees |
||
46 | * @param target_bearing Bearing to current MISSION/target in degrees |
||
47 | * @param wp_dist Distance to active MISSION in meters |
||
48 | * @param alt_error Current altitude error in meters |
||
49 | * @param aspd_error Current airspeed error in meters/second |
||
50 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
||
51 | * @return length of the message in bytes (excluding serial stream start sign) |
||
52 | */ |
||
53 | static inline uint16_t mavlink_msg_nav_controller_output_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
||
54 | 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) |
||
55 | { |
||
56 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
57 | char buf[26]; |
||
58 | _mav_put_float(buf, 0, nav_roll); |
||
59 | _mav_put_float(buf, 4, nav_pitch); |
||
60 | _mav_put_float(buf, 8, alt_error); |
||
61 | _mav_put_float(buf, 12, aspd_error); |
||
62 | _mav_put_float(buf, 16, xtrack_error); |
||
63 | _mav_put_int16_t(buf, 20, nav_bearing); |
||
64 | _mav_put_int16_t(buf, 22, target_bearing); |
||
65 | _mav_put_uint16_t(buf, 24, wp_dist); |
||
66 | |||
67 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 26); |
||
68 | #else |
||
69 | mavlink_nav_controller_output_t packet; |
||
70 | packet.nav_roll = nav_roll; |
||
71 | packet.nav_pitch = nav_pitch; |
||
72 | packet.alt_error = alt_error; |
||
73 | packet.aspd_error = aspd_error; |
||
74 | packet.xtrack_error = xtrack_error; |
||
75 | packet.nav_bearing = nav_bearing; |
||
76 | packet.target_bearing = target_bearing; |
||
77 | packet.wp_dist = wp_dist; |
||
78 | |||
79 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 26); |
||
80 | #endif |
||
81 | |||
82 | msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; |
||
83 | return mavlink_finalize_message(msg, system_id, component_id, 26, 183); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @brief Pack a nav_controller_output message on a channel |
||
88 | * @param system_id ID of this system |
||
89 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
90 | * @param chan The MAVLink channel this message was sent over |
||
91 | * @param msg The MAVLink message to compress the data into |
||
92 | * @param nav_roll Current desired roll in degrees |
||
93 | * @param nav_pitch Current desired pitch in degrees |
||
94 | * @param nav_bearing Current desired heading in degrees |
||
95 | * @param target_bearing Bearing to current MISSION/target in degrees |
||
96 | * @param wp_dist Distance to active MISSION in meters |
||
97 | * @param alt_error Current altitude error in meters |
||
98 | * @param aspd_error Current airspeed error in meters/second |
||
99 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
||
100 | * @return length of the message in bytes (excluding serial stream start sign) |
||
101 | */ |
||
102 | static inline uint16_t mavlink_msg_nav_controller_output_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
||
103 | mavlink_message_t* msg, |
||
104 | 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) |
||
105 | { |
||
106 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
107 | char buf[26]; |
||
108 | _mav_put_float(buf, 0, nav_roll); |
||
109 | _mav_put_float(buf, 4, nav_pitch); |
||
110 | _mav_put_float(buf, 8, alt_error); |
||
111 | _mav_put_float(buf, 12, aspd_error); |
||
112 | _mav_put_float(buf, 16, xtrack_error); |
||
113 | _mav_put_int16_t(buf, 20, nav_bearing); |
||
114 | _mav_put_int16_t(buf, 22, target_bearing); |
||
115 | _mav_put_uint16_t(buf, 24, wp_dist); |
||
116 | |||
117 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 26); |
||
118 | #else |
||
119 | mavlink_nav_controller_output_t packet; |
||
120 | packet.nav_roll = nav_roll; |
||
121 | packet.nav_pitch = nav_pitch; |
||
122 | packet.alt_error = alt_error; |
||
123 | packet.aspd_error = aspd_error; |
||
124 | packet.xtrack_error = xtrack_error; |
||
125 | packet.nav_bearing = nav_bearing; |
||
126 | packet.target_bearing = target_bearing; |
||
127 | packet.wp_dist = wp_dist; |
||
128 | |||
129 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 26); |
||
130 | #endif |
||
131 | |||
132 | msg->msgid = MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT; |
||
133 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 26, 183); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * @brief Encode a nav_controller_output struct into a message |
||
138 | * |
||
139 | * @param system_id ID of this system |
||
140 | * @param component_id ID of this component (e.g. 200 for IMU) |
||
141 | * @param msg The MAVLink message to compress the data into |
||
142 | * @param nav_controller_output C-struct to read the message contents from |
||
143 | */ |
||
144 | 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) |
||
145 | { |
||
146 | 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); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * @brief Send a nav_controller_output message |
||
151 | * @param chan MAVLink channel to send the message |
||
152 | * |
||
153 | * @param nav_roll Current desired roll in degrees |
||
154 | * @param nav_pitch Current desired pitch in degrees |
||
155 | * @param nav_bearing Current desired heading in degrees |
||
156 | * @param target_bearing Bearing to current MISSION/target in degrees |
||
157 | * @param wp_dist Distance to active MISSION in meters |
||
158 | * @param alt_error Current altitude error in meters |
||
159 | * @param aspd_error Current airspeed error in meters/second |
||
160 | * @param xtrack_error Current crosstrack error on x-y plane in meters |
||
161 | */ |
||
162 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
||
163 | |||
164 | 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) |
||
165 | { |
||
166 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
||
167 | char buf[26]; |
||
168 | _mav_put_float(buf, 0, nav_roll); |
||
169 | _mav_put_float(buf, 4, nav_pitch); |
||
170 | _mav_put_float(buf, 8, alt_error); |
||
171 | _mav_put_float(buf, 12, aspd_error); |
||
172 | _mav_put_float(buf, 16, xtrack_error); |
||
173 | _mav_put_int16_t(buf, 20, nav_bearing); |
||
174 | _mav_put_int16_t(buf, 22, target_bearing); |
||
175 | _mav_put_uint16_t(buf, 24, wp_dist); |
||
176 | |||
177 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, buf, 26, 183); |
||
178 | #else |
||
179 | mavlink_nav_controller_output_t packet; |
||
180 | packet.nav_roll = nav_roll; |
||
181 | packet.nav_pitch = nav_pitch; |
||
182 | packet.alt_error = alt_error; |
||
183 | packet.aspd_error = aspd_error; |
||
184 | packet.xtrack_error = xtrack_error; |
||
185 | packet.nav_bearing = nav_bearing; |
||
186 | packet.target_bearing = target_bearing; |
||
187 | packet.wp_dist = wp_dist; |
||
188 | |||
189 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT, (const char *)&packet, 26, 183); |
||
190 | #endif |
||
191 | } |
||
192 | |||
193 | #endif |
||
194 | |||
195 | // MESSAGE NAV_CONTROLLER_OUTPUT UNPACKING |
||
196 | |||
197 | |||
198 | /** |
||
199 | * @brief Get field nav_roll from nav_controller_output message |
||
200 | * |
||
201 | * @return Current desired roll in degrees |
||
202 | */ |
||
203 | static inline float mavlink_msg_nav_controller_output_get_nav_roll(const mavlink_message_t* msg) |
||
204 | { |
||
205 | return _MAV_RETURN_float(msg, 0); |
||
206 | } |
||
207 | |||
208 | /** |
||
209 | * @brief Get field nav_pitch from nav_controller_output message |
||
210 | * |
||
211 | * @return Current desired pitch in degrees |
||
212 | */ |
||
213 | static inline float mavlink_msg_nav_controller_output_get_nav_pitch(const mavlink_message_t* msg) |
||
214 | { |
||
215 | return _MAV_RETURN_float(msg, 4); |
||
216 | } |
||
217 | |||
218 | /** |
||
219 | * @brief Get field nav_bearing from nav_controller_output message |
||
220 | * |
||
221 | * @return Current desired heading in degrees |
||
222 | */ |
||
223 | static inline int16_t mavlink_msg_nav_controller_output_get_nav_bearing(const mavlink_message_t* msg) |
||
224 | { |
||
225 | return _MAV_RETURN_int16_t(msg, 20); |
||
226 | } |
||
227 | |||
228 | /** |
||
229 | * @brief Get field target_bearing from nav_controller_output message |
||
230 | * |
||
231 | * @return Bearing to current MISSION/target in degrees |
||
232 | */ |
||
233 | static inline int16_t mavlink_msg_nav_controller_output_get_target_bearing(const mavlink_message_t* msg) |
||
234 | { |
||
235 | return _MAV_RETURN_int16_t(msg, 22); |
||
236 | } |
||
237 | |||
238 | /** |
||
239 | * @brief Get field wp_dist from nav_controller_output message |
||
240 | * |
||
241 | * @return Distance to active MISSION in meters |
||
242 | */ |
||
243 | static inline uint16_t mavlink_msg_nav_controller_output_get_wp_dist(const mavlink_message_t* msg) |
||
244 | { |
||
245 | return _MAV_RETURN_uint16_t(msg, 24); |
||
246 | } |
||
247 | |||
248 | /** |
||
249 | * @brief Get field alt_error from nav_controller_output message |
||
250 | * |
||
251 | * @return Current altitude error in meters |
||
252 | */ |
||
253 | static inline float mavlink_msg_nav_controller_output_get_alt_error(const mavlink_message_t* msg) |
||
254 | { |
||
255 | return _MAV_RETURN_float(msg, 8); |
||
256 | } |
||
257 | |||
258 | /** |
||
259 | * @brief Get field aspd_error from nav_controller_output message |
||
260 | * |
||
261 | * @return Current airspeed error in meters/second |
||
262 | */ |
||
263 | static inline float mavlink_msg_nav_controller_output_get_aspd_error(const mavlink_message_t* msg) |
||
264 | { |
||
265 | return _MAV_RETURN_float(msg, 12); |
||
266 | } |
||
267 | |||
268 | /** |
||
269 | * @brief Get field xtrack_error from nav_controller_output message |
||
270 | * |
||
271 | * @return Current crosstrack error on x-y plane in meters |
||
272 | */ |
||
273 | static inline float mavlink_msg_nav_controller_output_get_xtrack_error(const mavlink_message_t* msg) |
||
274 | { |
||
275 | return _MAV_RETURN_float(msg, 16); |
||
276 | } |
||
277 | |||
278 | /** |
||
279 | * @brief Decode a nav_controller_output message into a struct |
||
280 | * |
||
281 | * @param msg The message to decode |
||
282 | * @param nav_controller_output C-struct to decode the message contents into |
||
283 | */ |
||
284 | static inline void mavlink_msg_nav_controller_output_decode(const mavlink_message_t* msg, mavlink_nav_controller_output_t* nav_controller_output) |
||
285 | { |
||
286 | #if MAVLINK_NEED_BYTE_SWAP |
||
287 | nav_controller_output->nav_roll = mavlink_msg_nav_controller_output_get_nav_roll(msg); |
||
288 | nav_controller_output->nav_pitch = mavlink_msg_nav_controller_output_get_nav_pitch(msg); |
||
289 | nav_controller_output->alt_error = mavlink_msg_nav_controller_output_get_alt_error(msg); |
||
290 | nav_controller_output->aspd_error = mavlink_msg_nav_controller_output_get_aspd_error(msg); |
||
291 | nav_controller_output->xtrack_error = mavlink_msg_nav_controller_output_get_xtrack_error(msg); |
||
292 | nav_controller_output->nav_bearing = mavlink_msg_nav_controller_output_get_nav_bearing(msg); |
||
293 | nav_controller_output->target_bearing = mavlink_msg_nav_controller_output_get_target_bearing(msg); |
||
294 | nav_controller_output->wp_dist = mavlink_msg_nav_controller_output_get_wp_dist(msg); |
||
295 | #else |
||
296 | memcpy(nav_controller_output, _MAV_PAYLOAD(msg), 26); |
||
297 | #endif |
||
298 | } |