APM:Copter
Classes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Copter::Mode Class Referenceabstract
Inheritance diagram for Copter::Mode:
[legend]
Collaboration diagram for Copter::Mode:
[legend]

Classes

class  AutoYaw
 

Static Public Attributes

static AutoYaw auto_yaw
 

Protected Member Functions

virtual bool init (bool ignore_checks)=0
 
virtual void run ()=0
 
virtual bool is_autopilot () const
 
virtual bool requires_GPS () const =0
 
virtual bool has_manual_throttle () const =0
 
virtual bool allows_arming (bool from_gcs) const =0
 
virtual bool landing_gear_should_be_deployed () const
 
virtual const char * name () const =0
 
virtual const char * name4 () const =0
 
void update_navigation ()
 
virtual void run_autopilot ()
 
virtual uint32_t wp_distance () const
 
virtual int32_t wp_bearing () const
 
virtual bool get_wp (Location_Class &loc)
 
virtual bool in_guided_mode () const
 
void get_pilot_desired_lean_angles (float &roll_out, float &pitch_out, float angle_max, float angle_limit) const
 
bool takeoff_triggered (float target_climb_rate) const
 
void zero_throttle_and_relax_ac ()
 
int32_t get_alt_above_ground (void)
 
void land_run_horizontal_control ()
 
void land_run_vertical_control (bool pause_descent=false)
 
float get_surface_tracking_climb_rate (int16_t target_rate, float current_alt_target, float dt)
 
float get_pilot_desired_yaw_rate (int16_t stick_angle)
 
float get_pilot_desired_climb_rate (float throttle_control)
 
float get_pilot_desired_throttle (int16_t throttle_control, float thr_mid=0.0f)
 
float get_non_takeoff_throttle (void)
 
void update_simple_mode (void)
 
bool set_mode (control_mode_t mode, mode_reason_t reason)
 
void set_land_complete (bool b)
 
GCS_Coptergcs ()
 
void Log_Write_Event (uint8_t id)
 
void set_throttle_takeoff (void)
 
void takeoff_timer_start (float alt_cm)
 
void takeoff_stop (void)
 
void takeoff_get_climb_rates (float &pilot_climb_rate, float &takeoff_climb_rate)
 
float get_avoidance_adjusted_climbrate (float target_rate)
 
uint16_t get_pilot_speed_dn (void)
 

Protected Attributes

Parametersg
 
ParametersG2g2
 
AC_WPNav *& wp_nav
 
AC_Loiter *& loiter_nav
 
AC_PosControl *& pos_control
 
AP_InertialNavinertial_nav
 
AP_AHRSahrs
 
AC_AttitudeControl_t *& attitude_control
 
MOTOR_CLASS *& motors
 
RC_Channel *& channel_roll
 
RC_Channel *& channel_pitch
 
RC_Channel *& channel_throttle
 
RC_Channel *& channel_yaw
 
float & G_Dt
 
ap_tap
 
takeoff_state_ttakeoff_state
 
float & ekfGndSpdLimit
 
float & ekfNavVelGainScaler
 

Private Member Functions

 Mode (void)
 

Friends

class Copter
 
class AP_Arming_Copter
 
class ToyMode
 
class GCS_MAVLINK_Copter
 

Detailed Description

Definition at line 6 of file Copter.h.

Constructor & Destructor Documentation

◆ Mode()

Copter::Mode::Mode ( void  )
private

Definition at line 11 of file mode.cpp.

Member Function Documentation

◆ allows_arming()

virtual bool Copter::Mode::allows_arming ( bool  from_gcs) const
protectedpure virtual

◆ gcs()

GCS_Copter & Copter::Mode::gcs ( )
protected

◆ get_alt_above_ground()

int32_t Copter::Mode::get_alt_above_ground ( void  )
protected

Definition at line 389 of file mode.cpp.

Referenced by land_run_horizontal_control(), and land_run_vertical_control().

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

◆ get_avoidance_adjusted_climbrate()

float Copter::Mode::get_avoidance_adjusted_climbrate ( float  target_rate)
protected

Definition at line 617 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), and Copter::ModeFollow::run().

Here is the caller graph for this function:

◆ get_non_takeoff_throttle()

float Copter::Mode::get_non_takeoff_throttle ( void  )
protected

