2018-10-19 22:51:51 -03:00
|
|
|
#pragma once
|
|
|
|
|
2021-12-24 01:47:21 -04:00
|
|
|
#include "AP_OpticalFlow.h"
|
|
|
|
|
|
|
|
#ifndef AP_OPTICALFLOW_HEREFLOW_ENABLED
|
|
|
|
#define AP_OPTICALFLOW_HEREFLOW_ENABLED (AP_OPTICALFLOW_ENABLED && HAL_ENABLE_LIBUAVCAN_DRIVERS)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if AP_OPTICALFLOW_HEREFLOW_ENABLED
|
2018-10-19 22:51:51 -03:00
|
|
|
|
|
|
|
#include <AP_UAVCAN/AP_UAVCAN.h>
|
|
|
|
|
|
|
|
class AP_OpticalFlow_HereFlow : public OpticalFlow_backend {
|
|
|
|
public:
|
2022-08-14 22:31:14 -03:00
|
|
|
AP_OpticalFlow_HereFlow(AP_OpticalFlow &flow);
|
2018-10-19 22:51:51 -03:00
|
|
|
|
|
|
|
void init() override {}
|
|
|
|
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
static void subscribe_msgs(AP_UAVCAN* ap_uavcan);
|
|
|
|
|
2023-01-04 08:22:18 -04:00
|
|
|
static void handle_measurement(AP_UAVCAN *ap_uavcan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg);
|
2018-10-19 22:51:51 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
Vector2f flowRate, bodyRate;
|
|
|
|
uint8_t surface_quality;
|
|
|
|
float integral_time;
|
|
|
|
bool new_data;
|
|
|
|
static uint8_t _node_id;
|
|
|
|
|
|
|
|
static AP_OpticalFlow_HereFlow* _driver;
|
|
|
|
static AP_UAVCAN* _ap_uavcan;
|
|
|
|
void _push_state(void);
|
|
|
|
|
|
|
|
};
|
2021-12-24 01:47:21 -04:00
|
|
|
|
|
|
|
#endif // AP_OPTICALFLOW_HEREFLOW_ENABLED
|