APM:Libraries
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
AC_Loiter Class Reference

#include <AC_Loiter.h>

Collaboration diagram for AC_Loiter:
[legend]

Public Member Functions

 AC_Loiter (const AP_InertialNav &inav, const AP_AHRS_View &ahrs, AC_PosControl &pos_control, const AC_AttitudeControl &attitude_control)
 Constructor. More...
 
void set_avoidance (AC_Avoid *avoid_ptr)
 provide pointer to avoidance library More...
 
void init_target (const Vector3f &position)
 init_target to a position in cm from ekf origin More...
 
void init_target ()
 initialize's position and feed-forward velocity from current pos and velocity More...
 
void soften_for_landing ()
 reduce response for landing More...
 
void set_pilot_desired_acceleration (float euler_roll_angle_cd, float euler_pitch_angle_cd, float dt)
 set pilot desired acceleration in centi-degrees More...
 
Vector2f get_pilot_desired_acceleration () const
 gets pilot desired acceleration, body frame, [forward,right] More...
 
void clear_pilot_desired_acceleration ()
 clear pilot desired acceleration More...
 
void get_stopping_point_xy (Vector3f &stopping_point) const
 get vector to stopping point based on a horizontal position and velocity More...
 
float get_distance_to_target () const
 get horizontal distance to loiter target in cm More...
 
int32_t get_bearing_to_target () const
 get bearing to target in centi-degrees More...
 
float get_angle_max_cd () const
 get maximum lean angle when using loiter More...
 
void update (float ekfGndSpdLimit, float ekfNavVelGainScaler)
 run the loiter controller More...
 
int32_t get_roll () const
 get desired roll, pitch which should be fed into stabilize controllers More...
 
int32_t get_pitch () const
 

Static Public Attributes

static const struct AP_Param::GroupInfo var_info []
 

Protected Member Functions

void sanity_check_params ()
 
void calc_desired_velocity (float nav_dt, float ekfGndSpdLimit)
 

Protected Attributes

const AP_InertialNav_inav
 
const AP_AHRS_View_ahrs
 
AC_PosControl_pos_control
 
const AC_AttitudeControl_attitude_control
 
AC_Avoid_avoid = nullptr
 
AP_Float _angle_max
 
AP_Float _speed_cms
 
AP_Float _accel_cmss
 
AP_Float _brake_accel_cmss
 
AP_Float _brake_jerk_max_cmsss
 
AP_Float _brake_delay
 
Vector2f _desired_accel
 
Vector2f _predicted_accel
 
Vector2f _predicted_euler_angle
 
Vector2f _predicted_euler_rate
 
float _brake_timer
 
float _brake_accel
 

Detailed Description

Definition at line 12 of file AC_Loiter.h.

Constructor & Destructor Documentation

◆ AC_Loiter()

AC_Loiter::AC_Loiter ( const AP_InertialNav inav,
const AP_AHRS_View ahrs,
AC_PosControl pos_control,
const AC_AttitudeControl attitude_control 
)

Constructor.

Definition at line 79 of file AC_Loiter.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ calc_desired_velocity()

void AC_Loiter::calc_desired_velocity ( float  nav_dt,
float  ekfGndSpdLimit 
)
protected

updates desired velocity (i.e. feed forward) with pilot requested acceleration and fake wind resistance updated velocity sent directly to position controller

calc_desired_velocity - updates desired velocity (i.e. feed forward) with pilot requested acceleration and fake wind resistance updated velocity sent directly to position controller

Definition at line 230 of file AC_Loiter.cpp.

Referenced by update().

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

◆ clear_pilot_desired_acceleration()

void AC_Loiter::clear_pilot_desired_acceleration ( )
inline

clear pilot desired acceleration

Definition at line 39 of file AC_Loiter.h.

Here is the call graph for this function:

◆ get_angle_max_cd()

float AC_Loiter::get_angle_max_cd ( ) const

get maximum lean angle when using loiter

Definition at line 196 of file AC_Loiter.cpp.

Referenced by calc_desired_velocity(), get_bearing_to_target(), and init_target().

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

◆ get_bearing_to_target()

int32_t AC_Loiter::get_bearing_to_target ( ) const
inline

get bearing to target in centi-degrees

Definition at line 48 of file AC_Loiter.h.

Here is the call graph for this function:

◆ get_distance_to_target()

float AC_Loiter::get_distance_to_target ( ) const
inline

get horizontal distance to loiter target in cm

Definition at line 45 of file AC_Loiter.h.

Here is the call graph for this function:

◆ get_pilot_desired_acceleration()

Vector2f AC_Loiter::get_pilot_desired_acceleration ( ) const
inline

gets pilot desired acceleration, body frame, [forward,right]

Definition at line 36 of file AC_Loiter.h.

◆ get_pitch()

int32_t AC_Loiter::get_pitch ( ) const
inline

Definition at line 58 of file AC_Loiter.h.

Here is the call graph for this function:

◆ get_roll()

int32_t AC_Loiter::get_roll ( ) const
inline

get desired roll, pitch which should be fed into stabilize controllers

Definition at line 57 of file AC_Loiter.h.

Here is the call graph for this function:

◆ get_stopping_point_xy()

void AC_Loiter::get_stopping_point_xy ( Vector3f stopping_point) const

get vector to stopping point based on a horizontal position and velocity

Definition at line 190 of file AC_Loiter.cpp.

Referenced by clear_pilot_desired_acceleration().

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

◆ init_target() [1/2]

void AC_Loiter::init_target ( const Vector3f position)

init_target to a position in cm from ekf origin

Definition at line 89 of file AC_Loiter.cpp.

Here is the call graph for this function:

◆ init_target() [2/2]

void AC_Loiter::init_target ( )

initialize's position and feed-forward velocity from current pos and velocity

Definition at line 114 of file AC_Loiter.cpp.

Referenced by set_avoidance().

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

◆ sanity_check_params()

void AC_Loiter::sanity_check_params ( )
protected

Definition at line 222 of file AC_Loiter.cpp.

Referenced by init_target().

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

◆ set_avoidance()

void AC_Loiter::set_avoidance ( AC_Avoid avoid_ptr)
inline

provide pointer to avoidance library

Definition at line 20 of file AC_Loiter.h.

Here is the call graph for this function:

◆ set_pilot_desired_acceleration()

void AC_Loiter::set_pilot_desired_acceleration ( float  euler_roll_angle_cd,
float  euler_pitch_angle_cd,
float  dt 
)

set pilot desired acceleration in centi-degrees

Definition at line 157 of file AC_Loiter.cpp.

Referenced by set_avoidance().

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

◆ soften_for_landing()

void AC_Loiter::soften_for_landing ( )

reduce response for landing

Definition at line 147 of file AC_Loiter.cpp.

Referenced by set_avoidance().

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

◆ update()

void AC_Loiter::update ( float  ekfGndSpdLimit,
float  ekfNavVelGainScaler 
)

run the loiter controller

Definition at line 205 of file AC_Loiter.cpp.

Referenced by get_bearing_to_target().

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

Member Data Documentation

◆ _accel_cmss

AP_Float AC_Loiter::_accel_cmss
protected

Definition at line 81 of file AC_Loiter.h.

Referenced by calc_desired_velocity(), init_target(), sanity_check_params(), and update().

◆ _ahrs

const AP_AHRS_View& AC_Loiter::_ahrs
protected

Definition at line 73 of file AC_Loiter.h.

Referenced by set_pilot_desired_acceleration().

◆ _angle_max

AP_Float AC_Loiter::_angle_max
protected

Definition at line 79 of file AC_Loiter.h.

Referenced by get_angle_max_cd().

◆ _attitude_control

const AC_AttitudeControl& AC_Loiter::_attitude_control
protected

◆ _avoid

AC_Avoid* AC_Loiter::_avoid = nullptr
protected

Definition at line 76 of file AC_Loiter.h.

Referenced by calc_desired_velocity(), and set_avoidance().

◆ _brake_accel

float AC_Loiter::_brake_accel
protected

Definition at line 92 of file AC_Loiter.h.

Referenced by calc_desired_velocity().

◆ _brake_accel_cmss

AP_Float AC_Loiter::_brake_accel_cmss
protected

Definition at line 82 of file AC_Loiter.h.

Referenced by calc_desired_velocity().

◆ _brake_delay

AP_Float AC_Loiter::_brake_delay
protected

Definition at line 84 of file AC_Loiter.h.

Referenced by calc_desired_velocity().

◆ _brake_jerk_max_cmsss

AP_Float AC_Loiter::_brake_jerk_max_cmsss
protected

Definition at line 83 of file AC_Loiter.h.

Referenced by calc_desired_velocity().

◆ _brake_timer

float AC_Loiter::_brake_timer
protected

Definition at line 91 of file AC_Loiter.h.

Referenced by calc_desired_velocity().

◆ _desired_accel

Vector2f AC_Loiter::_desired_accel
protected

◆ _inav

const AP_InertialNav& AC_Loiter::_inav
protected

Definition at line 72 of file AC_Loiter.h.

Referenced by init_target(), and soften_for_landing().

◆ _pos_control

AC_PosControl& AC_Loiter::_pos_control
protected

◆ _predicted_accel

Vector2f AC_Loiter::_predicted_accel
protected

Definition at line 88 of file AC_Loiter.h.

Referenced by calc_desired_velocity(), init_target(), and set_pilot_desired_acceleration().

◆ _predicted_euler_angle

Vector2f AC_Loiter::_predicted_euler_angle
protected

Definition at line 89 of file AC_Loiter.h.

Referenced by init_target(), and set_pilot_desired_acceleration().

◆ _predicted_euler_rate

Vector2f AC_Loiter::_predicted_euler_rate
protected

Definition at line 90 of file AC_Loiter.h.

Referenced by set_pilot_desired_acceleration().

◆ _speed_cms

AP_Float AC_Loiter::_speed_cms
protected

Definition at line 80 of file AC_Loiter.h.

Referenced by calc_desired_velocity(), init_target(), sanity_check_params(), and update().

◆ var_info

const AP_Param::GroupInfo AC_Loiter::var_info
static

Definition at line 60 of file AC_Loiter.h.

Referenced by AC_Loiter().


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