APM:Copter
Classes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Mode Class Referenceabstract

#include <mode.h>

Inheritance diagram for Mode:
[legend]
Collaboration diagram for 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_t & ap
 
takeoff_state_t & takeoff_state
 
float & ekfGndSpdLimit
 
float & ekfNavVelGainScaler
 
heli_flags_t & heli_flags
 

Private Member Functions

 Mode (void)
 

Friends

class Copter
 
class AP_Arming_Copter
 
class ToyMode
 
class GCS_MAVLINK_Copter
 

Detailed Description

Definition at line 5 of file mode.h.

Constructor & Destructor Documentation

◆ Mode()

Mode::Mode ( void  )
private

Member Function Documentation

◆ allows_arming()

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

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Referenced by is_autopilot().

Here is the caller graph for this function:

◆ gcs()

GCS_Copter& Mode::gcs ( )
protected

◆ get_alt_above_ground()

int32_t Mode::get_alt_above_ground ( void  )
protected

Referenced by in_guided_mode().

Here is the caller graph for this function:

◆ get_avoidance_adjusted_climbrate()

float Mode::get_avoidance_adjusted_climbrate ( float  target_rate)
protected

◆ get_non_takeoff_throttle()

float Mode::get_non_takeoff_throttle ( void  )
protected

◆ get_pilot_desired_climb_rate()

float Mode::get_pilot_desired_climb_rate ( float  throttle_control)
protected

◆ get_pilot_desired_lean_angles()

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

Referenced by in_guided_mode().

Here is the caller graph for this function:

◆ get_pilot_desired_throttle()

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

◆ get_pilot_desired_yaw_rate()

float Mode::get_pilot_desired_yaw_rate ( int16_t  stick_angle)
protected

◆ get_pilot_speed_dn()

uint16_t Mode::get_pilot_speed_dn ( void  )
protected

◆ get_surface_tracking_climb_rate()

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

◆ get_wp()

virtual bool Mode::get_wp ( Location_Class loc)
inlineprotectedvirtual

Reimplemented in ModeGuided, and ModeAuto.

Definition at line 96 of file mode.h.

Referenced by ModeGuided::in_guided_mode(), and ModeAuto::name4().

Here is the caller graph for this function:

◆ has_manual_throttle()

virtual bool Mode::has_manual_throttle ( ) const
protectedpure virtual

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Referenced by is_autopilot().

Here is the caller graph for this function:

◆ in_guided_mode()

virtual bool Mode::in_guided_mode ( ) const
inlineprotectedvirtual

Reimplemented in ModeGuided, and ModeAuto.

Definition at line 97 of file mode.h.

Here is the call graph for this function:

◆ init()

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

◆ is_autopilot()

virtual bool Mode::is_autopilot ( ) const
inlineprotectedvirtual

Reimplemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Definition at line 79 of file mode.h.

Here is the call graph for this function:

◆ land_run_horizontal_control()

void Mode::land_run_horizontal_control ( )
protected

Referenced by in_guided_mode().

Here is the caller graph for this function:

◆ land_run_vertical_control()

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

Referenced by in_guided_mode().

Here is the caller graph for this function:

◆ landing_gear_should_be_deployed()

virtual bool Mode::landing_gear_should_be_deployed ( ) const
inlineprotectedvirtual

Reimplemented in ModeRTL, ModeLand, and ModeAuto.

Definition at line 84 of file mode.h.

Referenced by ModeAuto::mode(), and ModeRTL::state_complete().

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

◆ Log_Write_Event()

void Mode::Log_Write_Event ( uint8_t  id)
protected

◆ name()

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

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Referenced by landing_gear_should_be_deployed().

Here is the caller graph for this function:

◆ name4()

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

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Referenced by landing_gear_should_be_deployed().

Here is the caller graph for this function:

◆ requires_GPS()

virtual bool Mode::requires_GPS ( ) const
protectedpure virtual

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, and ModeAcro.

Referenced by is_autopilot().

Here is the caller graph for this function:

◆ run()

virtual void Mode::run ( )
protectedpure virtual

Implemented in ModeFollow, ModeAvoidADSB, ModeThrow, ModeStabilize_Heli, ModeStabilize, ModeSport, ModeSmartRTL, ModeRTL, ModePosHold, ModeLoiter, ModeLand, ModeGuidedNoGPS, ModeGuided, ModeFlowHold, ModeFlip, ModeDrift, ModeCircle, ModeBrake, ModeAutoTune, ModeAuto, ModeAltHold, ModeAcro_Heli, and ModeAcro.

Referenced by ModeRTL::run().

Here is the caller graph for this function:

◆ run_autopilot()

virtual void Mode::run_autopilot ( )
inlineprotectedvirtual