Definition at line 568 of file mode.cpp.

Referenced by Copter::ModeStabilize::init().

Here is the caller graph for this function:

◆ get_pilot_desired_climb_rate()

float Copter::Mode::get_pilot_desired_climb_rate ( float  throttle_control)
protected

Definition at line 558 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeCircle::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), and Copter::ModeSport::run().

Here is the caller graph for this function:

◆ get_pilot_desired_lean_angles()

void Copter::Mode::get_pilot_desired_lean_angles ( float &  roll_out,
float &  pitch_out,
float  angle_max,
float  angle_limit 
) const
protected

Definition at line 326 of file mode.cpp.

Referenced by Copter::ModeRTL::descent_run(), land_run_horizontal_control(), Copter::ModeLand::nogps_run(), Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeDrift::run(), Copter::ModeFlowHold::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), and Copter::ModeStabilize::run().

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

◆ get_pilot_desired_throttle()

float Copter::Mode::get_pilot_desired_throttle ( int16_t  throttle_control,
float  thr_mid = 0.0f 
)
protected

Definition at line 563 of file mode.cpp.

Referenced by Copter::ModeAcro::init(), Copter::ModeStabilize::init(), Copter::ModeAcro::run(), Copter::ModeDrift::run(), Copter::ModeFlip::run(), and Copter::ModeStabilize::run().

Here is the caller graph for this function:

◆ get_pilot_desired_yaw_rate()

float Copter::Mode::get_pilot_desired_yaw_rate ( int16_t  stick_angle)
protected

◆ get_pilot_speed_dn()

uint16_t Copter::Mode::get_pilot_speed_dn ( void  )
protected

Definition at line 622 of file mode.cpp.

Referenced by Copter::ModeCircle::init(), Copter::ModePosHold::init(), Copter::ModeSport::init(), Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeCircle::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), and Copter::ModeAutoTune::start().

Here is the caller graph for this function:

◆ get_surface_tracking_climb_rate()

float Copter::Mode::get_surface_tracking_climb_rate ( int16_t  target_rate,
float  current_alt_target,
float  dt 
)
protected

Definition at line 548 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeCircle::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), and Copter::ModeSport::run().

Here is the caller graph for this function:

◆ get_wp()

virtual bool Copter::Mode::get_wp ( Location_Class loc)
inlineprotectedvirtual

Reimplemented in Copter::ModeGuided, and Copter::ModeAuto.

Definition at line 97 of file Copter.h.

◆ has_manual_throttle()

virtual bool Copter::Mode::has_manual_throttle ( ) const
protectedpure virtual

◆ in_guided_mode()

virtual bool Copter::Mode::in_guided_mode ( ) const
inlineprotectedvirtual

Reimplemented in Copter::ModeGuided, and Copter::ModeAuto.

Definition at line 98 of file Copter.h.

◆ init()

virtual bool Copter::Mode::init ( bool  ignore_checks)
protectedpure virtual

◆ is_autopilot()

virtual bool Copter::Mode::is_autopilot ( ) const
inlineprotectedvirtual

◆ land_run_horizontal_control()

void Copter::Mode::land_run_horizontal_control ( )
protected

Definition at line 449 of file mode.cpp.

Referenced by Copter::ModeLand::gps_run(), Copter::ModeAuto::land_run(), Copter::ModeRTL::land_run(), Copter::ModeAuto::payload_place_run_descend(), and Copter::ModeAuto::payload_place_run_loiter().

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

◆ land_run_vertical_control()

void Copter::Mode::land_run_vertical_control ( bool  pause_descent = false)
protected

Definition at line 403 of file mode.cpp.

Referenced by Copter::ModeLand::gps_run(), Copter::ModeAuto::land_run(), Copter::ModeRTL::land_run(), Copter::ModeLand::nogps_run(), and Copter::ModeAuto::payload_place_run_descend().

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

◆ landing_gear_should_be_deployed()

virtual bool Copter::Mode::landing_gear_should_be_deployed ( ) const
inlineprotectedvirtual

Reimplemented in Copter::ModeRTL, Copter::ModeLand, and Copter::ModeAuto.

Definition at line 85 of file Copter.h.

Referenced by Copter::landinggear_update().

Here is the caller graph for this function:

◆ Log_Write_Event()

