Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_optical_flow.h
blob25c8886421382e1630240280e11fc46e17ad8923
1 #pragma once
2 // MESSAGE OPTICAL_FLOW PACKING
4 #define MAVLINK_MSG_ID_OPTICAL_FLOW 100
6 MAVPACKED(
7 typedef struct __mavlink_optical_flow_t {
8 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 float flow_comp_m_x; /*< [m/s] Flow in x-sensor direction, angular-speed compensated*/
10 float flow_comp_m_y; /*< [m/s] Flow in y-sensor direction, angular-speed compensated*/
11 float ground_distance; /*< [m] Ground distance. Positive value: distance known. Negative value: Unknown distance*/
12 int16_t flow_x; /*< [dpix] Flow in x-sensor direction*/
13 int16_t flow_y; /*< [dpix] Flow in y-sensor direction*/
14 uint8_t sensor_id; /*< Sensor ID*/
15 uint8_t quality; /*< Optical flow quality / confidence. 0: bad, 255: maximum quality*/
16 float flow_rate_x; /*< [rad/s] Flow rate about X axis*/
17 float flow_rate_y; /*< [rad/s] Flow rate about Y axis*/
18 }) mavlink_optical_flow_t;
20 #define MAVLINK_MSG_ID_OPTICAL_FLOW_LEN 34
21 #define MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN 26
22 #define MAVLINK_MSG_ID_100_LEN 34
23 #define MAVLINK_MSG_ID_100_MIN_LEN 26
25 #define MAVLINK_MSG_ID_OPTICAL_FLOW_CRC 175
26 #define MAVLINK_MSG_ID_100_CRC 175
30 #if MAVLINK_COMMAND_24BIT
31 #define MAVLINK_MESSAGE_INFO_OPTICAL_FLOW { \
32 100, \
33 "OPTICAL_FLOW", \
34 10, \
35 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_optical_flow_t, time_usec) }, \
36 { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_optical_flow_t, sensor_id) }, \
37 { "flow_x", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_optical_flow_t, flow_x) }, \
38 { "flow_y", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_optical_flow_t, flow_y) }, \
39 { "flow_comp_m_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_optical_flow_t, flow_comp_m_x) }, \
40 { "flow_comp_m_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_optical_flow_t, flow_comp_m_y) }, \
41 { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_optical_flow_t, quality) }, \
42 { "ground_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_optical_flow_t, ground_distance) }, \
43 { "flow_rate_x", NULL, MAVLINK_TYPE_FLOAT, 0, 26, offsetof(mavlink_optical_flow_t, flow_rate_x) }, \
44 { "flow_rate_y", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_optical_flow_t, flow_rate_y) }, \
45 } \
47 #else
48 #define MAVLINK_MESSAGE_INFO_OPTICAL_FLOW { \
49 "OPTICAL_FLOW", \
50 10, \
51 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_optical_flow_t, time_usec) }, \
52 { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_optical_flow_t, sensor_id) }, \
53 { "flow_x", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_optical_flow_t, flow_x) }, \
54 { "flow_y", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_optical_flow_t, flow_y) }, \
55 { "flow_comp_m_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_optical_flow_t, flow_comp_m_x) }, \
56 { "flow_comp_m_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_optical_flow_t, flow_comp_m_y) }, \
57 { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_optical_flow_t, quality) }, \
58 { "ground_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_optical_flow_t, ground_distance) }, \
59 { "flow_rate_x", NULL, MAVLINK_TYPE_FLOAT, 0, 26, offsetof(mavlink_optical_flow_t, flow_rate_x) }, \
60 { "flow_rate_y", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_optical_flow_t, flow_rate_y) }, \
61 } \
63 #endif
65 /**
66 * @brief Pack a optical_flow message
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param msg The MAVLink message to compress the data into
71 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
72 * @param sensor_id Sensor ID
73 * @param flow_x [dpix] Flow in x-sensor direction
74 * @param flow_y [dpix] Flow in y-sensor direction
75 * @param flow_comp_m_x [m/s] Flow in x-sensor direction, angular-speed compensated
76 * @param flow_comp_m_y [m/s] Flow in y-sensor direction, angular-speed compensated
77 * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality
78 * @param ground_distance [m] Ground distance. Positive value: distance known. Negative value: Unknown distance
79 * @param flow_rate_x [rad/s] Flow rate about X axis
80 * @param flow_rate_y [rad/s] Flow rate about Y axis
81 * @return length of the message in bytes (excluding serial stream start sign)
83 static inline uint16_t mavlink_msg_optical_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
84 uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance, float flow_rate_x, float flow_rate_y)
86 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87 char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_LEN];
88 _mav_put_uint64_t(buf, 0, time_usec);
89 _mav_put_float(buf, 8, flow_comp_m_x);
90 _mav_put_float(buf, 12, flow_comp_m_y);
91 _mav_put_float(buf, 16, ground_distance);
92 _mav_put_int16_t(buf, 20, flow_x);
93 _mav_put_int16_t(buf, 22, flow_y);
94 _mav_put_uint8_t(buf, 24, sensor_id);
95 _mav_put_uint8_t(buf, 25, quality);
96 _mav_put_float(buf, 26, flow_rate_x);
97 _mav_put_float(buf, 30, flow_rate_y);
99 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN);
100 #else
101 mavlink_optical_flow_t packet;
102 packet.time_usec = time_usec;
103 packet.flow_comp_m_x = flow_comp_m_x;
104 packet.flow_comp_m_y = flow_comp_m_y;
105 packet.ground_distance = ground_distance;
106 packet.flow_x = flow_x;
107 packet.flow_y = flow_y;
108 packet.sensor_id = sensor_id;
109 packet.quality = quality;
110 packet.flow_rate_x = flow_rate_x;
111 packet.flow_rate_y = flow_rate_y;
113 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN);
114 #endif
116 msg->msgid = MAVLINK_MSG_ID_OPTICAL_FLOW;
117 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
121 * @brief Pack a optical_flow message on a channel
122 * @param system_id ID of this system
123 * @param component_id ID of this component (e.g. 200 for IMU)
124 * @param chan The MAVLink channel this message will be sent over
125 * @param msg The MAVLink message to compress the data into
126 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
127 * @param sensor_id Sensor ID
128 * @param flow_x [dpix] Flow in x-sensor direction
129 * @param flow_y [dpix] Flow in y-sensor direction
130 * @param flow_comp_m_x [m/s] Flow in x-sensor direction, angular-speed compensated
131 * @param flow_comp_m_y [m/s] Flow in y-sensor direction, angular-speed compensated
132 * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality
133 * @param ground_distance [m] Ground distance. Positive value: distance known. Negative value: Unknown distance
134 * @param flow_rate_x [rad/s] Flow rate about X axis
135 * @param flow_rate_y [rad/s] Flow rate about Y axis
136 * @return length of the message in bytes (excluding serial stream start sign)
138 static inline uint16_t mavlink_msg_optical_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
139 mavlink_message_t* msg,
140 uint64_t time_usec,uint8_t sensor_id,int16_t flow_x,int16_t flow_y,float flow_comp_m_x,float flow_comp_m_y,uint8_t quality,float ground_distance,float flow_rate_x,float flow_rate_y)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_LEN];
144 _mav_put_uint64_t(buf, 0, time_usec);
145 _mav_put_float(buf, 8, flow_comp_m_x);
146 _mav_put_float(buf, 12, flow_comp_m_y);
147 _mav_put_float(buf, 16, ground_distance);
148 _mav_put_int16_t(buf, 20, flow_x);
149 _mav_put_int16_t(buf, 22, flow_y);
150 _mav_put_uint8_t(buf, 24, sensor_id);
151 _mav_put_uint8_t(buf, 25, quality);
152 _mav_put_float(buf, 26, flow_rate_x);
153 _mav_put_float(buf, 30, flow_rate_y);
155 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN);
156 #else
157 mavlink_optical_flow_t packet;
158 packet.time_usec = time_usec;
159 packet.flow_comp_m_x = flow_comp_m_x;
160 packet.flow_comp_m_y = flow_comp_m_y;
161 packet.ground_distance = ground_distance;
162 packet.flow_x = flow_x;
163 packet.flow_y = flow_y;
164 packet.sensor_id = sensor_id;
165 packet.quality = quality;
166 packet.flow_rate_x = flow_rate_x;
167 packet.flow_rate_y = flow_rate_y;
169 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN);
170 #endif
172 msg->msgid = MAVLINK_MSG_ID_OPTICAL_FLOW;
173 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
177 * @brief Encode a optical_flow struct
179 * @param system_id ID of this system
180 * @param component_id ID of this component (e.g. 200 for IMU)
181 * @param msg The MAVLink message to compress the data into
182 * @param optical_flow C-struct to read the message contents from
184 static inline uint16_t mavlink_msg_optical_flow_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_optical_flow_t* optical_flow)
186 return mavlink_msg_optical_flow_pack(system_id, component_id, msg, optical_flow->time_usec, optical_flow->sensor_id, optical_flow->flow_x, optical_flow->flow_y, optical_flow->flow_comp_m_x, optical_flow->flow_comp_m_y, optical_flow->quality, optical_flow->ground_distance, optical_flow->flow_rate_x, optical_flow->flow_rate_y);
190 * @brief Encode a optical_flow struct on a channel
192 * @param system_id ID of this system
193 * @param component_id ID of this component (e.g. 200 for IMU)
194 * @param chan The MAVLink channel this message will be sent over
195 * @param msg The MAVLink message to compress the data into
196 * @param optical_flow C-struct to read the message contents from
198 static inline uint16_t mavlink_msg_optical_flow_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_optical_flow_t* optical_flow)
200 return mavlink_msg_optical_flow_pack_chan(system_id, component_id, chan, msg, optical_flow->time_usec, optical_flow->sensor_id, optical_flow->flow_x, optical_flow->flow_y, optical_flow->flow_comp_m_x, optical_flow->flow_comp_m_y, optical_flow->quality, optical_flow->ground_distance, optical_flow->flow_rate_x, optical_flow->flow_rate_y);
204 * @brief Send a optical_flow message
205 * @param chan MAVLink channel to send the message
207 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
208 * @param sensor_id Sensor ID
209 * @param flow_x [dpix] Flow in x-sensor direction
210 * @param flow_y [dpix] Flow in y-sensor direction
211 * @param flow_comp_m_x [m/s] Flow in x-sensor direction, angular-speed compensated
212 * @param flow_comp_m_y [m/s] Flow in y-sensor direction, angular-speed compensated
213 * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality
214 * @param ground_distance [m] Ground distance. Positive value: distance known. Negative value: Unknown distance
215 * @param flow_rate_x [rad/s] Flow rate about X axis
216 * @param flow_rate_y [rad/s] Flow rate about Y axis
218 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
220 static inline void mavlink_msg_optical_flow_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance, float flow_rate_x, float flow_rate_y)
222 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
223 char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_LEN];
224 _mav_put_uint64_t(buf, 0, time_usec);
225 _mav_put_float(buf, 8, flow_comp_m_x);
226 _mav_put_float(buf, 12, flow_comp_m_y);
227 _mav_put_float(buf, 16, ground_distance);
228 _mav_put_int16_t(buf, 20, flow_x);
229 _mav_put_int16_t(buf, 22, flow_y);
230 _mav_put_uint8_t(buf, 24, sensor_id);
231 _mav_put_uint8_t(buf, 25, quality);
232 _mav_put_float(buf, 26, flow_rate_x);
233 _mav_put_float(buf, 30, flow_rate_y);
235 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
236 #else
237 mavlink_optical_flow_t packet;
238 packet.time_usec = time_usec;
239 packet.flow_comp_m_x = flow_comp_m_x;
240 packet.flow_comp_m_y = flow_comp_m_y;
241 packet.ground_distance = ground_distance;
242 packet.flow_x = flow_x;
243 packet.flow_y = flow_y;
244 packet.sensor_id = sensor_id;
245 packet.quality = quality;
246 packet.flow_rate_x = flow_rate_x;
247 packet.flow_rate_y = flow_rate_y;
249 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
250 #endif
254 * @brief Send a optical_flow message
255 * @param chan MAVLink channel to send the message
256 * @param struct The MAVLink struct to serialize
258 static inline void mavlink_msg_optical_flow_send_struct(mavlink_channel_t chan, const mavlink_optical_flow_t* optical_flow)
260 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
261 mavlink_msg_optical_flow_send(chan, optical_flow->time_usec, optical_flow->sensor_id, optical_flow->flow_x, optical_flow->flow_y, optical_flow->flow_comp_m_x, optical_flow->flow_comp_m_y, optical_flow->quality, optical_flow->ground_distance, optical_flow->flow_rate_x, optical_flow->flow_rate_y);
262 #else
263 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW, (const char *)optical_flow, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
264 #endif
267 #if MAVLINK_MSG_ID_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
269 This varient of _send() can be used to save stack space by re-using
270 memory from the receive buffer. The caller provides a
271 mavlink_message_t which is the size of a full mavlink message. This
272 is usually the receive buffer for the channel, and allows a reply to an
273 incoming message with minimum stack space usage.
275 static inline void mavlink_msg_optical_flow_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance, float flow_rate_x, float flow_rate_y)
277 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
278 char *buf = (char *)msgbuf;
279 _mav_put_uint64_t(buf, 0, time_usec);
280 _mav_put_float(buf, 8, flow_comp_m_x);
281 _mav_put_float(buf, 12, flow_comp_m_y);
282 _mav_put_float(buf, 16, ground_distance);
283 _mav_put_int16_t(buf, 20, flow_x);
284 _mav_put_int16_t(buf, 22, flow_y);
285 _mav_put_uint8_t(buf, 24, sensor_id);
286 _mav_put_uint8_t(buf, 25, quality);
287 _mav_put_float(buf, 26, flow_rate_x);
288 _mav_put_float(buf, 30, flow_rate_y);
290 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
291 #else
292 mavlink_optical_flow_t *packet = (mavlink_optical_flow_t *)msgbuf;
293 packet->time_usec = time_usec;
294 packet->flow_comp_m_x = flow_comp_m_x;
295 packet->flow_comp_m_y = flow_comp_m_y;
296 packet->ground_distance = ground_distance;
297 packet->flow_x = flow_x;
298 packet->flow_y = flow_y;
299 packet->sensor_id = sensor_id;
300 packet->quality = quality;
301 packet->flow_rate_x = flow_rate_x;
302 packet->flow_rate_y = flow_rate_y;
304 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW, (const char *)packet, MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_CRC);
305 #endif
307 #endif
309 #endif
311 // MESSAGE OPTICAL_FLOW UNPACKING
315 * @brief Get field time_usec from optical_flow message
317 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
319 static inline uint64_t mavlink_msg_optical_flow_get_time_usec(const mavlink_message_t* msg)
321 return _MAV_RETURN_uint64_t(msg, 0);
325 * @brief Get field sensor_id from optical_flow message
327 * @return Sensor ID
329 static inline uint8_t mavlink_msg_optical_flow_get_sensor_id(const mavlink_message_t* msg)
331 return _MAV_RETURN_uint8_t(msg, 24);
335 * @brief Get field flow_x from optical_flow message
337 * @return [dpix] Flow in x-sensor direction
339 static inline int16_t mavlink_msg_optical_flow_get_flow_x(const mavlink_message_t* msg)
341 return _MAV_RETURN_int16_t(msg, 20);
345 * @brief Get field flow_y from optical_flow message
347 * @return [dpix] Flow in y-sensor direction
349 static inline int16_t mavlink_msg_optical_flow_get_flow_y(const mavlink_message_t* msg)
351 return _MAV_RETURN_int16_t(msg, 22);
355 * @brief Get field flow_comp_m_x from optical_flow message
357 * @return [m/s] Flow in x-sensor direction, angular-speed compensated
359 static inline float mavlink_msg_optical_flow_get_flow_comp_m_x(const mavlink_message_t* msg)
361 return _MAV_RETURN_float(msg, 8);
365 * @brief Get field flow_comp_m_y from optical_flow message
367 * @return [m/s] Flow in y-sensor direction, angular-speed compensated
369 static inline float mavlink_msg_optical_flow_get_flow_comp_m_y(const mavlink_message_t* msg)
371 return _MAV_RETURN_float(msg, 12);
375 * @brief Get field quality from optical_flow message
377 * @return Optical flow quality / confidence. 0: bad, 255: maximum quality
379 static inline uint8_t mavlink_msg_optical_flow_get_quality(const mavlink_message_t* msg)
381 return _MAV_RETURN_uint8_t(msg, 25);
385 * @brief Get field ground_distance from optical_flow message
387 * @return [m] Ground distance. Positive value: distance known. Negative value: Unknown distance
389 static inline float mavlink_msg_optical_flow_get_ground_distance(const mavlink_message_t* msg)
391 return _MAV_RETURN_float(msg, 16);
395 * @brief Get field flow_rate_x from optical_flow message
397 * @return [rad/s] Flow rate about X axis
399 static inline float mavlink_msg_optical_flow_get_flow_rate_x(const mavlink_message_t* msg)
401 return _MAV_RETURN_float(msg, 26);
405 * @brief Get field flow_rate_y from optical_flow message
407 * @return [rad/s] Flow rate about Y axis
409 static inline float mavlink_msg_optical_flow_get_flow_rate_y(const mavlink_message_t* msg)
411 return _MAV_RETURN_float(msg, 30);
415 * @brief Decode a optical_flow message into a struct
417 * @param msg The message to decode
418 * @param optical_flow C-struct to decode the message contents into
420 static inline void mavlink_msg_optical_flow_decode(const mavlink_message_t* msg, mavlink_optical_flow_t* optical_flow)
422 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
423 optical_flow->time_usec = mavlink_msg_optical_flow_get_time_usec(msg);
424 optical_flow->flow_comp_m_x = mavlink_msg_optical_flow_get_flow_comp_m_x(msg);
425 optical_flow->flow_comp_m_y = mavlink_msg_optical_flow_get_flow_comp_m_y(msg);
426 optical_flow->ground_distance = mavlink_msg_optical_flow_get_ground_distance(msg);
427 optical_flow->flow_x = mavlink_msg_optical_flow_get_flow_x(msg);
428 optical_flow->flow_y = mavlink_msg_optical_flow_get_flow_y(msg);
429 optical_flow->sensor_id = mavlink_msg_optical_flow_get_sensor_id(msg);
430 optical_flow->quality = mavlink_msg_optical_flow_get_quality(msg);
431 optical_flow->flow_rate_x = mavlink_msg_optical_flow_get_flow_rate_x(msg);
432 optical_flow->flow_rate_y = mavlink_msg_optical_flow_get_flow_rate_y(msg);
433 #else
434 uint8_t len = msg->len < MAVLINK_MSG_ID_OPTICAL_FLOW_LEN? msg->len : MAVLINK_MSG_ID_OPTICAL_FLOW_LEN;
435 memset(optical_flow, 0, MAVLINK_MSG_ID_OPTICAL_FLOW_LEN);
436 memcpy(optical_flow, _MAV_PAYLOAD(msg), len);
437 #endif