MAV'RIC
mavlink_msg_spherical_optic_flow.h
1 // MESSAGE SPHERICAL_OPTIC_FLOW PACKING
2 
3 #define MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW 166
4 
6 {
7  uint64_t time_usec;
8  int16_t of_azimuth[18];
9  int16_t of_elevation[18];
10  int16_t azimuth[18];
11  int16_t elevation[18];
12  uint8_t id_sensor;
13  uint8_t nb_sensors;
14  uint8_t nb_of;
15  uint8_t status;
16  uint8_t of_info[18];
18 
19 #define MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN 174
20 #define MAVLINK_MSG_ID_166_LEN 174
21 
22 #define MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC 23
23 #define MAVLINK_MSG_ID_166_CRC 23
24 
25 #define MAVLINK_MSG_SPHERICAL_OPTIC_FLOW_FIELD_OF_AZIMUTH_LEN 18
26 #define MAVLINK_MSG_SPHERICAL_OPTIC_FLOW_FIELD_OF_ELEVATION_LEN 18
27 #define MAVLINK_MSG_SPHERICAL_OPTIC_FLOW_FIELD_AZIMUTH_LEN 18
28 #define MAVLINK_MSG_SPHERICAL_OPTIC_FLOW_FIELD_ELEVATION_LEN 18
29 #define MAVLINK_MSG_SPHERICAL_OPTIC_FLOW_FIELD_OF_INFO_LEN 18
30 
31 #define MAVLINK_MESSAGE_INFO_SPHERICAL_OPTIC_FLOW { \
32  "SPHERICAL_OPTIC_FLOW", \
33  10, \
34  { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_spherical_optic_flow_t, time_usec) }, \
35  { "of_azimuth", NULL, MAVLINK_TYPE_INT16_T, 18, 8, offsetof(mavlink_spherical_optic_flow_t, of_azimuth) }, \
36  { "of_elevation", NULL, MAVLINK_TYPE_INT16_T, 18, 44, offsetof(mavlink_spherical_optic_flow_t, of_elevation) }, \
37  { "azimuth", NULL, MAVLINK_TYPE_INT16_T, 18, 80, offsetof(mavlink_spherical_optic_flow_t, azimuth) }, \
38  { "elevation", NULL, MAVLINK_TYPE_INT16_T, 18, 116, offsetof(mavlink_spherical_optic_flow_t, elevation) }, \
39  { "id_sensor", NULL, MAVLINK_TYPE_UINT8_T, 0, 152, offsetof(mavlink_spherical_optic_flow_t, id_sensor) }, \
40  { "nb_sensors", NULL, MAVLINK_TYPE_UINT8_T, 0, 153, offsetof(mavlink_spherical_optic_flow_t, nb_sensors) }, \
41  { "nb_of", NULL, MAVLINK_TYPE_UINT8_T, 0, 154, offsetof(mavlink_spherical_optic_flow_t, nb_of) }, \
42  { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 155, offsetof(mavlink_spherical_optic_flow_t, status) }, \
43  { "of_info", NULL, MAVLINK_TYPE_UINT8_T, 18, 156, offsetof(mavlink_spherical_optic_flow_t, of_info) }, \
44  } \
45 }
46 
47 
66 static inline uint16_t mavlink_msg_spherical_optic_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
67  uint64_t time_usec, uint8_t id_sensor, uint8_t nb_sensors, uint8_t nb_of, uint8_t status, const int16_t *of_azimuth, const int16_t *of_elevation, const int16_t *azimuth, const int16_t *elevation, const uint8_t *of_info)
68 {
69 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
70  char buf[MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN];
71  _mav_put_uint64_t(buf, 0, time_usec);
72  _mav_put_uint8_t(buf, 152, id_sensor);
73  _mav_put_uint8_t(buf, 153, nb_sensors);
74  _mav_put_uint8_t(buf, 154, nb_of);
75  _mav_put_uint8_t(buf, 155, status);
76  _mav_put_int16_t_array(buf, 8, of_azimuth, 18);
77  _mav_put_int16_t_array(buf, 44, of_elevation, 18);
78  _mav_put_int16_t_array(buf, 80, azimuth, 18);
79  _mav_put_int16_t_array(buf, 116, elevation, 18);
80  _mav_put_uint8_t_array(buf, 156, of_info, 18);
81  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
82 #else
84  packet.time_usec = time_usec;
85  packet.id_sensor = id_sensor;
86  packet.nb_sensors = nb_sensors;
87  packet.nb_of = nb_of;
88  packet.status = status;
89  mav_array_memcpy(packet.of_azimuth, of_azimuth, sizeof(int16_t)*18);
90  mav_array_memcpy(packet.of_elevation, of_elevation, sizeof(int16_t)*18);
91  mav_array_memcpy(packet.azimuth, azimuth, sizeof(int16_t)*18);
92  mav_array_memcpy(packet.elevation, elevation, sizeof(int16_t)*18);
93  mav_array_memcpy(packet.of_info, of_info, sizeof(uint8_t)*18);
94  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
95 #endif
96 
97  msg->msgid = MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW;
98 #if MAVLINK_CRC_EXTRA
99  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
100 #else
101  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
102 #endif
103 }
104 
123 static inline uint16_t mavlink_msg_spherical_optic_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
124  mavlink_message_t* msg,
125  uint64_t time_usec,uint8_t id_sensor,uint8_t nb_sensors,uint8_t nb_of,uint8_t status,const int16_t *of_azimuth,const int16_t *of_elevation,const int16_t *azimuth,const int16_t *elevation,const uint8_t *of_info)
126 {
127 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
128  char buf[MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN];
129  _mav_put_uint64_t(buf, 0, time_usec);
130  _mav_put_uint8_t(buf, 152, id_sensor);
131  _mav_put_uint8_t(buf, 153, nb_sensors);
132  _mav_put_uint8_t(buf, 154, nb_of);
133  _mav_put_uint8_t(buf, 155, status);
134  _mav_put_int16_t_array(buf, 8, of_azimuth, 18);
135  _mav_put_int16_t_array(buf, 44, of_elevation, 18);
136  _mav_put_int16_t_array(buf, 80, azimuth, 18);
137  _mav_put_int16_t_array(buf, 116, elevation, 18);
138  _mav_put_uint8_t_array(buf, 156, of_info, 18);
139  memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
140 #else
142  packet.time_usec = time_usec;
143  packet.id_sensor = id_sensor;
144  packet.nb_sensors = nb_sensors;
145  packet.nb_of = nb_of;
146  packet.status = status;
147  mav_array_memcpy(packet.of_azimuth, of_azimuth, sizeof(int16_t)*18);
148  mav_array_memcpy(packet.of_elevation, of_elevation, sizeof(int16_t)*18);
149  mav_array_memcpy(packet.azimuth, azimuth, sizeof(int16_t)*18);
150  mav_array_memcpy(packet.elevation, elevation, sizeof(int16_t)*18);
151  mav_array_memcpy(packet.of_info, of_info, sizeof(uint8_t)*18);
152  memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
153 #endif
154 
155  msg->msgid = MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW;
156 #if MAVLINK_CRC_EXTRA
157  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
158 #else
159  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
160 #endif
161 }
162 
171 static inline uint16_t mavlink_msg_spherical_optic_flow_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_spherical_optic_flow_t* spherical_optic_flow)
172 {
173  return mavlink_msg_spherical_optic_flow_pack(system_id, component_id, msg, spherical_optic_flow->time_usec, spherical_optic_flow->id_sensor, spherical_optic_flow->nb_sensors, spherical_optic_flow->nb_of, spherical_optic_flow->status, spherical_optic_flow->of_azimuth, spherical_optic_flow->of_elevation, spherical_optic_flow->azimuth, spherical_optic_flow->elevation, spherical_optic_flow->of_info);
174 }
175 
185 static inline uint16_t mavlink_msg_spherical_optic_flow_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_spherical_optic_flow_t* spherical_optic_flow)
186 {
187  return mavlink_msg_spherical_optic_flow_pack_chan(system_id, component_id, chan, msg, spherical_optic_flow->time_usec, spherical_optic_flow->id_sensor, spherical_optic_flow->nb_sensors, spherical_optic_flow->nb_of, spherical_optic_flow->status, spherical_optic_flow->of_azimuth, spherical_optic_flow->of_elevation, spherical_optic_flow->azimuth, spherical_optic_flow->elevation, spherical_optic_flow->of_info);
188 }
189 
205 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
206 
207 static inline void mavlink_msg_spherical_optic_flow_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t id_sensor, uint8_t nb_sensors, uint8_t nb_of, uint8_t status, const int16_t *of_azimuth, const int16_t *of_elevation, const int16_t *azimuth, const int16_t *elevation, const uint8_t *of_info)
208 {
209 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
210  char buf[MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN];
211  _mav_put_uint64_t(buf, 0, time_usec);
212  _mav_put_uint8_t(buf, 152, id_sensor);
213  _mav_put_uint8_t(buf, 153, nb_sensors);
214  _mav_put_uint8_t(buf, 154, nb_of);
215  _mav_put_uint8_t(buf, 155, status);
216  _mav_put_int16_t_array(buf, 8, of_azimuth, 18);
217  _mav_put_int16_t_array(buf, 44, of_elevation, 18);
218  _mav_put_int16_t_array(buf, 80, azimuth, 18);
219  _mav_put_int16_t_array(buf, 116, elevation, 18);
220  _mav_put_uint8_t_array(buf, 156, of_info, 18);
221 #if MAVLINK_CRC_EXTRA
222  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
223 #else
224  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
225 #endif
226 #else
228  packet.time_usec = time_usec;
229  packet.id_sensor = id_sensor;
230  packet.nb_sensors = nb_sensors;
231  packet.nb_of = nb_of;
232  packet.status = status;
233  mav_array_memcpy(packet.of_azimuth, of_azimuth, sizeof(int16_t)*18);
234  mav_array_memcpy(packet.of_elevation, of_elevation, sizeof(int16_t)*18);
235  mav_array_memcpy(packet.azimuth, azimuth, sizeof(int16_t)*18);
236  mav_array_memcpy(packet.elevation, elevation, sizeof(int16_t)*18);
237  mav_array_memcpy(packet.of_info, of_info, sizeof(uint8_t)*18);
238 #if MAVLINK_CRC_EXTRA
239  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, (const char *)&packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
240 #else
241  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, (const char *)&packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
242 #endif
243 #endif
244 }
245 
246 #if MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
247 /*
248  This varient of _send() can be used to save stack space by re-using
249  memory from the receive buffer. The caller provides a
250  mavlink_message_t which is the size of a full mavlink message. This
251  is usually the receive buffer for the channel, and allows a reply to an
252  incoming message with minimum stack space usage.
253  */
254 static inline void mavlink_msg_spherical_optic_flow_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t id_sensor, uint8_t nb_sensors, uint8_t nb_of, uint8_t status, const int16_t *of_azimuth, const int16_t *of_elevation, const int16_t *azimuth, const int16_t *elevation, const uint8_t *of_info)
255 {
256 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
257  char *buf = (char *)msgbuf;
258  _mav_put_uint64_t(buf, 0, time_usec);
259  _mav_put_uint8_t(buf, 152, id_sensor);
260  _mav_put_uint8_t(buf, 153, nb_sensors);
261  _mav_put_uint8_t(buf, 154, nb_of);
262  _mav_put_uint8_t(buf, 155, status);
263  _mav_put_int16_t_array(buf, 8, of_azimuth, 18);
264  _mav_put_int16_t_array(buf, 44, of_elevation, 18);
265  _mav_put_int16_t_array(buf, 80, azimuth, 18);
266  _mav_put_int16_t_array(buf, 116, elevation, 18);
267  _mav_put_uint8_t_array(buf, 156, of_info, 18);
268 #if MAVLINK_CRC_EXTRA
269  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
270 #else
271  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, buf, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
272 #endif
273 #else
275  packet->time_usec = time_usec;
276  packet->id_sensor = id_sensor;
277  packet->nb_sensors = nb_sensors;
278  packet->nb_of = nb_of;
279  packet->status = status;
280  mav_array_memcpy(packet->of_azimuth, of_azimuth, sizeof(int16_t)*18);
281  mav_array_memcpy(packet->of_elevation, of_elevation, sizeof(int16_t)*18);
282  mav_array_memcpy(packet->azimuth, azimuth, sizeof(int16_t)*18);
283  mav_array_memcpy(packet->elevation, elevation, sizeof(int16_t)*18);
284  mav_array_memcpy(packet->of_info, of_info, sizeof(uint8_t)*18);
285 #if MAVLINK_CRC_EXTRA
286  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, (const char *)packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_CRC);
287 #else
288  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW, (const char *)packet, MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
289 #endif
290 #endif
291 }
292 #endif
293 
294 #endif
295 
296 // MESSAGE SPHERICAL_OPTIC_FLOW UNPACKING
297 
298 
304 static inline uint64_t mavlink_msg_spherical_optic_flow_get_time_usec(const mavlink_message_t* msg)
305 {
306  return _MAV_RETURN_uint64_t(msg, 0);
307 }
308 
314 static inline uint8_t mavlink_msg_spherical_optic_flow_get_id_sensor(const mavlink_message_t* msg)
315 {
316  return _MAV_RETURN_uint8_t(msg, 152);
317 }
318 
324 static inline uint8_t mavlink_msg_spherical_optic_flow_get_nb_sensors(const mavlink_message_t* msg)
325 {
326  return _MAV_RETURN_uint8_t(msg, 153);
327 }
328 
334 static inline uint8_t mavlink_msg_spherical_optic_flow_get_nb_of(const mavlink_message_t* msg)
335 {
336  return _MAV_RETURN_uint8_t(msg, 154);
337 }
338 
344 static inline uint8_t mavlink_msg_spherical_optic_flow_get_status(const mavlink_message_t* msg)
345 {
346  return _MAV_RETURN_uint8_t(msg, 155);
347 }
348 
354 static inline uint16_t mavlink_msg_spherical_optic_flow_get_of_azimuth(const mavlink_message_t* msg, int16_t *of_azimuth)
355 {
356  return _MAV_RETURN_int16_t_array(msg, of_azimuth, 18, 8);
357 }
358 
364 static inline uint16_t mavlink_msg_spherical_optic_flow_get_of_elevation(const mavlink_message_t* msg, int16_t *of_elevation)
365 {
366  return _MAV_RETURN_int16_t_array(msg, of_elevation, 18, 44);
367 }
368 
374 static inline uint16_t mavlink_msg_spherical_optic_flow_get_azimuth(const mavlink_message_t* msg, int16_t *azimuth)
375 {
376  return _MAV_RETURN_int16_t_array(msg, azimuth, 18, 80);
377 }
378 
384 static inline uint16_t mavlink_msg_spherical_optic_flow_get_elevation(const mavlink_message_t* msg, int16_t *elevation)
385 {
386  return _MAV_RETURN_int16_t_array(msg, elevation, 18, 116);
387 }
388 
394 static inline uint16_t mavlink_msg_spherical_optic_flow_get_of_info(const mavlink_message_t* msg, uint8_t *of_info)
395 {
396  return _MAV_RETURN_uint8_t_array(msg, of_info, 18, 156);
397 }
398 
405 static inline void mavlink_msg_spherical_optic_flow_decode(const mavlink_message_t* msg, mavlink_spherical_optic_flow_t* spherical_optic_flow)
406 {
407 #if MAVLINK_NEED_BYTE_SWAP
408  spherical_optic_flow->time_usec = mavlink_msg_spherical_optic_flow_get_time_usec(msg);
409  mavlink_msg_spherical_optic_flow_get_of_azimuth(msg, spherical_optic_flow->of_azimuth);
410  mavlink_msg_spherical_optic_flow_get_of_elevation(msg, spherical_optic_flow->of_elevation);
411  mavlink_msg_spherical_optic_flow_get_azimuth(msg, spherical_optic_flow->azimuth);
412  mavlink_msg_spherical_optic_flow_get_elevation(msg, spherical_optic_flow->elevation);
413  spherical_optic_flow->id_sensor = mavlink_msg_spherical_optic_flow_get_id_sensor(msg);
414  spherical_optic_flow->nb_sensors = mavlink_msg_spherical_optic_flow_get_nb_sensors(msg);
415  spherical_optic_flow->nb_of = mavlink_msg_spherical_optic_flow_get_nb_of(msg);
416  spherical_optic_flow->status = mavlink_msg_spherical_optic_flow_get_status(msg);
417  mavlink_msg_spherical_optic_flow_get_of_info(msg, spherical_optic_flow->of_info);
418 #else
419  memcpy(spherical_optic_flow, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SPHERICAL_OPTIC_FLOW_LEN);
420 #endif
421 }