Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_optical_flow_rad.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE OPTICAL_FLOW_RAD PACKING
3
4#define MAVLINK_MSG_ID_OPTICAL_FLOW_RAD 106
5
6
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 uint32_t integration_time_us; /*< [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.*/
10 float integrated_x; /*< [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)*/
11 float integrated_y; /*< [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)*/
12 float integrated_xgyro; /*< [rad] RH rotation around X axis*/
13 float integrated_ygyro; /*< [rad] RH rotation around Y axis*/
14 float integrated_zgyro; /*< [rad] RH rotation around Z axis*/
15 uint32_t time_delta_distance_us; /*< [us] Time since the distance was sampled.*/
16 float distance; /*< [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.*/
17 int16_t temperature; /*< [cdegC] Temperature*/
18 uint8_t sensor_id; /*< Sensor ID*/
19 uint8_t quality; /*< Optical flow quality / confidence. 0: no valid flow, 255: maximum quality*/
20} mavlink_optical_flow_rad_t;
21
22#define MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN 44
23#define MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN 44
24#define MAVLINK_MSG_ID_106_LEN 44
25#define MAVLINK_MSG_ID_106_MIN_LEN 44
26
27#define MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC 138
28#define MAVLINK_MSG_ID_106_CRC 138
29
30
31
32#if MAVLINK_COMMAND_24BIT
33#define MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD {
34 106,
35 "OPTICAL_FLOW_RAD",
36 12,
37 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_optical_flow_rad_t, time_usec) },
38 { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_optical_flow_rad_t, sensor_id) },
39 { "integration_time_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_optical_flow_rad_t, integration_time_us) },
40 { "integrated_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_optical_flow_rad_t, integrated_x) },
41 { "integrated_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_optical_flow_rad_t, integrated_y) },
42 { "integrated_xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_optical_flow_rad_t, integrated_xgyro) },
43 { "integrated_ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_optical_flow_rad_t, integrated_ygyro) },
44 { "integrated_zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_optical_flow_rad_t, integrated_zgyro) },
45 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_optical_flow_rad_t, temperature) },
46 { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_optical_flow_rad_t, quality) },
47 { "time_delta_distance_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_optical_flow_rad_t, time_delta_distance_us) },
48 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_optical_flow_rad_t, distance) },
49 } \
50}
51#else
52#define MAVLINK_MESSAGE_INFO_OPTICAL_FLOW_RAD {
53 "OPTICAL_FLOW_RAD",
54 12,
55 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_optical_flow_rad_t, time_usec) },
56 { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_optical_flow_rad_t, sensor_id) },
57 { "integration_time_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_optical_flow_rad_t, integration_time_us) },
58 { "integrated_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_optical_flow_rad_t, integrated_x) },
59 { "integrated_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_optical_flow_rad_t, integrated_y) },
60 { "integrated_xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_optical_flow_rad_t, integrated_xgyro) },
61 { "integrated_ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_optical_flow_rad_t, integrated_ygyro) },
62 { "integrated_zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_optical_flow_rad_t, integrated_zgyro) },
63 { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_optical_flow_rad_t, temperature) },
64 { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_optical_flow_rad_t, quality) },
65 { "time_delta_distance_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_optical_flow_rad_t, time_delta_distance_us) },
66 { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_optical_flow_rad_t, distance) },
67 } \
68}
69#endif
70
71/**
72 * @brief Pack a optical_flow_rad message
73 * @param system_id ID of this system
74 * @param component_id ID of this component (e.g. 200 for IMU)
75 * @param msg The MAVLink message to compress the data into
76 *
77 * @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.
78 * @param sensor_id Sensor ID
79 * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
80 * @param integrated_x [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)
81 * @param integrated_y [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)
82 * @param integrated_xgyro [rad] RH rotation around X axis
83 * @param integrated_ygyro [rad] RH rotation around Y axis
84 * @param integrated_zgyro [rad] RH rotation around Z axis
85 * @param temperature [cdegC] Temperature
86 * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
87 * @param time_delta_distance_us [us] Time since the distance was sampled.
88 * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.
89 * @return length of the message in bytes (excluding serial stream start sign)
90 */
91static inline uint16_t mavlink_msg_optical_flow_rad_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
92 uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
93{
94#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
96 _mav_put_uint64_t(buf, 0, time_usec);
97 _mav_put_uint32_t(buf, 8, integration_time_us);
98 _mav_put_float(buf, 12, integrated_x);
99 _mav_put_float(buf, 16, integrated_y);
100 _mav_put_float(buf, 20, integrated_xgyro);
101 _mav_put_float(buf, 24, integrated_ygyro);
102 _mav_put_float(buf, 28, integrated_zgyro);
103 _mav_put_uint32_t(buf, 32, time_delta_distance_us);
104 _mav_put_float(buf, 36, distance);
105 _mav_put_int16_t(buf, 40, temperature);
106 _mav_put_uint8_t(buf, 42, sensor_id);
107 _mav_put_uint8_t(buf, 43, quality);
108
109 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
110#else
111 mavlink_optical_flow_rad_t packet;
112 packet.time_usec = time_usec;
113 packet.integration_time_us = integration_time_us;
114 packet.integrated_x = integrated_x;
115 packet.integrated_y = integrated_y;
116 packet.integrated_xgyro = integrated_xgyro;
117 packet.integrated_ygyro = integrated_ygyro;
118 packet.integrated_zgyro = integrated_zgyro;
119 packet.time_delta_distance_us = time_delta_distance_us;
120 packet.distance = distance;
121 packet.temperature = temperature;
122 packet.sensor_id = sensor_id;
123 packet.quality = quality;
124
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
126#endif
127
129 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
130}
131
132/**
133 * @brief Pack a optical_flow_rad message
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param status MAVLink status structure
137 * @param msg The MAVLink message to compress the data into
138 *
139 * @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.
140 * @param sensor_id Sensor ID
141 * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
142 * @param integrated_x [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)
143 * @param integrated_y [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)
144 * @param integrated_xgyro [rad] RH rotation around X axis
145 * @param integrated_ygyro [rad] RH rotation around Y axis
146 * @param integrated_zgyro [rad] RH rotation around Z axis
147 * @param temperature [cdegC] Temperature
148 * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
149 * @param time_delta_distance_us [us] Time since the distance was sampled.
150 * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.
151 * @return length of the message in bytes (excluding serial stream start sign)
152 */
153static inline uint16_t mavlink_msg_optical_flow_rad_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
154 uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
155{
156#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 _mav_put_uint64_t(buf, 0, time_usec);
159 _mav_put_uint32_t(buf, 8, integration_time_us);
160 _mav_put_float(buf, 12, integrated_x);
161 _mav_put_float(buf, 16, integrated_y);
162 _mav_put_float(buf, 20, integrated_xgyro);
163 _mav_put_float(buf, 24, integrated_ygyro);
164 _mav_put_float(buf, 28, integrated_zgyro);
165 _mav_put_uint32_t(buf, 32, time_delta_distance_us);
166 _mav_put_float(buf, 36, distance);
167 _mav_put_int16_t(buf, 40, temperature);
168 _mav_put_uint8_t(buf, 42, sensor_id);
169 _mav_put_uint8_t(buf, 43, quality);
170
171 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
172#else
173 mavlink_optical_flow_rad_t packet;
174 packet.time_usec = time_usec;
175 packet.integration_time_us = integration_time_us;
176 packet.integrated_x = integrated_x;
177 packet.integrated_y = integrated_y;
178 packet.integrated_xgyro = integrated_xgyro;
179 packet.integrated_ygyro = integrated_ygyro;
180 packet.integrated_zgyro = integrated_zgyro;
181 packet.time_delta_distance_us = time_delta_distance_us;
182 packet.distance = distance;
183 packet.temperature = temperature;
184 packet.sensor_id = sensor_id;
185 packet.quality = quality;
186
187 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
188#endif
189
191#if MAVLINK_CRC_EXTRA
192 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
193#else
194 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
195#endif
196}
197
198/**
199 * @brief Pack a optical_flow_rad message on a channel
200 * @param system_id ID of this system
201 * @param component_id ID of this component (e.g. 200 for IMU)
202 * @param chan The MAVLink channel this message will be sent over
203 * @param msg The MAVLink message to compress the data into
204 * @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.
205 * @param sensor_id Sensor ID
206 * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
207 * @param integrated_x [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)
208 * @param integrated_y [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)
209 * @param integrated_xgyro [rad] RH rotation around X axis
210 * @param integrated_ygyro [rad] RH rotation around Y axis
211 * @param integrated_zgyro [rad] RH rotation around Z axis
212 * @param temperature [cdegC] Temperature
213 * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
214 * @param time_delta_distance_us [us] Time since the distance was sampled.
215 * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.
216 * @return length of the message in bytes (excluding serial stream start sign)
217 */
218static inline uint16_t mavlink_msg_optical_flow_rad_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
219 mavlink_message_t* msg,
220 uint64_t time_usec,uint8_t sensor_id,uint32_t integration_time_us,float integrated_x,float integrated_y,float integrated_xgyro,float integrated_ygyro,float integrated_zgyro,int16_t temperature,uint8_t quality,uint32_t time_delta_distance_us,float distance)
221{
222#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
224 _mav_put_uint64_t(buf, 0, time_usec);
225 _mav_put_uint32_t(buf, 8, integration_time_us);
226 _mav_put_float(buf, 12, integrated_x);
227 _mav_put_float(buf, 16, integrated_y);
228 _mav_put_float(buf, 20, integrated_xgyro);
229 _mav_put_float(buf, 24, integrated_ygyro);
230 _mav_put_float(buf, 28, integrated_zgyro);
231 _mav_put_uint32_t(buf, 32, time_delta_distance_us);
232 _mav_put_float(buf, 36, distance);
233 _mav_put_int16_t(buf, 40, temperature);
234 _mav_put_uint8_t(buf, 42, sensor_id);
235 _mav_put_uint8_t(buf, 43, quality);
236
237 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
238#else
239 mavlink_optical_flow_rad_t packet;
240 packet.time_usec = time_usec;
241 packet.integration_time_us = integration_time_us;
242 packet.integrated_x = integrated_x;
243 packet.integrated_y = integrated_y;
244 packet.integrated_xgyro = integrated_xgyro;
245 packet.integrated_ygyro = integrated_ygyro;
246 packet.integrated_zgyro = integrated_zgyro;
247 packet.time_delta_distance_us = time_delta_distance_us;
248 packet.distance = distance;
249 packet.temperature = temperature;
250 packet.sensor_id = sensor_id;
251 packet.quality = quality;
252
253 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
254#endif
255
257 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
258}
259
260/**
261 * @brief Encode a optical_flow_rad struct
262 *
263 * @param system_id ID of this system
264 * @param component_id ID of this component (e.g. 200 for IMU)
265 * @param msg The MAVLink message to compress the data into
266 * @param optical_flow_rad C-struct to read the message contents from
267 */
268static inline uint16_t mavlink_msg_optical_flow_rad_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_optical_flow_rad_t* optical_flow_rad)
269{
270 return mavlink_msg_optical_flow_rad_pack(system_id, component_id, msg, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance);
271}
272
273/**
274 * @brief Encode a optical_flow_rad struct on a channel
275 *
276 * @param system_id ID of this system
277 * @param component_id ID of this component (e.g. 200 for IMU)
278 * @param chan The MAVLink channel this message will be sent over
279 * @param msg The MAVLink message to compress the data into
280 * @param optical_flow_rad C-struct to read the message contents from
281 */
282static inline uint16_t mavlink_msg_optical_flow_rad_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_optical_flow_rad_t* optical_flow_rad)
283{
284 return mavlink_msg_optical_flow_rad_pack_chan(system_id, component_id, chan, msg, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance);
285}
286
287/**
288 * @brief Encode a optical_flow_rad struct with provided status structure
289 *
290 * @param system_id ID of this system
291 * @param component_id ID of this component (e.g. 200 for IMU)
292 * @param status MAVLink status structure
293 * @param msg The MAVLink message to compress the data into
294 * @param optical_flow_rad C-struct to read the message contents from
295 */
296static inline uint16_t mavlink_msg_optical_flow_rad_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_optical_flow_rad_t* optical_flow_rad)
297{
298 return mavlink_msg_optical_flow_rad_pack_status(system_id, component_id, _status, msg, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance);
299}
300
301/**
302 * @brief Send a optical_flow_rad message
303 * @param chan MAVLink channel to send the message
304 *
305 * @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.
306 * @param sensor_id Sensor ID
307 * @param integration_time_us [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
308 * @param integrated_x [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)
309 * @param integrated_y [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)
310 * @param integrated_xgyro [rad] RH rotation around X axis
311 * @param integrated_ygyro [rad] RH rotation around Y axis
312 * @param integrated_zgyro [rad] RH rotation around Z axis
313 * @param temperature [cdegC] Temperature
314 * @param quality Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
315 * @param time_delta_distance_us [us] Time since the distance was sampled.
316 * @param distance [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.
317 */
318#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
319
320static inline void mavlink_msg_optical_flow_rad_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
321{
322#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
323 char buf[MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN];
324 _mav_put_uint64_t(buf, 0, time_usec);
325 _mav_put_uint32_t(buf, 8, integration_time_us);
326 _mav_put_float(buf, 12, integrated_x);
327 _mav_put_float(buf, 16, integrated_y);
328 _mav_put_float(buf, 20, integrated_xgyro);
329 _mav_put_float(buf, 24, integrated_ygyro);
330 _mav_put_float(buf, 28, integrated_zgyro);
331 _mav_put_uint32_t(buf, 32, time_delta_distance_us);
332 _mav_put_float(buf, 36, distance);
333 _mav_put_int16_t(buf, 40, temperature);
334 _mav_put_uint8_t(buf, 42, sensor_id);
335 _mav_put_uint8_t(buf, 43, quality);
336
337 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD, buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
338#else
339 mavlink_optical_flow_rad_t packet;
340 packet.time_usec = time_usec;
341 packet.integration_time_us = integration_time_us;
342 packet.integrated_x = integrated_x;
343 packet.integrated_y = integrated_y;
344 packet.integrated_xgyro = integrated_xgyro;
345 packet.integrated_ygyro = integrated_ygyro;
346 packet.integrated_zgyro = integrated_zgyro;
347 packet.time_delta_distance_us = time_delta_distance_us;
348 packet.distance = distance;
349 packet.temperature = temperature;
350 packet.sensor_id = sensor_id;
351 packet.quality = quality;
352
353 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD, (const char *)&packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
354#endif
355}
356
357/**
358 * @brief Send a optical_flow_rad message
359 * @param chan MAVLink channel to send the message
360 * @param struct The MAVLink struct to serialize
361 */
362static inline void mavlink_msg_optical_flow_rad_send_struct(mavlink_channel_t chan, const mavlink_optical_flow_rad_t* optical_flow_rad)
363{
364#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
365 mavlink_msg_optical_flow_rad_send(chan, optical_flow_rad->time_usec, optical_flow_rad->sensor_id, optical_flow_rad->integration_time_us, optical_flow_rad->integrated_x, optical_flow_rad->integrated_y, optical_flow_rad->integrated_xgyro, optical_flow_rad->integrated_ygyro, optical_flow_rad->integrated_zgyro, optical_flow_rad->temperature, optical_flow_rad->quality, optical_flow_rad->time_delta_distance_us, optical_flow_rad->distance);
366#else
367 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD, (const char *)optical_flow_rad, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
368#endif
369}
370
371#if MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN <= MAVLINK_MAX_PAYLOAD_LEN
372/*
373 This variant of _send() can be used to save stack space by reusing
374 memory from the receive buffer. The caller provides a
375 mavlink_message_t which is the size of a full mavlink message. This
376 is usually the receive buffer for the channel, and allows a reply to an
377 incoming message with minimum stack space usage.
378 */
379static inline void mavlink_msg_optical_flow_rad_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, uint32_t integration_time_us, float integrated_x, float integrated_y, float integrated_xgyro, float integrated_ygyro, float integrated_zgyro, int16_t temperature, uint8_t quality, uint32_t time_delta_distance_us, float distance)
380{
381#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
382 char *buf = (char *)msgbuf;
383 _mav_put_uint64_t(buf, 0, time_usec);
384 _mav_put_uint32_t(buf, 8, integration_time_us);
385 _mav_put_float(buf, 12, integrated_x);
386 _mav_put_float(buf, 16, integrated_y);
387 _mav_put_float(buf, 20, integrated_xgyro);
388 _mav_put_float(buf, 24, integrated_ygyro);
389 _mav_put_float(buf, 28, integrated_zgyro);
390 _mav_put_uint32_t(buf, 32, time_delta_distance_us);
391 _mav_put_float(buf, 36, distance);
392 _mav_put_int16_t(buf, 40, temperature);
393 _mav_put_uint8_t(buf, 42, sensor_id);
394 _mav_put_uint8_t(buf, 43, quality);
395
396 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD, buf, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
397#else
398 mavlink_optical_flow_rad_t *packet = (mavlink_optical_flow_rad_t *)msgbuf;
399 packet->time_usec = time_usec;
400 packet->integration_time_us = integration_time_us;
401 packet->integrated_x = integrated_x;
402 packet->integrated_y = integrated_y;
403 packet->integrated_xgyro = integrated_xgyro;
404 packet->integrated_ygyro = integrated_ygyro;
405 packet->integrated_zgyro = integrated_zgyro;
406 packet->time_delta_distance_us = time_delta_distance_us;
407 packet->distance = distance;
408 packet->temperature = temperature;
409 packet->sensor_id = sensor_id;
410 packet->quality = quality;
411
412 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD, (const char *)packet, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_CRC);
413#endif
414}
415#endif
416
417#endif
418
419// MESSAGE OPTICAL_FLOW_RAD UNPACKING
420
421
422/**
423 * @brief Get field time_usec from optical_flow_rad message
424 *
425 * @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.
426 */
427static inline uint64_t mavlink_msg_optical_flow_rad_get_time_usec(const mavlink_message_t* msg)
428{
429 return _MAV_RETURN_uint64_t(msg, 0);
430}
431
432/**
433 * @brief Get field sensor_id from optical_flow_rad message
434 *
435 * @return Sensor ID
436 */
437static inline uint8_t mavlink_msg_optical_flow_rad_get_sensor_id(const mavlink_message_t* msg)
438{
439 return _MAV_RETURN_uint8_t(msg, 42);
440}
441
442/**
443 * @brief Get field integration_time_us from optical_flow_rad message
444 *
445 * @return [us] Integration time. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.
446 */
447static inline uint32_t mavlink_msg_optical_flow_rad_get_integration_time_us(const mavlink_message_t* msg)
448{
449 return _MAV_RETURN_uint32_t(msg, 8);
450}
451
452/**
453 * @brief Get field integrated_x from optical_flow_rad message
454 *
455 * @return [rad] Flow around X axis (Sensor RH rotation about the X axis induces a positive flow. Sensor linear motion along the positive Y axis induces a negative flow.)
456 */
457static inline float mavlink_msg_optical_flow_rad_get_integrated_x(const mavlink_message_t* msg)
458{
459 return _MAV_RETURN_float(msg, 12);
460}
461
462/**
463 * @brief Get field integrated_y from optical_flow_rad message
464 *
465 * @return [rad] Flow around Y axis (Sensor RH rotation about the Y axis induces a positive flow. Sensor linear motion along the positive X axis induces a positive flow.)
466 */
467static inline float mavlink_msg_optical_flow_rad_get_integrated_y(const mavlink_message_t* msg)
468{
469 return _MAV_RETURN_float(msg, 16);
470}
471
472/**
473 * @brief Get field integrated_xgyro from optical_flow_rad message
474 *
475 * @return [rad] RH rotation around X axis
476 */
477static inline float mavlink_msg_optical_flow_rad_get_integrated_xgyro(const mavlink_message_t* msg)
478{
479 return _MAV_RETURN_float(msg, 20);
480}
481
482/**
483 * @brief Get field integrated_ygyro from optical_flow_rad message
484 *
485 * @return [rad] RH rotation around Y axis
486 */
487static inline float mavlink_msg_optical_flow_rad_get_integrated_ygyro(const mavlink_message_t* msg)
488{
489 return _MAV_RETURN_float(msg, 24);
490}
491
492/**
493 * @brief Get field integrated_zgyro from optical_flow_rad message
494 *
495 * @return [rad] RH rotation around Z axis
496 */
497static inline float mavlink_msg_optical_flow_rad_get_integrated_zgyro(const mavlink_message_t* msg)
498{
499 return _MAV_RETURN_float(msg, 28);
500}
501
502/**
503 * @brief Get field temperature from optical_flow_rad message
504 *
505 * @return [cdegC] Temperature
506 */
507static inline int16_t mavlink_msg_optical_flow_rad_get_temperature(const mavlink_message_t* msg)
508{
509 return _MAV_RETURN_int16_t(msg, 40);
510}
511
512/**
513 * @brief Get field quality from optical_flow_rad message
514 *
515 * @return Optical flow quality / confidence. 0: no valid flow, 255: maximum quality
516 */
517static inline uint8_t mavlink_msg_optical_flow_rad_get_quality(const mavlink_message_t* msg)
518{
519 return _MAV_RETURN_uint8_t(msg, 43);
520}
521
522/**
523 * @brief Get field time_delta_distance_us from optical_flow_rad message
524 *
525 * @return [us] Time since the distance was sampled.
526 */
527static inline uint32_t mavlink_msg_optical_flow_rad_get_time_delta_distance_us(const mavlink_message_t* msg)
528{
529 return _MAV_RETURN_uint32_t(msg, 32);
530}
531
532/**
533 * @brief Get field distance from optical_flow_rad message
534 *
535 * @return [m] Distance to the center of the flow field. Positive value (including zero): distance known. Negative value: Unknown distance.
536 */
537static inline float mavlink_msg_optical_flow_rad_get_distance(const mavlink_message_t* msg)
538{
539 return _MAV_RETURN_float(msg, 36);
540}
541
542/**
543 * @brief Decode a optical_flow_rad message into a struct
544 *
545 * @param msg The message to decode
546 * @param optical_flow_rad C-struct to decode the message contents into
547 */
548static inline void mavlink_msg_optical_flow_rad_decode(const mavlink_message_t* msg, mavlink_optical_flow_rad_t* optical_flow_rad)
549{
550#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
551 optical_flow_rad->time_usec = mavlink_msg_optical_flow_rad_get_time_usec(msg);
552 optical_flow_rad->integration_time_us = mavlink_msg_optical_flow_rad_get_integration_time_us(msg);
553 optical_flow_rad->integrated_x = mavlink_msg_optical_flow_rad_get_integrated_x(msg);
554 optical_flow_rad->integrated_y = mavlink_msg_optical_flow_rad_get_integrated_y(msg);
555 optical_flow_rad->integrated_xgyro = mavlink_msg_optical_flow_rad_get_integrated_xgyro(msg);
556 optical_flow_rad->integrated_ygyro = mavlink_msg_optical_flow_rad_get_integrated_ygyro(msg);
557 optical_flow_rad->integrated_zgyro = mavlink_msg_optical_flow_rad_get_integrated_zgyro(msg);
558 optical_flow_rad->time_delta_distance_us = mavlink_msg_optical_flow_rad_get_time_delta_distance_us(msg);
559 optical_flow_rad->distance = mavlink_msg_optical_flow_rad_get_distance(msg);
560 optical_flow_rad->temperature = mavlink_msg_optical_flow_rad_get_temperature(msg);
561 optical_flow_rad->sensor_id = mavlink_msg_optical_flow_rad_get_sensor_id(msg);
562 optical_flow_rad->quality = mavlink_msg_optical_flow_rad_get_quality(msg);
563#else
564 uint8_t len = msg->len < MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN? msg->len : MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN;
565 memset(optical_flow_rad, 0, MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_LEN);
566 memcpy(optical_flow_rad, _MAV_PAYLOAD(msg), len);
567#endif
568}