NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_slugs_navigation.h
Go to the documentation of this file.
1 // MESSAGE SLUGS_NAVIGATION PACKING
2 
3 #define MAVLINK_MSG_ID_SLUGS_NAVIGATION 176
4 
6 {
7  float u_m;
8  float phi_c;
9  float theta_c;
10  float psiDot_c;
11  float ay_body;
12  float totalDist;
13  float dist2Go;
14  uint16_t h_c;
15  uint8_t fromWP;
16  uint8_t toWP;
18 
19 #define MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN 32
20 #define MAVLINK_MSG_ID_176_LEN 32
21 
22 #define MAVLINK_MSG_ID_SLUGS_NAVIGATION_CRC 228
23 #define MAVLINK_MSG_ID_176_CRC 228
24 
25 
26 
27 #define MAVLINK_MESSAGE_INFO_SLUGS_NAVIGATION { \
28  "SLUGS_NAVIGATION", \
29  10, \
30  { { "u_m", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_slugs_navigation_t, u_m) }, \
31  { "phi_c", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_slugs_navigation_t, phi_c) }, \
32  { "theta_c", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_slugs_navigation_t, theta_c) }, \
33  { "psiDot_c", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_slugs_navigation_t, psiDot_c) }, \
34  { "ay_body", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_slugs_navigation_t, ay_body) }, \
35  { "totalDist", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_slugs_navigation_t, totalDist) }, \
36  { "dist2Go", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_slugs_navigation_t, dist2Go) }, \
37  { "h_c", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_slugs_navigation_t, h_c) }, \
38  { "fromWP", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_slugs_navigation_t, fromWP) }, \
39  { "toWP", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_slugs_navigation_t, toWP) }, \
40  } \
41 }
42 
43 
62 static inline uint16_t mavlink_msg_slugs_navigation_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63  float u_m, float phi_c, float theta_c, float psiDot_c, float ay_body, float totalDist, float dist2Go, uint8_t fromWP, uint8_t toWP, uint16_t h_c)
64 {
65 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
67  _mav_put_float(buf, 0, u_m);
68  _mav_put_float(buf, 4, phi_c);
69  _mav_put_float(buf, 8, theta_c);
70  _mav_put_float(buf, 12, psiDot_c);
71  _mav_put_float(buf, 16, ay_body);
72  _mav_put_float(buf, 20, totalDist);
73  _mav_put_float(buf, 24, dist2Go);
74  _mav_put_uint16_t(buf, 28, h_c);
75  _mav_put_uint8_t(buf, 30, fromWP);
76  _mav_put_uint8_t(buf, 31, toWP);
77 
79 #else
81  packet.u_m = u_m;
82  packet.phi_c = phi_c;
83  packet.theta_c = theta_c;
84  packet.psiDot_c = psiDot_c;
85  packet.ay_body = ay_body;
86  packet.totalDist = totalDist;
87  packet.dist2Go = dist2Go;
88  packet.h_c = h_c;
89  packet.fromWP = fromWP;
90  packet.toWP = toWP;
91 
93 #endif
94 
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
100 #endif
101 }
102 
121 static inline uint16_t mavlink_msg_slugs_navigation_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
122  mavlink_message_t* msg,
123  float u_m,float phi_c,float theta_c,float psiDot_c,float ay_body,float totalDist,float dist2Go,uint8_t fromWP,uint8_t toWP,uint16_t h_c)
124 {
125 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
127  _mav_put_float(buf, 0, u_m);
128  _mav_put_float(buf, 4, phi_c);
129  _mav_put_float(buf, 8, theta_c);
130  _mav_put_float(buf, 12, psiDot_c);
131  _mav_put_float(buf, 16, ay_body);
132  _mav_put_float(buf, 20, totalDist);
133  _mav_put_float(buf, 24, dist2Go);
134  _mav_put_uint16_t(buf, 28, h_c);
135  _mav_put_uint8_t(buf, 30, fromWP);
136  _mav_put_uint8_t(buf, 31, toWP);
137 
139 #else
141  packet.u_m = u_m;
142  packet.phi_c = phi_c;
143  packet.theta_c = theta_c;
144  packet.psiDot_c = psiDot_c;
145  packet.ay_body = ay_body;
146  packet.totalDist = totalDist;
147  packet.dist2Go = dist2Go;
148  packet.h_c = h_c;
149  packet.fromWP = fromWP;
150  packet.toWP = toWP;
151 
153 #endif
154 
155  msg->msgid = MAVLINK_MSG_ID_SLUGS_NAVIGATION;
156 #if MAVLINK_CRC_EXTRA
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_slugs_navigation_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_slugs_navigation_t* slugs_navigation)
172 {
173  return mavlink_msg_slugs_navigation_pack(system_id, component_id, msg, slugs_navigation->u_m, slugs_navigation->phi_c, slugs_navigation->theta_c, slugs_navigation->psiDot_c, slugs_navigation->ay_body, slugs_navigation->totalDist, slugs_navigation->dist2Go, slugs_navigation->fromWP, slugs_navigation->toWP, slugs_navigation->h_c);
174 }
175 
185 static inline uint16_t mavlink_msg_slugs_navigation_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_slugs_navigation_t* slugs_navigation)
186 {
187  return mavlink_msg_slugs_navigation_pack_chan(system_id, component_id, chan, msg, slugs_navigation->u_m, slugs_navigation->phi_c, slugs_navigation->theta_c, slugs_navigation->psiDot_c, slugs_navigation->ay_body, slugs_navigation->totalDist, slugs_navigation->dist2Go, slugs_navigation->fromWP, slugs_navigation->toWP, slugs_navigation->h_c);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_slugs_navigation_send(mavlink_channel_t chan, float u_m, float phi_c, float theta_c, float psiDot_c, float ay_body, float totalDist, float dist2Go, uint8_t fromWP, uint8_t toWP, uint16_t h_c)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
211  _mav_put_float(buf, 0, u_m);
212  _mav_put_float(buf, 4, phi_c);
213  _mav_put_float(buf, 8, theta_c);
214  _mav_put_float(buf, 12, psiDot_c);
215  _mav_put_float(buf, 16, ay_body);
216  _mav_put_float(buf, 20, totalDist);
217  _mav_put_float(buf, 24, dist2Go);
218  _mav_put_uint16_t(buf, 28, h_c);
219  _mav_put_uint8_t(buf, 30, fromWP);
220  _mav_put_uint8_t(buf, 31, toWP);
221 
222 #if MAVLINK_CRC_EXTRA
224 #else
225  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, buf, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
226 #endif
227 #else
229  packet.u_m = u_m;
230  packet.phi_c = phi_c;
231  packet.theta_c = theta_c;
232  packet.psiDot_c = psiDot_c;
233  packet.ay_body = ay_body;
234  packet.totalDist = totalDist;
235  packet.dist2Go = dist2Go;
236  packet.h_c = h_c;
237  packet.fromWP = fromWP;
238  packet.toWP = toWP;
239 
240 #if MAVLINK_CRC_EXTRA
241  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, (const char *)&packet, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN, MAVLINK_MSG_ID_SLUGS_NAVIGATION_CRC);
242 #else
243  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, (const char *)&packet, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
244 #endif
245 #endif
246 }
247 
248 #if MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
249 /*
250  This varient of _send() can be used to save stack space by re-using
251  memory from the receive buffer. The caller provides a
252  mavlink_message_t which is the size of a full mavlink message. This
253  is usually the receive buffer for the channel, and allows a reply to an
254  incoming message with minimum stack space usage.
255  */
256 static inline void mavlink_msg_slugs_navigation_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, float u_m, float phi_c, float theta_c, float psiDot_c, float ay_body, float totalDist, float dist2Go, uint8_t fromWP, uint8_t toWP, uint16_t h_c)
257 {
258 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
259  char *buf = (char *)msgbuf;
260  _mav_put_float(buf, 0, u_m);
261  _mav_put_float(buf, 4, phi_c);
262  _mav_put_float(buf, 8, theta_c);
263  _mav_put_float(buf, 12, psiDot_c);
264  _mav_put_float(buf, 16, ay_body);
265  _mav_put_float(buf, 20, totalDist);
266  _mav_put_float(buf, 24, dist2Go);
267  _mav_put_uint16_t(buf, 28, h_c);
268  _mav_put_uint8_t(buf, 30, fromWP);
269  _mav_put_uint8_t(buf, 31, toWP);
270 
271 #if MAVLINK_CRC_EXTRA
273 #else
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, buf, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
275 #endif
276 #else
278  packet->u_m = u_m;
279  packet->phi_c = phi_c;
280  packet->theta_c = theta_c;
281  packet->psiDot_c = psiDot_c;
282  packet->ay_body = ay_body;
283  packet->totalDist = totalDist;
284  packet->dist2Go = dist2Go;
285  packet->h_c = h_c;
286  packet->fromWP = fromWP;
287  packet->toWP = toWP;
288 
289 #if MAVLINK_CRC_EXTRA
290  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, (const char *)packet, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN, MAVLINK_MSG_ID_SLUGS_NAVIGATION_CRC);
291 #else
292  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SLUGS_NAVIGATION, (const char *)packet, MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
293 #endif
294 #endif
295 }
296 #endif
297 
298 #endif
299 
300 // MESSAGE SLUGS_NAVIGATION UNPACKING
301 
302 
308 static inline float mavlink_msg_slugs_navigation_get_u_m(const mavlink_message_t* msg)
309 {
310  return _MAV_RETURN_float(msg, 0);
311 }
312 
318 static inline float mavlink_msg_slugs_navigation_get_phi_c(const mavlink_message_t* msg)
319 {
320  return _MAV_RETURN_float(msg, 4);
321 }
322 
328 static inline float mavlink_msg_slugs_navigation_get_theta_c(const mavlink_message_t* msg)
329 {
330  return _MAV_RETURN_float(msg, 8);
331 }
332 
338 static inline float mavlink_msg_slugs_navigation_get_psiDot_c(const mavlink_message_t* msg)
339 {
340  return _MAV_RETURN_float(msg, 12);
341 }
342 
348 static inline float mavlink_msg_slugs_navigation_get_ay_body(const mavlink_message_t* msg)
349 {
350  return _MAV_RETURN_float(msg, 16);
351 }
352 
358 static inline float mavlink_msg_slugs_navigation_get_totalDist(const mavlink_message_t* msg)
359 {
360  return _MAV_RETURN_float(msg, 20);
361 }
362 
368 static inline float mavlink_msg_slugs_navigation_get_dist2Go(const mavlink_message_t* msg)
369 {
370  return _MAV_RETURN_float(msg, 24);
371 }
372 
378 static inline uint8_t mavlink_msg_slugs_navigation_get_fromWP(const mavlink_message_t* msg)
379 {
380  return _MAV_RETURN_uint8_t(msg, 30);
381 }
382 
388 static inline uint8_t mavlink_msg_slugs_navigation_get_toWP(const mavlink_message_t* msg)
389 {
390  return _MAV_RETURN_uint8_t(msg, 31);
391 }
392 
398 static inline uint16_t mavlink_msg_slugs_navigation_get_h_c(const mavlink_message_t* msg)
399 {
400  return _MAV_RETURN_uint16_t(msg, 28);
401 }
402 
409 static inline void mavlink_msg_slugs_navigation_decode(const mavlink_message_t* msg, mavlink_slugs_navigation_t* slugs_navigation)
410 {
411 #if MAVLINK_NEED_BYTE_SWAP
412  slugs_navigation->u_m = mavlink_msg_slugs_navigation_get_u_m(msg);
413  slugs_navigation->phi_c = mavlink_msg_slugs_navigation_get_phi_c(msg);
414  slugs_navigation->theta_c = mavlink_msg_slugs_navigation_get_theta_c(msg);
415  slugs_navigation->psiDot_c = mavlink_msg_slugs_navigation_get_psiDot_c(msg);
416  slugs_navigation->ay_body = mavlink_msg_slugs_navigation_get_ay_body(msg);
417  slugs_navigation->totalDist = mavlink_msg_slugs_navigation_get_totalDist(msg);
418  slugs_navigation->dist2Go = mavlink_msg_slugs_navigation_get_dist2Go(msg);
419  slugs_navigation->h_c = mavlink_msg_slugs_navigation_get_h_c(msg);
420  slugs_navigation->fromWP = mavlink_msg_slugs_navigation_get_fromWP(msg);
421  slugs_navigation->toWP = mavlink_msg_slugs_navigation_get_toWP(msg);
422 #else
423  memcpy(slugs_navigation, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SLUGS_NAVIGATION_LEN);
424 #endif
425 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:145
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:238
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:134
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139