Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
autopilot_static.c File Reference

Static autopilot implementation. More...

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.
#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)

Functions

void autopilot_static_init (void)
 Static autopilot functions.
void autopilot_static_periodic (void)
void autopilot_static_SetModeHandler (float mode)
 AP mode setting handler.
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.
void autopilot_failsafe_checks (void)
 Autopilot periodic failsafe checks.

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 67 of file autopilot_static.c.

Referenced by autopilot_static_periodic().

◆ MODE_STARTUP

#define MODE_STARTUP   AP_MODE_KILL

Definition at line 72 of file autopilot_static.c.

Referenced by autopilot_static_init().

◆ NAV_PRESCALER

#define NAV_PRESCALER   (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY)

Definition at line 109 of file autopilot_static.c.

Referenced by autopilot_static_periodic().

◆ 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 409 of file autopilot_static.c.

◆ UNLOCKED_HOME_MODE

#define UNLOCKED_HOME_MODE   TRUE

Definition at line 78 of file autopilot_static.c.

Referenced by autopilot_static_on_rc_frame(), and pprz_mode_update().

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 412 of file autopilot_static.c.

References AP_MODE_FAILSAFE, AP_MODE_GUIDED, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_NAV, autopilot_get_mode(), autopilot_get_motors_on(), autopilot_set_mode(), datalink_time, electrical, GpsIsLost, radio_control, RC_LOST_MODE, RC_OK, and RC_REALLY_LOST.

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 93 of file autopilot_static.c.

References AP_MODE_KILL, autopilot, autopilot_arming_init(), autopilot_static_set_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 348 of file autopilot_static.c.

References AP_MODE_FAILSAFE, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_NAV, ap_mode_of_3way_switch(), autopilot, autopilot_arming_check_motors_on(), autopilot_static_set_mode(), commands, GpsIsLost, kill_switch_is_on(), MODE_MANUAL, nav, radio_control, and UNLOCKED_HOME_MODE.

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 338 of file autopilot_static.c.

References AP_MODE_KILL, autopilot, and autopilot_arming_set().

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 200 of file autopilot_static.c.

References AP_MODE_FAILSAFE, AP_MODE_GUIDED, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_NAV, autopilot_static_set_mode(), mode, radio_control, and RC_OK.

Here is the call graph for this function: