2016-08-12 18:28:21 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_Avoidance/AP_Avoidance.h>
|
|
|
|
|
|
|
|
// Provide Plane-specific implementation of avoidance. While most of
|
|
|
|
// the logic for doing the actual avoidance is present in
|
|
|
|
// AP_Avoidance, this class allows Plane to override base
|
|
|
|
// functionality - for example, not doing anything while landed.
|
|
|
|
class AP_Avoidance_Plane : public AP_Avoidance {
|
|
|
|
public:
|
2019-07-09 03:05:51 -03:00
|
|
|
|
|
|
|
using AP_Avoidance::AP_Avoidance;
|
2017-09-18 22:39:00 -03:00
|
|
|
|
|
|
|
/* Do not allow copies */
|
2022-09-30 06:50:43 -03:00
|
|
|
CLASS_NO_COPY(AP_Avoidance_Plane);
|
2016-08-12 18:28:21 -03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// override avoidance handler
|
|
|
|
MAV_COLLISION_ACTION handle_avoidance(const AP_Avoidance::Obstacle *obstacle, MAV_COLLISION_ACTION requested_action) override;
|
|
|
|
|
|
|
|
// override recovery handler
|
2020-08-15 23:12:53 -03:00
|
|
|
void handle_recovery(RecoveryAction recovery_action) override;
|
2016-08-12 18:28:21 -03:00
|
|
|
|
|
|
|
// check flight mode is avoid_adsb
|
|
|
|
bool check_flightmode(bool allow_mode_change);
|
|
|
|
|
|
|
|
// vertical avoidance handler
|
2022-02-09 19:44:58 -04:00
|
|
|
bool handle_avoidance_vertical(const AP_Avoidance::Obstacle *obstacle, bool allow_mode_change, Location &new_loc);
|
2016-08-12 18:28:21 -03:00
|
|
|
|
|
|
|
// horizontal avoidance handler
|
2022-02-09 19:44:58 -04:00
|
|
|
bool handle_avoidance_horizontal(const AP_Avoidance::Obstacle *obstacle, bool allow_mode_change, Location &new_loc);
|
2016-08-12 18:28:21 -03:00
|
|
|
|
|
|
|
// control mode before avoidance began
|
2019-01-15 13:46:13 -04:00
|
|
|
enum Mode::Number prev_control_mode_number = Mode::Number::RTL;
|
2016-08-12 18:28:21 -03:00
|
|
|
};
|