Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ardupilot
GitHub Repository: ardupilot/ardupilot
Path: blob/master/ArduPlane/avoidance_adsb.h
2981 views
1
#pragma once
2
3
#include <AP_Avoidance/AP_Avoidance.h>
4
5
#if AP_ADSB_AVOIDANCE_ENABLED
6
7
// Provide Plane-specific implementation of avoidance. While most of
8
// the logic for doing the actual avoidance is present in
9
// AP_Avoidance, this class allows Plane to override base
10
// functionality - for example, not doing anything while landed.
11
class AP_Avoidance_Plane : public AP_Avoidance {
12
public:
13
14
using AP_Avoidance::AP_Avoidance;
15
16
/* Do not allow copies */
17
CLASS_NO_COPY(AP_Avoidance_Plane);
18
19
protected:
20
// override avoidance handler
21
MAV_COLLISION_ACTION handle_avoidance(const AP_Avoidance::Obstacle *obstacle, MAV_COLLISION_ACTION requested_action) override;
22
23
// override recovery handler
24
void handle_recovery(RecoveryAction recovery_action) override;
25
26
// check flight mode is avoid_adsb
27
bool check_flightmode(bool allow_mode_change);
28
29
// vertical avoidance handler
30
bool handle_avoidance_vertical(const AP_Avoidance::Obstacle *obstacle, bool allow_mode_change, Location &new_loc);
31
32
// horizontal avoidance handler
33
bool handle_avoidance_horizontal(const AP_Avoidance::Obstacle *obstacle, bool allow_mode_change, Location &new_loc);
34
35
// control mode before avoidance began
36
enum Mode::Number prev_control_mode_number = Mode::Number::RTL;
37
};
38
39
#endif // AP_ADSB_AVOIDANCE_ENABLED
40
41