mavlink_msg_hil_optical_flow.h
Go to the documentation of this file.
00001 // MESSAGE HIL_OPTICAL_FLOW PACKING
00002 
00003 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW 114
00004 
00005 typedef struct __mavlink_hil_optical_flow_t
00006 {
00007  uint64_t time_usec; /*< Timestamp (microseconds, synced to UNIX time or since system boot)*/
00008  uint32_t integration_time_us; /*< Integration time in microseconds. Divide integrated_x and integrated_y by the integration time to obtain average flow. The integration time also indicates the.*/
00009  float integrated_x; /*< Flow in radians 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.)*/
00010  float integrated_y; /*< Flow in radians 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.)*/
00011  float integrated_xgyro; /*< RH rotation around X axis (rad)*/
00012  float integrated_ygyro; /*< RH rotation around Y axis (rad)*/
00013  float integrated_zgyro; /*< RH rotation around Z axis (rad)*/
00014  uint32_t time_delta_distance_us; /*< Time in microseconds since the distance was sampled.*/
00015  float distance; /*< Distance to the center of the flow field in meters. Positive value (including zero): distance known. Negative value: Unknown distance.*/
00016  int16_t temperature; /*< Temperature * 100 in centi-degrees Celsius*/
00017  uint8_t sensor_id; /*< Sensor ID*/
00018  uint8_t quality; /*< Optical flow quality / confidence. 0: no valid flow, 255: maximum quality*/
00019 } mavlink_hil_optical_flow_t;
00020 
00021 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN 44
00022 #define MAVLINK_MSG_ID_114_LEN 44
00023 
00024 #define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC 237
00025 #define MAVLINK_MSG_ID_114_CRC 237
00026 
00027 
00028 
00029 #define MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW { \
00030         "HIL_OPTICAL_FLOW", \
00031         12, \
00032         {  { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_optical_flow_t, time_usec) }, \
00033          { "integration_time_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_hil_optical_flow_t, integration_time_us) }, \
00034          { "integrated_x", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_optical_flow_t, integrated_x) }, \
00035          { "integrated_y", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_optical_flow_t, integrated_y) }, \
00036          { "integrated_xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_optical_flow_t, integrated_xgyro) }, \
00037          { "integrated_ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_optical_flow_t, integrated_ygyro) }, \
00038          { "integrated_zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_optical_flow_t, integrated_zgyro) }, \
00039          { "time_delta_distance_us", NULL, MAVLINK_TYPE_UINT32_T, 0, 32, offsetof(mavlink_hil_optical_flow_t, time_delta_distance_us) }, \
00040          { "distance", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_optical_flow_t, distance) }, \
00041          { "temperature", NULL, MAVLINK_TYPE_INT16_T, 0, 40, offsetof(mavlink_hil_optical_flow_t, temperature) }, \
00042          { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 42, offsetof(mavlink_hil_optical_flow_t, sensor_id) }, \
00043          { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 43, offsetof(mavlink_hil_optical_flow_t, quality) }, \
00044          } \
00045 }
00046 
00047 
00068 static inline uint16_t mavlink_msg_hil_optical_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
00069                                                        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)
00070 {
00071 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00072         char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
00073         _mav_put_uint64_t(buf, 0, time_usec);
00074         _mav_put_uint32_t(buf, 8, integration_time_us);
00075         _mav_put_float(buf, 12, integrated_x);
00076         _mav_put_float(buf, 16, integrated_y);
00077         _mav_put_float(buf, 20, integrated_xgyro);
00078         _mav_put_float(buf, 24, integrated_ygyro);
00079         _mav_put_float(buf, 28, integrated_zgyro);
00080         _mav_put_uint32_t(buf, 32, time_delta_distance_us);
00081         _mav_put_float(buf, 36, distance);
00082         _mav_put_int16_t(buf, 40, temperature);
00083         _mav_put_uint8_t(buf, 42, sensor_id);
00084         _mav_put_uint8_t(buf, 43, quality);
00085 
00086         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00087 #else
00088         mavlink_hil_optical_flow_t packet;
00089         packet.time_usec = time_usec;
00090         packet.integration_time_us = integration_time_us;
00091         packet.integrated_x = integrated_x;
00092         packet.integrated_y = integrated_y;
00093         packet.integrated_xgyro = integrated_xgyro;
00094         packet.integrated_ygyro = integrated_ygyro;
00095         packet.integrated_zgyro = integrated_zgyro;
00096         packet.time_delta_distance_us = time_delta_distance_us;
00097         packet.distance = distance;
00098         packet.temperature = temperature;
00099         packet.sensor_id = sensor_id;
00100         packet.quality = quality;
00101 
00102         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00103 #endif
00104 
00105         msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
00106 #if MAVLINK_CRC_EXTRA
00107     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC);
00108 #else
00109     return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00110 #endif
00111 }
00112 
00133 static inline uint16_t mavlink_msg_hil_optical_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
00134                                                            mavlink_message_t* msg,
00135                                                            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)
00136 {
00137 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00138         char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
00139         _mav_put_uint64_t(buf, 0, time_usec);
00140         _mav_put_uint32_t(buf, 8, integration_time_us);
00141         _mav_put_float(buf, 12, integrated_x);
00142         _mav_put_float(buf, 16, integrated_y);
00143         _mav_put_float(buf, 20, integrated_xgyro);
00144         _mav_put_float(buf, 24, integrated_ygyro);
00145         _mav_put_float(buf, 28, integrated_zgyro);
00146         _mav_put_uint32_t(buf, 32, time_delta_distance_us);
00147         _mav_put_float(buf, 36, distance);
00148         _mav_put_int16_t(buf, 40, temperature);
00149         _mav_put_uint8_t(buf, 42, sensor_id);
00150         _mav_put_uint8_t(buf, 43, quality);
00151 
00152         memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00153 #else
00154         mavlink_hil_optical_flow_t packet;
00155         packet.time_usec = time_usec;
00156         packet.integration_time_us = integration_time_us;
00157         packet.integrated_x = integrated_x;
00158         packet.integrated_y = integrated_y;
00159         packet.integrated_xgyro = integrated_xgyro;
00160         packet.integrated_ygyro = integrated_ygyro;
00161         packet.integrated_zgyro = integrated_zgyro;
00162         packet.time_delta_distance_us = time_delta_distance_us;
00163         packet.distance = distance;
00164         packet.temperature = temperature;
00165         packet.sensor_id = sensor_id;
00166         packet.quality = quality;
00167 
00168         memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00169 #endif
00170 
00171         msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW;
00172 #if MAVLINK_CRC_EXTRA
00173     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);
00174 #else
00175     return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00176 #endif
00177 }
00178 
00187 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)
00188 {
00189         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->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance);
00190 }
00191 
00201 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)
00202 {
00203         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->integration_time_us, hil_optical_flow->integrated_x, hil_optical_flow->integrated_y, hil_optical_flow->integrated_xgyro, hil_optical_flow->integrated_ygyro, hil_optical_flow->integrated_zgyro, hil_optical_flow->temperature, hil_optical_flow->quality, hil_optical_flow->time_delta_distance_us, hil_optical_flow->distance);
00204 }
00205 
00223 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
00224 
00225 static inline void mavlink_msg_hil_optical_flow_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)
00226 {
00227 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00228         char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN];
00229         _mav_put_uint64_t(buf, 0, time_usec);
00230         _mav_put_uint32_t(buf, 8, integration_time_us);
00231         _mav_put_float(buf, 12, integrated_x);
00232         _mav_put_float(buf, 16, integrated_y);
00233         _mav_put_float(buf, 20, integrated_xgyro);
00234         _mav_put_float(buf, 24, integrated_ygyro);
00235         _mav_put_float(buf, 28, integrated_zgyro);
00236         _mav_put_uint32_t(buf, 32, time_delta_distance_us);
00237         _mav_put_float(buf, 36, distance);
00238         _mav_put_int16_t(buf, 40, temperature);
00239         _mav_put_uint8_t(buf, 42, sensor_id);
00240         _mav_put_uint8_t(buf, 43, quality);
00241 
00242 #if MAVLINK_CRC_EXTRA
00243     _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);
00244 #else
00245     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00246 #endif
00247 #else
00248         mavlink_hil_optical_flow_t packet;
00249         packet.time_usec = time_usec;
00250         packet.integration_time_us = integration_time_us;
00251         packet.integrated_x = integrated_x;
00252         packet.integrated_y = integrated_y;
00253         packet.integrated_xgyro = integrated_xgyro;
00254         packet.integrated_ygyro = integrated_ygyro;
00255         packet.integrated_zgyro = integrated_zgyro;
00256         packet.time_delta_distance_us = time_delta_distance_us;
00257         packet.distance = distance;
00258         packet.temperature = temperature;
00259         packet.sensor_id = sensor_id;
00260         packet.quality = quality;
00261 
00262 #if MAVLINK_CRC_EXTRA
00263     _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);
00264 #else
00265     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00266 #endif
00267 #endif
00268 }
00269 
00270 #if MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
00271 /*
00272   This varient of _send() can be used to save stack space by re-using
00273   memory from the receive buffer.  The caller provides a
00274   mavlink_message_t which is the size of a full mavlink message. This
00275   is usually the receive buffer for the channel, and allows a reply to an
00276   incoming message with minimum stack space usage.
00277  */
00278 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, 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)
00279 {
00280 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
00281         char *buf = (char *)msgbuf;
00282         _mav_put_uint64_t(buf, 0, time_usec);
00283         _mav_put_uint32_t(buf, 8, integration_time_us);
00284         _mav_put_float(buf, 12, integrated_x);
00285         _mav_put_float(buf, 16, integrated_y);
00286         _mav_put_float(buf, 20, integrated_xgyro);
00287         _mav_put_float(buf, 24, integrated_ygyro);
00288         _mav_put_float(buf, 28, integrated_zgyro);
00289         _mav_put_uint32_t(buf, 32, time_delta_distance_us);
00290         _mav_put_float(buf, 36, distance);
00291         _mav_put_int16_t(buf, 40, temperature);
00292         _mav_put_uint8_t(buf, 42, sensor_id);
00293         _mav_put_uint8_t(buf, 43, quality);
00294 
00295 #if MAVLINK_CRC_EXTRA
00296     _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);
00297 #else
00298     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00299 #endif
00300 #else
00301         mavlink_hil_optical_flow_t *packet = (mavlink_hil_optical_flow_t *)msgbuf;
00302         packet->time_usec = time_usec;
00303         packet->integration_time_us = integration_time_us;
00304         packet->integrated_x = integrated_x;
00305         packet->integrated_y = integrated_y;
00306         packet->integrated_xgyro = integrated_xgyro;
00307         packet->integrated_ygyro = integrated_ygyro;
00308         packet->integrated_zgyro = integrated_zgyro;
00309         packet->time_delta_distance_us = time_delta_distance_us;
00310         packet->distance = distance;
00311         packet->temperature = temperature;
00312         packet->sensor_id = sensor_id;
00313         packet->quality = quality;
00314 
00315 #if MAVLINK_CRC_EXTRA
00316     _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);
00317 #else
00318     _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00319 #endif
00320 #endif
00321 }
00322 #endif
00323 
00324 #endif
00325 
00326 // MESSAGE HIL_OPTICAL_FLOW UNPACKING
00327 
00328 
00334 static inline uint64_t mavlink_msg_hil_optical_flow_get_time_usec(const mavlink_message_t* msg)
00335 {
00336         return _MAV_RETURN_uint64_t(msg,  0);
00337 }
00338 
00344 static inline uint8_t mavlink_msg_hil_optical_flow_get_sensor_id(const mavlink_message_t* msg)
00345 {
00346         return _MAV_RETURN_uint8_t(msg,  42);
00347 }
00348 
00354 static inline uint32_t mavlink_msg_hil_optical_flow_get_integration_time_us(const mavlink_message_t* msg)
00355 {
00356         return _MAV_RETURN_uint32_t(msg,  8);
00357 }
00358 
00364 static inline float mavlink_msg_hil_optical_flow_get_integrated_x(const mavlink_message_t* msg)
00365 {
00366         return _MAV_RETURN_float(msg,  12);
00367 }
00368 
00374 static inline float mavlink_msg_hil_optical_flow_get_integrated_y(const mavlink_message_t* msg)
00375 {
00376         return _MAV_RETURN_float(msg,  16);
00377 }
00378 
00384 static inline float mavlink_msg_hil_optical_flow_get_integrated_xgyro(const mavlink_message_t* msg)
00385 {
00386         return _MAV_RETURN_float(msg,  20);
00387 }
00388 
00394 static inline float mavlink_msg_hil_optical_flow_get_integrated_ygyro(const mavlink_message_t* msg)
00395 {
00396         return _MAV_RETURN_float(msg,  24);
00397 }
00398 
00404 static inline float mavlink_msg_hil_optical_flow_get_integrated_zgyro(const mavlink_message_t* msg)
00405 {
00406         return _MAV_RETURN_float(msg,  28);
00407 }
00408 
00414 static inline int16_t mavlink_msg_hil_optical_flow_get_temperature(const mavlink_message_t* msg)
00415 {
00416         return _MAV_RETURN_int16_t(msg,  40);
00417 }
00418 
00424 static inline uint8_t mavlink_msg_hil_optical_flow_get_quality(const mavlink_message_t* msg)
00425 {
00426         return _MAV_RETURN_uint8_t(msg,  43);
00427 }
00428 
00434 static inline uint32_t mavlink_msg_hil_optical_flow_get_time_delta_distance_us(const mavlink_message_t* msg)
00435 {
00436         return _MAV_RETURN_uint32_t(msg,  32);
00437 }
00438 
00444 static inline float mavlink_msg_hil_optical_flow_get_distance(const mavlink_message_t* msg)
00445 {
00446         return _MAV_RETURN_float(msg,  36);
00447 }
00448 
00455 static inline void mavlink_msg_hil_optical_flow_decode(const mavlink_message_t* msg, mavlink_hil_optical_flow_t* hil_optical_flow)
00456 {
00457 #if MAVLINK_NEED_BYTE_SWAP
00458         hil_optical_flow->time_usec = mavlink_msg_hil_optical_flow_get_time_usec(msg);
00459         hil_optical_flow->integration_time_us = mavlink_msg_hil_optical_flow_get_integration_time_us(msg);
00460         hil_optical_flow->integrated_x = mavlink_msg_hil_optical_flow_get_integrated_x(msg);
00461         hil_optical_flow->integrated_y = mavlink_msg_hil_optical_flow_get_integrated_y(msg);
00462         hil_optical_flow->integrated_xgyro = mavlink_msg_hil_optical_flow_get_integrated_xgyro(msg);
00463         hil_optical_flow->integrated_ygyro = mavlink_msg_hil_optical_flow_get_integrated_ygyro(msg);
00464         hil_optical_flow->integrated_zgyro = mavlink_msg_hil_optical_flow_get_integrated_zgyro(msg);
00465         hil_optical_flow->time_delta_distance_us = mavlink_msg_hil_optical_flow_get_time_delta_distance_us(msg);
00466         hil_optical_flow->distance = mavlink_msg_hil_optical_flow_get_distance(msg);
00467         hil_optical_flow->temperature = mavlink_msg_hil_optical_flow_get_temperature(msg);
00468         hil_optical_flow->sensor_id = mavlink_msg_hil_optical_flow_get_sensor_id(msg);
00469         hil_optical_flow->quality = mavlink_msg_hil_optical_flow_get_quality(msg);
00470 #else
00471         memcpy(hil_optical_flow, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN);
00472 #endif
00473 }


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:35