3 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW 114
17 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN 26
18 #define MAVLINK_MSG_ID_114_LEN 26
20 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC 119
21 #define MAVLINK_MSG_ID_114_CRC 119
25 #define MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW { \
28 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_optical_flow_t, time_usec) }, \
29 { "flow_comp_m_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_optical_flow_t, flow_comp_m_x) }, \
30 { "flow_comp_m_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_optical_flow_t, flow_comp_m_y) }, \
31 { "ground_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_optical_flow_t, ground_distance) }, \
32 { "flow_x", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_hil_optical_flow_t, flow_x) }, \
33 { "flow_y", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_hil_optical_flow_t, flow_y) }, \
34 { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_hil_optical_flow_t, sensor_id) }, \
35 { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_hil_optical_flow_t, quality) }, \
56 static inline uint16_t mavlink_msg_hil_optical_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
57 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)
59 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
60 char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
61 _mav_put_uint64_t(buf, 0, time_usec);
62 _mav_put_float(buf, 8, flow_comp_m_x);
63 _mav_put_float(buf, 12, flow_comp_m_y);
64 _mav_put_float(buf, 16, ground_distance);
65 _mav_put_int16_t(buf, 20, flow_x);
66 _mav_put_int16_t(buf, 22, flow_y);
67 _mav_put_uint8_t(buf, 24, sensor_id);
68 _mav_put_uint8_t(buf, 25, quality);
70 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
85 msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
87 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
89 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
109 static inline uint16_t mavlink_msg_hil_optical_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
110 mavlink_message_t* msg,
111 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)
113 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
114 char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
115 _mav_put_uint64_t(buf, 0, time_usec);
116 _mav_put_float(buf, 8, flow_comp_m_x);
117 _mav_put_float(buf, 12, flow_comp_m_y);
118 _mav_put_float(buf, 16, ground_distance);
119 _mav_put_int16_t(buf, 20, flow_x);
120 _mav_put_int16_t(buf, 22, flow_y);
121 _mav_put_uint8_t(buf, 24, sensor_id);
122 _mav_put_uint8_t(buf, 25, quality);
124 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
136 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
139 msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
140 #if MAVLINK_CRC_EXTRA
141 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
143 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
155 static inline uint16_t mavlink_msg_hil_optical_flow_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
const mavlink_hil_optical_flow_t* hil_optical_flow)
157 return mavlink_msg_hil_optical_flow_pack(system_id, component_id, msg, hil_optical_flow->
time_usec, hil_optical_flow->
sensor_id, hil_optical_flow->
flow_x, hil_optical_flow->
flow_y, hil_optical_flow->
flow_comp_m_x, hil_optical_flow->
flow_comp_m_y, hil_optical_flow->
quality, hil_optical_flow->
ground_distance);
169 static inline uint16_t mavlink_msg_hil_optical_flow_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg,
const mavlink_hil_optical_flow_t* hil_optical_flow)
171 return mavlink_msg_hil_optical_flow_pack_chan(system_id, component_id, chan, msg, hil_optical_flow->
time_usec, hil_optical_flow->
sensor_id, hil_optical_flow->
flow_x, hil_optical_flow->
flow_y, hil_optical_flow->
flow_comp_m_x, hil_optical_flow->
flow_comp_m_y, hil_optical_flow->
quality, hil_optical_flow->
ground_distance);
187 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
189 static inline void mavlink_msg_hil_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)
191 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
192 char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
193 _mav_put_uint64_t(buf, 0, time_usec);
194 _mav_put_float(buf, 8, flow_comp_m_x);
195 _mav_put_float(buf, 12, flow_comp_m_y);
196 _mav_put_float(buf, 16, ground_distance);
197 _mav_put_int16_t(buf, 20, flow_x);
198 _mav_put_int16_t(buf, 22, flow_y);
199 _mav_put_uint8_t(buf, 24, sensor_id);
200 _mav_put_uint8_t(buf, 25, quality);
202 #if MAVLINK_CRC_EXTRA
203 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
205 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
218 #if MAVLINK_CRC_EXTRA
219 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (
const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
221 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (
const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
226 #if MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
234 static inline void mavlink_msg_hil_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)
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 char *buf = (
char *)msgbuf;
238 _mav_put_uint64_t(buf, 0, time_usec);
239 _mav_put_float(buf, 8, flow_comp_m_x);
240 _mav_put_float(buf, 12, flow_comp_m_y);
241 _mav_put_float(buf, 16, ground_distance);
242 _mav_put_int16_t(buf, 20, flow_x);
243 _mav_put_int16_t(buf, 22, flow_y);
244 _mav_put_uint8_t(buf, 24, sensor_id);
245 _mav_put_uint8_t(buf, 25, quality);
247 #if MAVLINK_CRC_EXTRA
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
250 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
263 #if MAVLINK_CRC_EXTRA
264 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (
const char *)packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
266 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (
const char *)packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
282 static inline uint64_t mavlink_msg_hil_optical_flow_get_time_usec(
const mavlink_message_t* msg)
284 return _MAV_RETURN_uint64_t(msg, 0);
292 static inline uint8_t mavlink_msg_hil_optical_flow_get_sensor_id(
const mavlink_message_t* msg)
294 return _MAV_RETURN_uint8_t(msg, 24);
302 static inline int16_t mavlink_msg_hil_optical_flow_get_flow_x(
const mavlink_message_t* msg)
304 return _MAV_RETURN_int16_t(msg, 20);
312 static inline int16_t mavlink_msg_hil_optical_flow_get_flow_y(
const mavlink_message_t* msg)
314 return _MAV_RETURN_int16_t(msg, 22);
322 static inline float mavlink_msg_hil_optical_flow_get_flow_comp_m_x(
const mavlink_message_t* msg)
324 return _MAV_RETURN_float(msg, 8);
332 static inline float mavlink_msg_hil_optical_flow_get_flow_comp_m_y(
const mavlink_message_t* msg)
334 return _MAV_RETURN_float(msg, 12);
342 static inline uint8_t mavlink_msg_hil_optical_flow_get_quality(
const mavlink_message_t* msg)
344 return _MAV_RETURN_uint8_t(msg, 25);
352 static inline float mavlink_msg_hil_optical_flow_get_ground_distance(
const mavlink_message_t* msg)
354 return _MAV_RETURN_float(msg, 16);
363 static inline void mavlink_msg_hil_optical_flow_decode(
const mavlink_message_t* msg,
mavlink_hil_optical_flow_t* hil_optical_flow)
365 #if MAVLINK_NEED_BYTE_SWAP
366 hil_optical_flow->
time_usec = mavlink_msg_hil_optical_flow_get_time_usec(msg);
367 hil_optical_flow->
flow_comp_m_x = mavlink_msg_hil_optical_flow_get_flow_comp_m_x(msg);
368 hil_optical_flow->
flow_comp_m_y = mavlink_msg_hil_optical_flow_get_flow_comp_m_y(msg);
369 hil_optical_flow->
ground_distance = mavlink_msg_hil_optical_flow_get_ground_distance(msg);
370 hil_optical_flow->
flow_x = mavlink_msg_hil_optical_flow_get_flow_x(msg);
371 hil_optical_flow->
flow_y = mavlink_msg_hil_optical_flow_get_flow_y(msg);
372 hil_optical_flow->
sensor_id = mavlink_msg_hil_optical_flow_get_sensor_id(msg);
373 hil_optical_flow->
quality = mavlink_msg_hil_optical_flow_get_quality(msg);
375 memcpy(hil_optical_flow, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
int16_t flow_x
Flow in pixels in x-sensor direction.
Definition: mavlink_msg_hil_optical_flow.h:11
int16_t flow_y
Flow in pixels in y-sensor direction.
Definition: mavlink_msg_hil_optical_flow.h:12
Definition: mavlink_msg_hil_optical_flow.h:5
float flow_comp_m_x
Flow in meters in x-sensor direction, angular-speed compensated.
Definition: mavlink_msg_hil_optical_flow.h:8
float ground_distance
Ground distance in meters. Positive value: distance known. Negative value: Unknown distance...
Definition: mavlink_msg_hil_optical_flow.h:10
uint64_t time_usec
Timestamp (UNIX)
Definition: mavlink_msg_hil_optical_flow.h:7
float flow_comp_m_y
Flow in meters in y-sensor direction, angular-speed compensated.
Definition: mavlink_msg_hil_optical_flow.h:9
uint8_t quality
Optical flow quality / confidence. 0: bad, 255: maximum quality.
Definition: mavlink_msg_hil_optical_flow.h:14
uint8_t sensor_id
Sensor ID.
Definition: mavlink_msg_hil_optical_flow.h:13