Reimplemented in ModeAuto.

Definition at line 93 of file mode.h.

Referenced by ModeAuto::name4().

Here is the caller graph for this function:

◆ set_land_complete()

void Mode::set_land_complete ( bool  b)
protected

◆ set_mode()

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

◆ set_throttle_takeoff()

void Mode::set_throttle_takeoff ( void  )
protected

◆ takeoff_get_climb_rates()

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

◆ takeoff_stop()

void Mode::takeoff_stop ( void  )
protected

◆ takeoff_timer_start()

void Mode::takeoff_timer_start ( float  alt_cm)
protected

◆ takeoff_triggered()

bool Mode::takeoff_triggered ( float  target_climb_rate) const
protected

Referenced by in_guided_mode().

Here is the caller graph for this function:

◆ update_navigation()

void Mode::update_navigation ( )
protected

Referenced by landing_gear_should_be_deployed().

Here is the caller graph for this function:

◆ update_simple_mode()

void Mode::update_simple_mode ( void  )
protected

◆ wp_bearing()

virtual int32_t Mode::wp_bearing ( ) const
inlineprotectedvirtual

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

Definition at line 95 of file mode.h.

Referenced by ModeAuto::name4(), ModeCircle::name4(), ModeGuided::name4(), ModeLoiter::name4(), ModeRTL::name4(), and ModeSmartRTL::name4().

Here is the caller graph for this function:

◆ wp_distance()

virtual uint32_t Mode::wp_distance ( ) const
inlineprotectedvirtual

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

Definition at line 94 of file mode.h.

Referenced by ModeAuto::name4(), ModeCircle::name4(), ModeGuided::name4(), ModeLoiter::name4(), ModeRTL::name4(), and ModeSmartRTL::name4().

Here is the caller graph for this function:

◆ zero_throttle_and_relax_ac()

void Mode::zero_throttle_and_relax_ac ( )
protected

Referenced by in_guided_mode().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ AP_Arming_Copter

friend class AP_Arming_Copter
friend

Definition at line 7 of file mode.h.

◆ Copter

friend class Copter
friend

Definition at line 6 of file mode.h.

◆ GCS_MAVLINK_Copter

friend class GCS_MAVLINK_Copter
friend

Definition at line 9 of file mode.h.

◆ ToyMode

friend class ToyMode
friend

Definition at line 8 of file mode.h.

Member Data Documentation

◆ ahrs

AP_AHRS& Mode::ahrs
protected

Definition at line 121 of file mode.h.

◆ ap

ap_t& Mode::ap
protected

Definition at line 129 of file mode.h.

◆ attitude_control

AC_AttitudeControl_t*& Mode::attitude_control
protected

Definition at line 122 of file mode.h.

◆ auto_yaw

AutoYaw Mode::auto_yaw
static

Definition at line 72 of file mode.h.

◆ channel_pitch

RC_Channel*& Mode::channel_pitch
protected

Definition at line 125 of file mode.h.

◆ channel_roll

RC_Channel*& Mode::channel_roll
protected

Definition at line 124 of file mode.h.

◆ channel_throttle

RC_Channel*& Mode::channel_throttle
protected

Definition at line 126 of file mode.h.

◆ channel_yaw

RC_Channel*& Mode::channel_yaw
protected

Definition at line 127 of file mode.h.

◆ ekfGndSpdLimit

float& Mode::ekfGndSpdLimit
protected

Definition at line 133 of file mode.h.

◆ ekfNavVelGainScaler

float& Mode::ekfNavVelGainScaler
protected

Definition at line 136 of file mode.h.

◆ g

Parameters& Mode::g
protected

Definition at line 115 of file mode.h.

◆ g2

ParametersG2& Mode::g2
protected

Definition at line 116 of file mode.h.

◆ G_Dt

float& Mode::G_Dt
protected

Definition at line 128 of file mode.h.

◆ heli_flags

heli_flags_t& Mode::heli_flags
protected

Definition at line 139 of file mode.h.

◆ inertial_nav

AP_InertialNav& Mode::inertial_nav
protected

Definition at line 120 of file mode.h.

◆ loiter_nav

AC_Loiter*& Mode::loiter_nav
protected

Definition at line 118 of file mode.h.

◆ motors

MOTOR_CLASS*& Mode::motors
protected

Definition at line 123 of file mode.h.

◆ pos_control

AC_PosControl*& Mode::pos_control
protected

Definition at line 119 of file mode.h.

◆ takeoff_state

takeoff_state_t& Mode::takeoff_state
protected

Definition at line 130 of file mode.h.

◆ wp_nav

AC_WPNav*& Mode::wp_nav
protected

Definition at line 117 of file mode.h.


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