ardupilot/libraries/AP_Proximity/AP_Proximity_DroneCAN.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.2 KiB
C
Raw Normal View History

2022-09-27 16:44:39 -03:00
#pragma once
#include "AP_Proximity_config.h"
2022-09-27 16:44:39 -03:00
#if AP_PROXIMITY_DRONECAN_ENABLED
2022-09-27 16:44:39 -03:00
#include "AP_Proximity_Backend.h"
2022-09-27 16:44:39 -03:00
#include <AP_DroneCAN/AP_DroneCAN.h>
2022-09-27 16:44:39 -03:00
class AP_Proximity_DroneCAN : public AP_Proximity_Backend
{
public:
// constructor
using AP_Proximity_Backend::AP_Proximity_Backend;
// update state
void update(void) override;
// get maximum and minimum distances (in meters) of sensor
float distance_max() const override;
float distance_min() const override;
2023-07-12 07:22:59 -03:00
static AP_Proximity_DroneCAN* get_dronecan_backend(AP_DroneCAN* ap_dronecan, uint8_t node_id, uint8_t address, bool create_new);
2022-09-27 16:44:39 -03:00
static bool subscribe_msgs(AP_DroneCAN* ap_dronecan);
2022-09-27 16:44:39 -03:00
static void handle_measurement(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const ardupilot_equipment_proximity_sensor_Proximity &msg);
2022-09-27 16:44:39 -03:00
private:
uint32_t _last_update_ms; // system time of last message received
AP_DroneCAN* _ap_dronecan;
2022-09-27 16:44:39 -03:00
uint8_t _node_id;
struct ObstacleItem {
float yaw_deg;
float pitch_deg;
float distance_m;
};
static ObjectBuffer_TS<ObstacleItem> items;
AP_Proximity::Status _status;
};
#endif // AP_PROXIMITY_DRONECAN_ENABLED