mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
1c08119dd9
* remove unnecessary nullptr check, these are always called from an initialized AP_DroneCAN so if it's nullptr something has gone horrifically wrong * pass in driver index instead of repeatedly calling function to get it * simplify error handling; knowing exactly which allocation failed is not super helpful and one failing likely means subsequent ones will too, as it can only fail due to being out of memory
37 lines
863 B
C++
37 lines
863 B
C++
#pragma once
|
|
|
|
#include "AP_OpticalFlow_config.h"
|
|
|
|
#if AP_OPTICALFLOW_HEREFLOW_ENABLED
|
|
|
|
#include "AP_OpticalFlow_Backend.h"
|
|
#include <AP_DroneCAN/AP_DroneCAN.h>
|
|
|
|
class AP_OpticalFlow_HereFlow : public OpticalFlow_backend {
|
|
public:
|
|
AP_OpticalFlow_HereFlow(AP_OpticalFlow &flow);
|
|
|
|
void init() override {}
|
|
|
|
void update() override;
|
|
|
|
static bool subscribe_msgs(AP_DroneCAN* ap_dronecan);
|
|
|
|
static void handle_measurement(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const com_hex_equipment_flow_Measurement &msg);
|
|
|
|
private:
|
|
|
|
Vector2f flow_integral, rate_gyro_integral;
|
|
uint8_t surface_quality;
|
|
float integral_time;
|
|
bool new_data;
|
|
static uint8_t _node_id;
|
|
|
|
static AP_OpticalFlow_HereFlow* _driver;
|
|
static AP_DroneCAN* _ap_dronecan;
|
|
void _push_state(void);
|
|
|
|
};
|
|
|
|
#endif // AP_OPTICALFLOW_HEREFLOW_ENABLED
|