Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
autopilot_static.c File Reference
+ Include dependency graph for autopilot_static.c:

Go to the source code of this file.

Macros

#define FAILSAFE_MODE_TOO_FAR_FROM_HOME   AP_MODE_FAILSAFE
 Mode that is set when the plane is really too far from home. More...
 
#define MODE_STARTUP   AP_MODE_KILL
 
#define UNLOCKED_HOME_MODE   TRUE
 
#define NAV_PRESCALER   (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY)
 
#define RC_LOST_MODE   AP_MODE_FAILSAFE
 mode to enter when RC is lost while using a mode with RC input (not AP_MODE_NAV) More...
 

Functions

void autopilot_static_init (void)
 Static autopilot functions. More...
 
void autopilot_static_periodic (void)
 
void autopilot_static_SetModeHandler (float mode)
 AP mode setting handler. More...
 
void autopilot_static_set_mode (uint8_t new_autopilot_mode)
 
void autopilot_static_set_motors_on (bool motors_on)
 
void autopilot_static_on_rc_frame (void)
 Function to be called when a message from FBW is available. More...
 
void autopilot_failsafe_checks (void)
 Autopilot periodic failsafe checks. More...
 

Detailed Description

Static autopilot implementation.

Definition in file autopilot_static.c.

Macro Definition Documentation

◆ FAILSAFE_MODE_TOO_FAR_FROM_HOME

#define FAILSAFE_MODE_TOO_FAR_FROM_HOME   AP_MODE_FAILSAFE

Mode that is set when the plane is really too far from home.

Definition at line 68 of file autopilot_static.c.

◆ MODE_STARTUP

#define MODE_STARTUP   AP_MODE_KILL

Definition at line 73 of file autopilot_static.c.

◆ NAV_PRESCALER

#define NAV_PRESCALER   (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY)

Definition at line 110 of file autopilot_static.c.

◆ RC_LOST_MODE

#define RC_LOST_MODE   AP_MODE_FAILSAFE

mode to enter when RC is lost while using a mode with RC input (not AP_MODE_NAV)

Definition at line 397 of file autopilot_static.c.

◆ UNLOCKED_HOME_MODE

#define UNLOCKED_HOME_MODE   TRUE

Definition at line 79 of file autopilot_static.c.

Function Documentation

◆ autopilot_failsafe_checks()

void autopilot_failsafe_checks ( void  )

Autopilot periodic failsafe checks.

Autopilot periodic failsafe checks.

Autopilot periodic failsafe checks.

Checks order:

  • mode from RC
  • RC lost (if MANUAL or AUTO1)
  • RC kill switch (any case)
  • launch detect from RC
  • GPS lost (if AUTO2 or HOME)
  • too far from HOME (if not HOME or not GPS_OUT_OF_ORDER)

send mode if changed at the end

Definition at line 400 of file autopilot_static.c.

References AP_MODE_FAILSAFE, AP_MODE_FLIP, AP_MODE_GUIDED, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_MODULE, AP_MODE_NAV, autopilot_get_mode(), autopilot_get_motors_on(), autopilot_set_mode(), Electrical::bat_critical, datalink_time, electrical, GpsIsLost, radio_control, RC_LOST_MODE, RC_OK, RC_REALLY_LOST, and RadioControl::status.

+ Here is the call graph for this function:

◆ autopilot_static_init()

void autopilot_static_init ( void  )

Static autopilot functions.

Specific function for static AP.

Static autopilot functions.

Todo:
, properly implement or remove
Todo:
: properly implement/fix a triggered attitude loop

Definition at line 94 of file autopilot_static.c.

References ABI_BROADCAST, AP_MODE_AUTO2, AP_MODE_KILL, autopilot, autopilot_arming_init(), autopilot_static_set_mode(), lateral_mode, LATERAL_MODE_MANUAL, pprz_autopilot::mode, and MODE_STARTUP.

+ Here is the call graph for this function:

◆ autopilot_static_on_rc_frame()

void autopilot_static_on_rc_frame ( void  )

Function to be called when a message from FBW is available.

In AUTO1 mode, compute roll setpoint and pitch setpoint from RADIO_ROLL and RADIO_PITCH

Roll is bounded between [-AUTO1_MAX_ROLL;AUTO1_MAX_ROLL]

Pitch is bounded between [-AUTO1_MAX_PITCH;AUTO1_MAX_PITCH]

Else asynchronously set by h_ctl_course_loop()

In AUTO1, throttle comes from RADIO_THROTTLE In MANUAL, the value is copied to get it in the telemetry

else asynchronously set by v_ctl_climb_loop();

Definition at line 328 of file autopilot_static.c.

References ap_ahrs_is_aligned(), AP_ARMING_STATUS_AHRS_NOT_ALLIGNED, AP_MODE_AUTO1, AP_MODE_FAILSAFE, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_MANUAL, AP_MODE_NAV, ap_mode_of_3way_switch(), pprz_autopilot::arming_status, autopilot, autopilot_arming_check_motors_on(), autopilot_get_mode(), autopilot_in_flight(), autopilot_static_set_mode(), commands, FLOAT_OF_PPRZ, GpsIsLost, guidance_h_read_rc(), guidance_v_read_rc(), h_ctl_pitch_setpoint, h_ctl_roll_setpoint, kill_switch_is_on(), pprz_autopilot::kill_throttle, pprz_autopilot::mode, MODE_MANUAL, pprz_autopilot::motors_on, radio_control, radio_control_get(), RADIO_PITCH, RADIO_ROLL, RADIO_THROTTLE, RADIO_YAW, pprz_autopilot::throttle, too_far_from_home, UNLOCKED_HOME_MODE, v_ctl_throttle_setpoint, and RadioControl::values.

+ Here is the call graph for this function:

◆ autopilot_static_periodic()

◆ autopilot_static_set_mode()

◆ autopilot_static_set_motors_on()

void autopilot_static_set_motors_on ( bool  motors_on)

Definition at line 318 of file autopilot_static.c.

References ap_ahrs_is_aligned(), AP_MODE_KILL, autopilot, autopilot_arming_set(), pprz_autopilot::mode, and pprz_autopilot::motors_on.

+ Here is the call graph for this function:

◆ autopilot_static_SetModeHandler()

void autopilot_static_SetModeHandler ( float  mode)

AP mode setting handler.

Checks RC status before calling autopilot_static_set_mode function

Definition at line 176 of file autopilot_static.c.

References AP_MODE_FAILSAFE, AP_MODE_FLIP, AP_MODE_GUIDED, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_MODULE, AP_MODE_NAV, autopilot_static_set_mode(), mode, radio_control, RC_OK, and RadioControl::status.

+ Here is the call graph for this function: