APM:Libraries
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AP_Avoidance Class Referenceabstract

#include <AP_Avoidance.h>

Collaboration diagram for AP_Avoidance:
[legend]

Classes

class  Obstacle
 

Public Member Functions

void add_obstacle (uint32_t obstacle_timestamp_ms, const MAV_COLLISION_SRC src, uint32_t src_id, const Location &loc, const Vector3f &vel_ned)
 
void add_obstacle (uint32_t obstacle_timestamp_ms, const MAV_COLLISION_SRC src, uint32_t src_id, const Location &loc, float cog, float hspeed, float vspeed)
 
void update ()
 
void enable ()
 
void disable ()
 
MAV_COLLISION_THREAT_LEVEL current_threat_level () const
 
void handle_msg (const mavlink_message_t &msg)
 

Static Public Attributes

static const struct AP_Param::GroupInfo var_info []
 

Protected Member Functions

 AP_Avoidance (AP_AHRS &ahrs, class AP_ADSB &adsb)
 
void handle_avoidance_local (AP_Avoidance::Obstacle *threat)
 
virtual MAV_COLLISION_ACTION handle_avoidance (const AP_Avoidance::Obstacle *obstacle, MAV_COLLISION_ACTION requested_action)=0
 
virtual void handle_recovery (uint8_t recovery_action)=0
 
void handle_threat_gcs_notify (AP_Avoidance::Obstacle *threat)
 
AP_Avoidance::Obstaclemost_serious_threat ()
 
MAV_COLLISION_ACTION mav_avoidance_action ()
 
bool get_destination_perpendicular (const AP_Avoidance::Obstacle *obstacle, Vector3f &newdest_neu, const float wp_speed_xy, const float wp_speed_z, const uint8_t _minimum_avoid_height)
 
bool get_vector_perpendicular (const AP_Avoidance::Obstacle *obstacle, Vector3f &vec_neu)
 

Static Protected Member Functions

static Vector3f perpendicular_xyz (const Location &p1, const Vector3f &v1, const Location &p2)
 
static Vector2f perpendicular_xy (const Location &p1, const Vector3f &v1, const Location &p2)
 

Protected Attributes

uint32_t _last_state_change_ms = 0
 
MAV_COLLISION_THREAT_LEVEL _threat_level = MAV_COLLISION_THREAT_LEVEL_NONE
 
uint32_t _gcs_cleared_messages_first_sent
 
const AP_AHRS_ahrs
 

Static Protected Attributes

static const uint8_t _gcs_cleared_messages_duration = 5
 

Private Member Functions

bool check_startup ()
 
void init ()
 
void deinit ()
 
uint32_t src_id_for_adsb_vehicle (AP_ADSB::adsb_vehicle_t vehicle) const
 
void check_for_threats ()
 
void update_threat_level (const Location &my_loc, const Vector3f &my_vel, AP_Avoidance::Obstacle &obstacle)
 
void get_adsb_samples ()
 
bool obstacle_is_more_serious_threat (const AP_Avoidance::Obstacle &obstacle) const
 

Private Attributes

const uint32_t MAX_OBSTACLE_AGE_MS = 5000
 
const uint8_t _low_velocity_threshold = 1
 
AP_Avoidance::Obstacle_obstacles
 
uint8_t _obstacles_allocated
 
uint8_t _obstacle_count
 
int8_t _current_most_serious_threat
 
MAV_COLLISION_ACTION _latest_action = MAV_COLLISION_ACTION_NONE
 
class AP_ADSB_adsb
 
AP_Int8 _enabled
 
AP_Int8 _obstacles_max
 
AP_Int8 _fail_action
 
AP_Int8 _fail_recovery
 
AP_Int8 _fail_time_horizon
 
AP_Int16 _fail_distance_xy
 
AP_Int16 _fail_distance_z
 
AP_Int16 _fail_altitude_minimum
 
AP_Int8 _warn_action
 
AP_Int8 _warn_time_horizon
 
AP_Float _warn_distance_xy
 
AP_Float _warn_distance_z
 

Static Private Attributes

static const uint8_t _gcs_notify_interval = 1
 

Detailed Description

Definition at line 41 of file AP_Avoidance.h.

Constructor & Destructor Documentation

◆ AP_Avoidance()

AP_Avoidance::AP_Avoidance ( AP_AHRS ahrs,
class AP_ADSB adsb 
)
protected

Definition at line 128 of file AP_Avoidance.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ add_obstacle() [1/2]

void AP_Avoidance::add_obstacle ( uint32_t  obstacle_timestamp_ms,
const MAV_COLLISION_SRC  src,
uint32_t  src_id,
const Location loc,
const Vector3f vel_ned 
)

Definition at line 190 of file AP_Avoidance.cpp.

Referenced by add_obstacle(), get_adsb_samples(), and handle_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_obstacle() [2/2]

void AP_Avoidance::add_obstacle ( uint32_t  obstacle_timestamp_ms,
const MAV_COLLISION_SRC  src,
uint32_t  src_id,
const Location loc,
float  cog,
float  hspeed,
float  vspeed 
)