void Copter::Mode::Log_Write_Event ( uint8_t  id)
protected

◆ name()

virtual const char* Copter::Mode::name ( ) const
protectedpure virtual

◆ name4()

virtual const char* Copter::Mode::name4 ( ) const
protectedpure virtual

◆ requires_GPS()

virtual bool Copter::Mode::requires_GPS ( ) const
protectedpure virtual

◆ run()

virtual void Copter::Mode::run ( )
protectedpure virtual

◆ run_autopilot()

virtual void Copter::Mode::run_autopilot ( )
inlineprotectedvirtual

Reimplemented in Copter::ModeAuto.

Definition at line 94 of file Copter.h.

Referenced by update_navigation().

Here is the caller graph for this function:

◆ set_land_complete()

void Copter::Mode::set_land_complete ( bool  b)
protected

Definition at line 582 of file mode.cpp.

Referenced by Copter::ModeAcro::run(), Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeCircle::run(), Copter::ModeDrift::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), Copter::ModeStabilize::run(), and Copter::ModeAuto::takeoff_run().

Here is the caller graph for this function:

◆ set_mode()

bool Copter::Mode::set_mode ( control_mode_t  mode,
mode_reason_t  reason 
)
protected

Definition at line 577 of file mode.cpp.

Referenced by Copter::ModeAuto::exit_mission(), land_run_horizontal_control(), Copter::ModeThrow::run(), and Copter::set_mode_land_with_pause().

Here is the caller graph for this function:

◆ set_throttle_takeoff()

void Copter::Mode::set_throttle_takeoff ( void  )
protected

Definition at line 597 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeCircle::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), Copter::ModeAuto::spline_run(), Copter::ModeAuto::takeoff_run(), Copter::ModeAuto::takeoff_start(), and Copter::ModeAuto::wp_run().

Here is the caller graph for this function:

◆ takeoff_get_climb_rates()

void Copter::Mode::takeoff_get_climb_rates ( float &  pilot_climb_rate,
float &  takeoff_climb_rate 
)
protected

Definition at line 612 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), and Copter::ModeSport::run().

Here is the caller graph for this function:

◆ takeoff_stop()

void Copter::Mode::takeoff_stop ( void  )
protected

Definition at line 607 of file mode.cpp.

Referenced by Copter::exit_mode().

Here is the caller graph for this function:

◆ takeoff_timer_start()

void Copter::Mode::takeoff_timer_start ( float  alt_cm)
protected

Definition at line 602 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), and Copter::ModeSport::run().

Here is the caller graph for this function:

◆ takeoff_triggered()

bool Copter::Mode::takeoff_triggered ( float  target_climb_rate) const
protected

Definition at line 354 of file mode.cpp.

Referenced by Copter::ModeAltHold::run(), Copter::ModeFlowHold::run(), Copter::ModeLoiter::run(), and Copter::ModeSport::run().

Here is the caller graph for this function:

◆ update_navigation()

void Copter::Mode::update_navigation ( )
protected

Definition at line 318 of file mode.cpp.

Referenced by Copter::run_nav_updates().

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

◆ update_simple_mode()

void Copter::Mode::update_simple_mode ( void  )
protected

Definition at line 573 of file mode.cpp.

Referenced by Copter::ModeRTL::descent_run(), land_run_horizontal_control(), Copter::ModeLand::nogps_run(), Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), and Copter::ModeStabilize::run().

Here is the caller graph for this function:

◆ wp_bearing()

virtual int32_t Copter::Mode::wp_bearing ( ) const
inlineprotectedvirtual

Reimplemented in Copter::ModeSmartRTL, Copter::ModeRTL, Copter::ModeLoiter, Copter::ModeGuided, Copter::ModeCircle, and Copter::ModeAuto.

Definition at line 96 of file Copter.h.

Referenced by Copter::send_nav_controller_output().

Here is the caller graph for this function:

◆ wp_distance()

virtual uint32_t Copter::Mode::wp_distance ( ) const
inlineprotectedvirtual

Reimplemented in Copter::ModeSmartRTL, Copter::ModeRTL, Copter::ModeLoiter, Copter::ModeGuided, Copter::ModeCircle, and Copter::ModeAuto.

Definition at line 95 of file Copter.h.

Referenced by Copter::send_nav_controller_output().

Here is the caller graph for this function:

