![]() |
Paparazzi UAS
v6.3_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Static autopilot implementation. More...
#include "autopilot.h"
#include "autopilot_arming.h"
#include "modules/radio_control/radio_control.h"
#include "modules/core/commands.h"
#include "modules/actuators/actuators.h"
#include "modules/energy/electrical.h"
#include "modules/core/settings.h"
#include "firmwares/rotorcraft/navigation.h"
#include "firmwares/rotorcraft/guidance.h"
#include "firmwares/rotorcraft/stabilization.h"
#include "firmwares/rotorcraft/stabilization/stabilization_none.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude.h"
#include "firmwares/rotorcraft/autopilot_guided.h"
#include "generated/settings.h"
#include "modules/gps/gps.h"
#include "modules/nav/nav_geofence.h"
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... | |
Static autopilot implementation.
Definition in file autopilot_static.c.
#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.
#define MODE_STARTUP AP_MODE_KILL |
Definition at line 73 of file autopilot_static.c.
#define NAV_PRESCALER (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY) |
Definition at line 110 of file autopilot_static.c.
#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 386 of file autopilot_static.c.
#define UNLOCKED_HOME_MODE TRUE |
Definition at line 79 of file autopilot_static.c.
void autopilot_failsafe_checks | ( | void | ) |
Autopilot periodic failsafe checks.
Autopilot periodic failsafe checks.
Autopilot periodic failsafe checks.
Checks order:
send mode if changed at the end
Definition at line 389 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.
void autopilot_static_init | ( | void | ) |
Static autopilot functions.
Specific function for static AP.
Static autopilot functions.
Definition at line 94 of file autopilot_static.c.
References AP_MODE_KILL, autopilot, autopilot_arming_init(), autopilot_static_set_mode(), pprz_autopilot::mode, and MODE_STARTUP.
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 322 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_in_flight(), autopilot_static_set_mode(), commands, GpsIsLost, guidance_h_read_rc(), guidance_v_read_rc(), kill_switch_is_on(), pprz_autopilot::kill_throttle, pprz_autopilot::mode, MODE_MANUAL, pprz_autopilot::motors_on, nav, radio_control, RotorcraftNavigation::too_far_from_home, UNLOCKED_HOME_MODE, and RadioControl::values.
void autopilot_static_periodic | ( | void | ) |
Definition at line 111 of file autopilot_static.c.
References AP_MODE_FAILSAFE, AP_MODE_HOME, AP_MODE_KILL, AP_MODE_NAV, autopilot, autopilot_in_flight(), autopilot_static_set_mode(), commands, commands_failsafe, compute_dist2_to_home(), datalink_lost(), pprz_autopilot::detect_ground_once, RotorcraftNavigation::dist2_to_home, RotorcraftNavigation::failsafe_mode_dist2, FAILSAFE_MODE_TOO_FAR_FROM_HOME, pprz_autopilot::ground_detected, guidance_h_run(), guidance_v_run(), higher_than_max_altitude(), pprz_autopilot::in_flight, pprz_autopilot::mode, pprz_autopilot::motors_on, nav, nav_home(), nav_periodic_task(), NAV_PRESCALER, SetRotorcraftCommands, stabilization_cmd, pprz_autopilot::throttle, and RotorcraftNavigation::too_far_from_home.
void autopilot_static_set_mode | ( | uint8_t | new_autopilot_mode | ) |
Definition at line 192 of file autopilot_static.c.
References AP_MODE_ATTITUDE_CLIMB, AP_MODE_ATTITUDE_DIRECT, AP_MODE_ATTITUDE_RC_CLIMB, AP_MODE_ATTITUDE_Z_HOLD, AP_MODE_CARE_FREE_DIRECT, AP_MODE_FAILSAFE, AP_MODE_FLIP, AP_MODE_FORWARD, AP_MODE_GUIDED, AP_MODE_HOME, AP_MODE_HOVER_CLIMB, AP_MODE_HOVER_DIRECT, AP_MODE_HOVER_Z_HOLD, AP_MODE_KILL, AP_MODE_MODULE, AP_MODE_NAV, AP_MODE_RATE_DIRECT, AP_MODE_RATE_RC_CLIMB, AP_MODE_RATE_Z_HOLD, AP_MODE_RC_DIRECT, autopilot, autopilot_set_in_flight(), autopilot_set_motors_on(), FAILSAFE_DESCENT_SPEED, FALSE, GUIDANCE_H_MODE_ATTITUDE, GUIDANCE_H_MODE_CARE_FREE, guidance_h_mode_changed(), GUIDANCE_H_MODE_FLIP, GUIDANCE_H_MODE_FORWARD, GUIDANCE_H_MODE_GUIDED, GUIDANCE_H_MODE_HOVER, GUIDANCE_H_MODE_KILL, GUIDANCE_H_MODE_MODULE_SETTING, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_RATE, GUIDANCE_H_MODE_RC_DIRECT, guidance_v_mode_changed(), GUIDANCE_V_MODE_CLIMB, GUIDANCE_V_MODE_FLIP, GUIDANCE_V_MODE_GUIDED, GUIDANCE_V_MODE_HOVER, GUIDANCE_V_MODE_KILL, GUIDANCE_V_MODE_MODULE_SETTING, GUIDANCE_V_MODE_NAV, GUIDANCE_V_MODE_RC_CLIMB, GUIDANCE_V_MODE_RC_DIRECT, guidance_v_set_vz(), pprz_autopilot::mode, stabilization_attitude_set_failsafe_setpoint(), and stabilization_cmd.
void autopilot_static_set_motors_on | ( | bool | motors_on | ) |
Definition at line 312 of file autopilot_static.c.
References AP_MODE_KILL, autopilot, autopilot_arming_set(), pprz_autopilot::mode, and pprz_autopilot::motors_on.
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.