Definition at line 237 of file AP_Avoidance.cpp.

Here is the call graph for this function:

◆ check_for_threats()

void AP_Avoidance::check_for_threats ( )
private

Definition at line 435 of file AP_Avoidance.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_startup()

bool AP_Avoidance::check_startup ( )
private

Definition at line 174 of file AP_Avoidance.cpp.

Referenced by add_obstacle(), handle_msg(), and update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ current_threat_level()

MAV_COLLISION_THREAT_LEVEL AP_Avoidance::current_threat_level ( ) const

Definition at line 382 of file AP_Avoidance.cpp.

Referenced by disable().

Here is the caller graph for this function:

◆ deinit()

void AP_Avoidance::deinit ( void  )
private

Definition at line 163 of file AP_Avoidance.cpp.

Referenced by check_startup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disable()

void AP_Avoidance::disable ( )
inline

Definition at line 83 of file AP_Avoidance.h.

Here is the call graph for this function:

◆ enable()

void AP_Avoidance::enable ( )
inline

Definition at line 82 of file AP_Avoidance.h.

◆ get_adsb_samples()

void AP_Avoidance::get_adsb_samples ( )
private

Definition at line 259 of file AP_Avoidance.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_destination_perpendicular()

bool AP_Avoidance::get_destination_perpendicular ( const AP_Avoidance::Obstacle obstacle,
Vector3f newdest_neu,
const float  wp_speed_xy,
const float  wp_speed_z,
const uint8_t  _minimum_avoid_height 
)
protected

Referenced by mav_avoidance_action().

Here is the caller graph for this function:

◆ get_vector_perpendicular()

bool AP_Avoidance::get_vector_perpendicular ( const AP_Avoidance::Obstacle obstacle,
Vector3f vec_neu 
)
protected

Definition at line 590 of file AP_Avoidance.cpp.

Referenced by mav_avoidance_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_avoidance()

virtual MAV_COLLISION_ACTION AP_Avoidance::handle_avoidance ( const AP_Avoidance::Obstacle obstacle,
MAV_COLLISION_ACTION  requested_action 
)
protectedpure virtual

Referenced by handle_avoidance_local().

Here is the caller graph for this function:

◆ handle_avoidance_local()

void AP_Avoidance::handle_avoidance_local ( AP_Avoidance::Obstacle threat)
protected

Definition at line 512 of file AP_Avoidance.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_msg()

void AP_Avoidance::handle_msg ( const mavlink_message_t &  msg)

Definition at line 554 of file AP_Avoidance.cpp.

Referenced by disable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_recovery()

virtual void AP_Avoidance::handle_recovery ( uint8_t  recovery_action)
protectedpure virtual

Referenced by deinit(), and handle_avoidance_local().

Here is the caller graph for this function:

◆ handle_threat_gcs_notify()

void AP_Avoidance::handle_threat_gcs_notify ( AP_Avoidance::Obstacle threat)
protected

Definition at line 392 of file AP_Avoidance.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void AP_Avoidance::init ( void  )
private

Definition at line 138 of file AP_Avoidance.cpp.

Referenced by check_startup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mav_avoidance_action()

MAV_COLLISION_ACTION AP_Avoidance::mav_avoidance_action ( )
inlineprotected

Definition at line 123 of file AP_Avoidance.h.

Referenced by handle_threat_gcs_notify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ most_serious_threat()

AP_Avoidance::Obstacle * AP_Avoidance::most_serious_threat ( )
protected

Definition at line 483 of file AP_Avoidance.cpp.

Referenced by update().

Here is the caller graph for this function:

◆ obstacle_is_more_serious_threat()

bool AP_Avoidance::obstacle_is_more_serious_threat ( const AP_Avoidance::Obstacle obstacle) const
private

Definition at line 417 of file AP_Avoidance.cpp.

Referenced by check_for_threats().

Here is the caller graph for this function:

◆ perpendicular_xy()

Vector2f AP_Avoidance::perpendicular_xy ( const Location p1,
const Vector3f v1,
const Location p2 
)
staticprotected

Definition at line 642 of file AP_Avoidance.cpp.

Referenced by mav_avoidance_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ perpendicular_xyz()

Vector3f AP_Avoidance::perpendicular_xyz ( const Location p1,
const Vector3f v1,
const Location p2 
)
staticprotected

Definition at line 631 of file AP_Avoidance.cpp.

Referenced by get_vector_perpendicular(), and mav_avoidance_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ src_id_for_adsb_vehicle()

uint32_t AP_Avoidance::src_id_for_adsb_vehicle ( AP_ADSB::adsb_vehicle_t  vehicle) const
private

Definition at line 253 of file AP_Avoidance.cpp.

Referenced by get_adsb_samples().

Here is the caller graph for this function:

◆ update()

void AP_Avoidance::update ( void  )

Definition at line 493 of file AP_Avoidance.cpp.

Here is the call graph for this function:

◆ update_threat_level()

void AP_Avoidance::update_threat_level ( const Location my_loc,
const Vector3f my_vel,
AP_Avoidance::Obstacle obstacle 
)
private

Definition at line 328 of file AP_Avoidance.cpp.

Referenced by check_for_threats().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _adsb

class AP_ADSB& AP_Avoidance::_adsb
private

Definition at line 181 of file AP_Avoidance.h.

Referenced by get_adsb_samples(), and update().

◆ _ahrs

const AP_AHRS& AP_Avoidance::_ahrs
protected

◆ _current_most_serious_threat

int8_t AP_Avoidance::_current_most_serious_threat
private

◆ _enabled

AP_Int8 AP_Avoidance::_enabled
private

Definition at line 184 of file AP_Avoidance.h.

Referenced by check_startup(), disable(), enable(), and init().

◆ _fail_action

AP_Int8 AP_Avoidance::_fail_action
private

Definition at line 187 of file AP_Avoidance.h.

Referenced by handle_avoidance_local().

◆ _fail_altitude_minimum

AP_Int16 AP_Avoidance::_fail_altitude_minimum
private

Definition at line 192 of file AP_Avoidance.h.

Referenced by handle_avoidance_local().

◆ _fail_distance_xy

AP_Int16 AP_Avoidance::_fail_distance_xy
private

Definition at line 190 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ _fail_distance_z

AP_Int16 AP_Avoidance::_fail_distance_z
private

Definition at line 191 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ _fail_recovery

AP_Int8 AP_Avoidance::_fail_recovery
private

Definition at line 188 of file AP_Avoidance.h.

Referenced by handle_avoidance_local().

◆ _fail_time_horizon

AP_Int8 AP_Avoidance::_fail_time_horizon
private

Definition at line 189 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ _gcs_cleared_messages_duration

const uint8_t AP_Avoidance::_gcs_cleared_messages_duration = 5
staticprotected

Definition at line 114 of file AP_Avoidance.h.

Referenced by handle_threat_gcs_notify().

◆ _gcs_cleared_messages_first_sent

uint32_t AP_Avoidance::_gcs_cleared_messages_first_sent
protected

Definition at line 115 of file AP_Avoidance.h.

Referenced by handle_threat_gcs_notify(), and init().

◆ _gcs_notify_interval

const uint8_t AP_Avoidance::_gcs_notify_interval = 1
staticprivate

Definition at line 143 of file AP_Avoidance.h.

Referenced by handle_threat_gcs_notify().

◆ _last_state_change_ms

uint32_t AP_Avoidance::_last_state_change_ms = 0
protected

Definition at line 109 of file AP_Avoidance.h.

Referenced by handle_avoidance_local(), and init().

◆ _latest_action

MAV_COLLISION_ACTION AP_Avoidance::_latest_action = MAV_COLLISION_ACTION_NONE
private

Definition at line 178 of file AP_Avoidance.h.

Referenced by handle_avoidance_local(), and mav_avoidance_action().

◆ _low_velocity_threshold

const uint8_t AP_Avoidance::_low_velocity_threshold = 1
private

Definition at line 147 of file AP_Avoidance.h.

Referenced by get_vector_perpendicular().

◆ _obstacle_count

uint8_t AP_Avoidance::_obstacle_count
private

Definition at line 176 of file AP_Avoidance.h.

Referenced by add_obstacle(), check_for_threats(), deinit(), and init().

◆ _obstacles

AP_Avoidance::Obstacle* AP_Avoidance::_obstacles
private

◆ _obstacles_allocated

uint8_t AP_Avoidance::_obstacles_allocated
private

Definition at line 175 of file AP_Avoidance.h.

Referenced by add_obstacle(), deinit(), and init().

◆ _obstacles_max

AP_Int8 AP_Avoidance::_obstacles_max
private

Definition at line 185 of file AP_Avoidance.h.

Referenced by init().

◆ _threat_level

MAV_COLLISION_THREAT_LEVEL AP_Avoidance::_threat_level = MAV_COLLISION_THREAT_LEVEL_NONE
protected

Definition at line 110 of file AP_Avoidance.h.

Referenced by handle_avoidance_local(), and init().

◆ _warn_action

AP_Int8 AP_Avoidance::_warn_action
private

Definition at line 194 of file AP_Avoidance.h.

◆ _warn_distance_xy

AP_Float AP_Avoidance::_warn_distance_xy
private

Definition at line 196 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ _warn_distance_z

AP_Float AP_Avoidance::_warn_distance_z
private

Definition at line 197 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ _warn_time_horizon

AP_Int8 AP_Avoidance::_warn_time_horizon
private

Definition at line 195 of file AP_Avoidance.h.

Referenced by update_threat_level().

◆ MAX_OBSTACLE_AGE_MS

const uint32_t AP_Avoidance::MAX_OBSTACLE_AGE_MS = 5000
private

Definition at line 142 of file AP_Avoidance.h.

Referenced by check_for_threats(), and update_threat_level().

◆ var_info

const AP_Param::GroupInfo AP_Avoidance::var_info
static

Definition at line 92 of file AP_Avoidance.h.

Referenced by AP_Avoidance().


The documentation for this class was generated from the following files: