2016-11-14 00:48:38 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AP_Proximity.h"
|
2021-03-25 04:32:09 -03:00
|
|
|
|
|
|
|
#if HAL_PROXIMITY_ENABLED
|
2016-11-14 00:48:38 -04:00
|
|
|
#include "AP_Proximity_Backend.h"
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
#include <SITL/SITL.h>
|
|
|
|
#include <AC_Fence/AC_PolyFence_loader.h>
|
2019-04-05 03:11:26 -03:00
|
|
|
#include <AP_Common/Location.h>
|
2016-11-14 00:48:38 -04:00
|
|
|
|
|
|
|
class AP_Proximity_SITL : public AP_Proximity_Backend
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
AP_Proximity_SITL(AP_Proximity &_frontend, AP_Proximity::Proximity_State &_state);
|
|
|
|
|
|
|
|
// update state
|
|
|
|
void update(void) override;
|
|
|
|
|
2016-11-25 01:01:21 -04:00
|
|
|
// get maximum and minimum distances (in meters) of sensor
|
2018-11-07 07:01:30 -04:00
|
|
|
float distance_max() const override;
|
|
|
|
float distance_min() const override;
|
2016-11-25 01:01:21 -04:00
|
|
|
|
2017-01-16 02:58:14 -04:00
|
|
|
// get distance upwards in meters. returns true on success
|
2018-11-07 07:01:30 -04:00
|
|
|
bool get_upward_distance(float &distance) const override;
|
2017-01-16 02:58:14 -04:00
|
|
|
|
2016-11-14 00:48:38 -04:00
|
|
|
private:
|
2021-07-30 07:15:25 -03:00
|
|
|
SITL::SIM *sitl;
|
2017-01-16 02:58:14 -04:00
|
|
|
AP_Float *fence_alt_max;
|
2016-11-14 00:48:38 -04:00
|
|
|
Location current_loc;
|
2016-11-15 03:12:45 -04:00
|
|
|
|
|
|
|
// get distance in meters to fence in a particular direction in degrees (0 is forward, angles increase in the clockwise direction)
|
|
|
|
bool get_distance_to_fence(float angle_deg, float &distance) const;
|
|
|
|
|
2016-11-14 00:48:38 -04:00
|
|
|
};
|
|
|
|
#endif // CONFIG_HAL_BOARD
|
2021-03-25 04:32:09 -03:00
|
|
|
|
|
|
|
#endif // HAL_PROXIMITY_ENABLED
|