◆ zero_throttle_and_relax_ac()

void Copter::Mode::zero_throttle_and_relax_ac ( )
protected

Friends And Related Function Documentation

◆ AP_Arming_Copter

friend class AP_Arming_Copter
friend

Definition at line 8 of file Copter.h.

◆ Copter

friend class Copter
friend

Definition at line 7 of file Copter.h.

◆ GCS_MAVLINK_Copter

friend class GCS_MAVLINK_Copter
friend

Definition at line 10 of file Copter.h.

◆ ToyMode

friend class ToyMode
friend

Definition at line 9 of file Copter.h.

Member Data Documentation

◆ ahrs

AP_AHRS& Copter::Mode::ahrs
protected

◆ ap

ap_t& Copter::Mode::ap
protected

Definition at line 130 of file Copter.h.

◆ attitude_control

AC_AttitudeControl_t*& Copter::Mode::attitude_control
protected

◆ auto_yaw

Copter::Mode::AutoYaw Copter::Mode::auto_yaw
static

◆ channel_pitch

RC_Channel*& Copter::Mode::channel_pitch
protected

◆ channel_roll

RC_Channel*& Copter::Mode::channel_roll
protected

◆ channel_throttle

RC_Channel*& Copter::Mode::channel_throttle
protected

◆ channel_yaw

RC_Channel*& Copter::Mode::channel_yaw
protected

◆ ekfGndSpdLimit

float& Copter::Mode::ekfGndSpdLimit
protected

◆ ekfNavVelGainScaler

float& Copter::Mode::ekfNavVelGainScaler
protected

◆ g

Parameters& Copter::Mode::g
protected

◆ g2

ParametersG2& Copter::Mode::g2
protected

◆ G_Dt

float& Copter::Mode::G_Dt
protected

◆ inertial_nav

AP_InertialNav& Copter::Mode::inertial_nav
protected

◆ loiter_nav

AC_Loiter*& Copter::Mode::loiter_nav
protected

◆ motors

MOTOR_CLASS*& Copter::Mode::motors
protected

◆ pos_control

AC_PosControl*& Copter::Mode::pos_control
protected

Definition at line 120 of file Copter.h.

Referenced by Copter::ModeAutoTune::autotune_attitude_control(), Copter::ModeRTL::build_path(), Copter::ModeAuto::circle_run(), Copter::ModeRTL::climb_return_run(), Copter::ModeRTL::descent_run(), Copter::ModeRTL::descent_start(), get_alt_above_ground(), Copter::ModeAcro::init(), Copter::ModeAltHold::init(), Copter::ModeBrake::init(), Copter::ModeCircle::init(), Copter::ModeLand::init(), Copter::ModeLoiter::init(), Copter::ModePosHold::init(), Copter::ModeSmartRTL::init(), Copter::ModeSport::init(), Copter::ModeStabilize::init(), land_run_horizontal_control(), land_run_vertical_control(), Copter::ModeAuto::land_start(), Copter::ModeRTL::land_start(), Copter::ModeAuto::loiter_run(), Copter::ModeRTL::loiterathome_run(), Copter::ModeSmartRTL::path_follow_run(), Copter::ModeAuto::payload_place_run_loiter(), Copter::ModeAuto::payload_place_start(), Copter::ModePosHold::poshold_update_wind_comp_estimate(), Copter::ModeSmartRTL::pre_land_position_run(), Copter::ModeLoiter::precision_loiter_xy(), Copter::ModeAltHold::run(), Copter::ModeAutoTune::run(), Copter::ModeBrake::run(), Copter::ModeCircle::run(), Copter::ModeLoiter::run(), Copter::ModePosHold::run(), Copter::ModeSport::run(), Copter::ModeThrow::run(), Copter::ModeFollow::run(), Copter::ModeAuto::spline_run(), Copter::ModeAutoTune::start(), Copter::ModeAuto::takeoff_run(), Copter::ModeThrow::throw_height_good(), Copter::ModeThrow::throw_position_good(), Copter::ModeSmartRTL::wait_cleanup_run(), and Copter::ModeAuto::wp_run().

◆ takeoff_state

takeoff_state_t& Copter::Mode::takeoff_state
protected

◆ wp_nav

AC_WPNav*& Copter::Mode::wp_nav
protected

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