NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mavlink_msg_camera_feedback.h
Go to the documentation of this file.
1 // MESSAGE CAMERA_FEEDBACK PACKING
2 
3 #define MAVLINK_MSG_ID_CAMERA_FEEDBACK 180
4 
6 {
7  uint64_t time_usec;
8  int32_t lat;
9  int32_t lng;
10  float alt_msl;
11  float alt_rel;
12  float roll;
13  float pitch;
14  float yaw;
15  float foc_len;
16  uint16_t img_idx;
17  uint8_t target_system;
18  uint8_t cam_idx;
19  uint8_t flags;
21 
22 #define MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN 45
23 #define MAVLINK_MSG_ID_180_LEN 45
24 
25 #define MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC 52
26 #define MAVLINK_MSG_ID_180_CRC 52
27 
28 
29 
30 #define MAVLINK_MESSAGE_INFO_CAMERA_FEEDBACK { \
31  "CAMERA_FEEDBACK", \
32  13, \
33  { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_feedback_t, time_usec) }, \
34  { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_camera_feedback_t, lat) }, \
35  { "lng", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_feedback_t, lng) }, \
36  { "alt_msl", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_feedback_t, alt_msl) }, \
37  { "alt_rel", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_feedback_t, alt_rel) }, \
38  { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_camera_feedback_t, roll) }, \
39  { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_camera_feedback_t, pitch) }, \
40  { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_camera_feedback_t, yaw) }, \
41  { "foc_len", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_camera_feedback_t, foc_len) }, \
42  { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 40, offsetof(mavlink_camera_feedback_t, img_idx) }, \
43  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_camera_feedback_t, target_system) }, \
44  { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_camera_feedback_t, cam_idx) }, \
45  { "flags", NULL, MAVLINK_TYPE_UINT8_T, 0, 44, offsetof(mavlink_camera_feedback_t, flags) }, \
46  } \
47 }
48 
49 
71 static inline uint16_t mavlink_msg_camera_feedback_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72  uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags)
73 {
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
76  _mav_put_uint64_t(buf, 0, time_usec);
77  _mav_put_int32_t(buf, 8, lat);
78  _mav_put_int32_t(buf, 12, lng);
79  _mav_put_float(buf, 16, alt_msl);
80  _mav_put_float(buf, 20, alt_rel);
81  _mav_put_float(buf, 24, roll);
82  _mav_put_float(buf, 28, pitch);
83  _mav_put_float(buf, 32, yaw);
84  _mav_put_float(buf, 36, foc_len);
85  _mav_put_uint16_t(buf, 40, img_idx);
86  _mav_put_uint8_t(buf, 42, target_system);
87  _mav_put_uint8_t(buf, 43, cam_idx);
88  _mav_put_uint8_t(buf, 44, flags);
89 
91 #else
93  packet.time_usec = time_usec;
94  packet.lat = lat;
95  packet.lng = lng;
96  packet.alt_msl = alt_msl;
97  packet.alt_rel = alt_rel;
98  packet.roll = roll;
99  packet.pitch = pitch;
100  packet.yaw = yaw;
101  packet.foc_len = foc_len;
102  packet.img_idx = img_idx;
103  packet.target_system = target_system;
104  packet.cam_idx = cam_idx;
105  packet.flags = flags;
106 
108 #endif
109 
110  msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK;
111 #if MAVLINK_CRC_EXTRA
113 #else
114  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
115 #endif
116 }
117 
139 static inline uint16_t mavlink_msg_camera_feedback_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
140  mavlink_message_t* msg,
141  uint64_t time_usec,uint8_t target_system,uint8_t cam_idx,uint16_t img_idx,int32_t lat,int32_t lng,float alt_msl,float alt_rel,float roll,float pitch,float yaw,float foc_len,uint8_t flags)
142 {
143 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
145  _mav_put_uint64_t(buf, 0, time_usec);
146  _mav_put_int32_t(buf, 8, lat);
147  _mav_put_int32_t(buf, 12, lng);
148  _mav_put_float(buf, 16, alt_msl);
149  _mav_put_float(buf, 20, alt_rel);
150  _mav_put_float(buf, 24, roll);
151  _mav_put_float(buf, 28, pitch);
152  _mav_put_float(buf, 32, yaw);
153  _mav_put_float(buf, 36, foc_len);
154  _mav_put_uint16_t(buf, 40, img_idx);
155  _mav_put_uint8_t(buf, 42, target_system);
156  _mav_put_uint8_t(buf, 43, cam_idx);
157  _mav_put_uint8_t(buf, 44, flags);
158 
160 #else
162  packet.time_usec = time_usec;
163  packet.lat = lat;
164  packet.lng = lng;
165  packet.alt_msl = alt_msl;
166  packet.alt_rel = alt_rel;
167  packet.roll = roll;
168  packet.pitch = pitch;
169  packet.yaw = yaw;
170  packet.foc_len = foc_len;
171  packet.img_idx = img_idx;
172  packet.target_system = target_system;
173  packet.cam_idx = cam_idx;
174  packet.flags = flags;
175 
177 #endif
178 
179  msg->msgid = MAVLINK_MSG_ID_CAMERA_FEEDBACK;
180 #if MAVLINK_CRC_EXTRA
182 #else
183  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
184 #endif
185 }
186 
195 static inline uint16_t mavlink_msg_camera_feedback_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback)
196 {
197  return mavlink_msg_camera_feedback_pack(system_id, component_id, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags);
198 }
199 
209 static inline uint16_t mavlink_msg_camera_feedback_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_feedback_t* camera_feedback)
210 {
211  return mavlink_msg_camera_feedback_pack_chan(system_id, component_id, chan, msg, camera_feedback->time_usec, camera_feedback->target_system, camera_feedback->cam_idx, camera_feedback->img_idx, camera_feedback->lat, camera_feedback->lng, camera_feedback->alt_msl, camera_feedback->alt_rel, camera_feedback->roll, camera_feedback->pitch, camera_feedback->yaw, camera_feedback->foc_len, camera_feedback->flags);
212 }
213 
232 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
233 
234 static inline void mavlink_msg_camera_feedback_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags)
235 {
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
238  _mav_put_uint64_t(buf, 0, time_usec);
239  _mav_put_int32_t(buf, 8, lat);
240  _mav_put_int32_t(buf, 12, lng);
241  _mav_put_float(buf, 16, alt_msl);
242  _mav_put_float(buf, 20, alt_rel);
243  _mav_put_float(buf, 24, roll);
244  _mav_put_float(buf, 28, pitch);
245  _mav_put_float(buf, 32, yaw);
246  _mav_put_float(buf, 36, foc_len);
247  _mav_put_uint16_t(buf, 40, img_idx);
248  _mav_put_uint8_t(buf, 42, target_system);
249  _mav_put_uint8_t(buf, 43, cam_idx);
250  _mav_put_uint8_t(buf, 44, flags);
251 
252 #if MAVLINK_CRC_EXTRA
254 #else
255  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
256 #endif
257 #else
259  packet.time_usec = time_usec;
260  packet.lat = lat;
261  packet.lng = lng;
262  packet.alt_msl = alt_msl;
263  packet.alt_rel = alt_rel;
264  packet.roll = roll;
265  packet.pitch = pitch;
266  packet.yaw = yaw;
267  packet.foc_len = foc_len;
268  packet.img_idx = img_idx;
269  packet.target_system = target_system;
270  packet.cam_idx = cam_idx;
271  packet.flags = flags;
272 
273 #if MAVLINK_CRC_EXTRA
274  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
275 #else
276  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
277 #endif
278 #endif
279 }
280 
281 #if MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
282 /*
283  This varient of _send() can be used to save stack space by re-using
284  memory from the receive buffer. The caller provides a
285  mavlink_message_t which is the size of a full mavlink message. This
286  is usually the receive buffer for the channel, and allows a reply to an
287  incoming message with minimum stack space usage.
288  */
289 static inline void mavlink_msg_camera_feedback_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, int32_t lat, int32_t lng, float alt_msl, float alt_rel, float roll, float pitch, float yaw, float foc_len, uint8_t flags)
290 {
291 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
292  char *buf = (char *)msgbuf;
293  _mav_put_uint64_t(buf, 0, time_usec);
294  _mav_put_int32_t(buf, 8, lat);
295  _mav_put_int32_t(buf, 12, lng);
296  _mav_put_float(buf, 16, alt_msl);
297  _mav_put_float(buf, 20, alt_rel);
298  _mav_put_float(buf, 24, roll);
299  _mav_put_float(buf, 28, pitch);
300  _mav_put_float(buf, 32, yaw);
301  _mav_put_float(buf, 36, foc_len);
302  _mav_put_uint16_t(buf, 40, img_idx);
303  _mav_put_uint8_t(buf, 42, target_system);
304  _mav_put_uint8_t(buf, 43, cam_idx);
305  _mav_put_uint8_t(buf, 44, flags);
306 
307 #if MAVLINK_CRC_EXTRA
309 #else
310  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, buf, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
311 #endif
312 #else
314  packet->time_usec = time_usec;
315  packet->lat = lat;
316  packet->lng = lng;
317  packet->alt_msl = alt_msl;
318  packet->alt_rel = alt_rel;
319  packet->roll = roll;
320  packet->pitch = pitch;
321  packet->yaw = yaw;
322  packet->foc_len = foc_len;
323  packet->img_idx = img_idx;
324  packet->target_system = target_system;
325  packet->cam_idx = cam_idx;
326  packet->flags = flags;
327 
328 #if MAVLINK_CRC_EXTRA
329  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN, MAVLINK_MSG_ID_CAMERA_FEEDBACK_CRC);
330 #else
331  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_FEEDBACK, (const char *)packet, MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
332 #endif
333 #endif
334 }
335 #endif
336 
337 #endif
338 
339 // MESSAGE CAMERA_FEEDBACK UNPACKING
340 
341 
347 static inline uint64_t mavlink_msg_camera_feedback_get_time_usec(const mavlink_message_t* msg)
348 {
349  return _MAV_RETURN_uint64_t(msg, 0);
350 }
351 
357 static inline uint8_t mavlink_msg_camera_feedback_get_target_system(const mavlink_message_t* msg)
358 {
359  return _MAV_RETURN_uint8_t(msg, 42);
360 }
361 
367 static inline uint8_t mavlink_msg_camera_feedback_get_cam_idx(const mavlink_message_t* msg)
368 {
369  return _MAV_RETURN_uint8_t(msg, 43);
370 }
371 
377 static inline uint16_t mavlink_msg_camera_feedback_get_img_idx(const mavlink_message_t* msg)
378 {
379  return _MAV_RETURN_uint16_t(msg, 40);
380 }
381 
387 static inline int32_t mavlink_msg_camera_feedback_get_lat(const mavlink_message_t* msg)
388 {
389  return _MAV_RETURN_int32_t(msg, 8);
390 }
391 
397 static inline int32_t mavlink_msg_camera_feedback_get_lng(const mavlink_message_t* msg)
398 {
399  return _MAV_RETURN_int32_t(msg, 12);
400 }
401 
407 static inline float mavlink_msg_camera_feedback_get_alt_msl(const mavlink_message_t* msg)
408 {
409  return _MAV_RETURN_float(msg, 16);
410 }
411 
417 static inline float mavlink_msg_camera_feedback_get_alt_rel(const mavlink_message_t* msg)
418 {
419  return _MAV_RETURN_float(msg, 20);
420 }
421 
427 static inline float mavlink_msg_camera_feedback_get_roll(const mavlink_message_t* msg)
428 {
429  return _MAV_RETURN_float(msg, 24);
430 }
431 
437 static inline float mavlink_msg_camera_feedback_get_pitch(const mavlink_message_t* msg)
438 {
439  return _MAV_RETURN_float(msg, 28);
440 }
441 
447 static inline float mavlink_msg_camera_feedback_get_yaw(const mavlink_message_t* msg)
448 {
449  return _MAV_RETURN_float(msg, 32);
450 }
451 
457 static inline float mavlink_msg_camera_feedback_get_foc_len(const mavlink_message_t* msg)
458 {
459  return _MAV_RETURN_float(msg, 36);
460 }
461 
467 static inline uint8_t mavlink_msg_camera_feedback_get_flags(const mavlink_message_t* msg)
468 {
469  return _MAV_RETURN_uint8_t(msg, 44);
470 }
471 
478 static inline void mavlink_msg_camera_feedback_decode(const mavlink_message_t* msg, mavlink_camera_feedback_t* camera_feedback)
479 {
480 #if MAVLINK_NEED_BYTE_SWAP
481  camera_feedback->time_usec = mavlink_msg_camera_feedback_get_time_usec(msg);
482  camera_feedback->lat = mavlink_msg_camera_feedback_get_lat(msg);
483  camera_feedback->lng = mavlink_msg_camera_feedback_get_lng(msg);
484  camera_feedback->alt_msl = mavlink_msg_camera_feedback_get_alt_msl(msg);
485  camera_feedback->alt_rel = mavlink_msg_camera_feedback_get_alt_rel(msg);
486  camera_feedback->roll = mavlink_msg_camera_feedback_get_roll(msg);
487  camera_feedback->pitch = mavlink_msg_camera_feedback_get_pitch(msg);
488  camera_feedback->yaw = mavlink_msg_camera_feedback_get_yaw(msg);
489  camera_feedback->foc_len = mavlink_msg_camera_feedback_get_foc_len(msg);
490  camera_feedback->img_idx = mavlink_msg_camera_feedback_get_img_idx(msg);
491  camera_feedback->target_system = mavlink_msg_camera_feedback_get_target_system(msg);
492  camera_feedback->cam_idx = mavlink_msg_camera_feedback_get_cam_idx(msg);
493  camera_feedback->flags = mavlink_msg_camera_feedback_get_flags(msg);
494 #else
495  memcpy(camera_feedback, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_CAMERA_FEEDBACK_LEN);
496 #endif
497 }
#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_uint64_t(buf, wire_offset, b)
Definition: protocol.h:143
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:142
uint16_t flags
Definition: ledstrip.h:11
int16_t pitch
Definition: accelerometer.h:52
int16_t yaw
Definition: sensors.h:31
#define _mav_put_uint16_t(buf, wire_offset, b)
Definition: protocol.h:139
int16_t roll
Definition: accelerometer.h:51