Line data Source code
1 : #pragma once 2 : #include "AP_RangeFinder_config.h" 3 : 4 : #if AP_RANGEFINDER_NRA24_CAN_DRIVER_ENABLED 5 : #include "AP_RangeFinder_Backend_CAN.h" 6 : 7 : class AP_RangeFinder_NRA24_CAN : public AP_RangeFinder_Backend_CAN { 8 : public: 9 0 : AP_RangeFinder_NRA24_CAN(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params) : 10 0 : AP_RangeFinder_Backend_CAN(_state, _params, AP_CAN::Protocol::RadarCAN, "nra24") 11 : { 12 0 : } 13 : 14 : void update(void) override; 15 : 16 : // handler for incoming frames 17 : bool handle_frame(AP_HAL::CANFrame &frame) override; 18 : 19 : static const struct AP_Param::GroupInfo var_info[]; 20 : 21 : protected: 22 : 23 0 : MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override { 24 0 : return MAV_DISTANCE_SENSOR_RADAR; 25 : } 26 : 27 : private: 28 : 29 0 : uint32_t get_radar_id(uint32_t id) const { return ((id & 0xF0U) >> 4U); } 30 : uint32_t last_heartbeat_ms; // last status message received from the sensor 31 : }; 32 : 33 : #endif // AP_RANGEFINDER_NRA24_CAN_DRIVER_ENABLED