Paparazzi UAS
v7.0_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_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 67 of file autopilot_static.c.
#define MODE_STARTUP AP_MODE_KILL |
Definition at line 72 of file autopilot_static.c.
#define NAV_PRESCALER (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY) |
Definition at line 109 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 405 of file autopilot_static.c.
#define UNLOCKED_HOME_MODE TRUE |
Definition at line 78 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 408 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(), 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 93 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 344 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(), 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 110 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(), Stabilization::cmd, 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, GUIDANCE_H_MODE_NONE, guidance_h_run(), guidance_v_run(), higher_than_max_altitude(), pprz_autopilot::in_flight, pprz_autopilot::mode, HorizontalGuidance::mode, pprz_autopilot::motors_on, nav, nav_home(), nav_periodic_task(), NAV_PRESCALER, Stabilization::rc_sp, SetRotorcraftCommands, stabilization, stabilization_get_failsafe_sp(), stabilization_run(), pprz_autopilot::throttle, thrust_sp, and RotorcraftNavigation::too_far_from_home.
void autopilot_static_set_mode | ( | uint8_t | new_autopilot_mode | ) |
Definition at line 212 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_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_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(), Stabilization::cmd, FAILSAFE_DESCENT_SPEED, guidance_h_mode_changed(), GUIDANCE_H_MODE_GUIDED, GUIDANCE_H_MODE_HOVER, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_NONE, guidance_v_mode_changed(), GUIDANCE_V_MODE_CLIMB, GUIDANCE_V_MODE_GUIDED, GUIDANCE_V_MODE_HOVER, GUIDANCE_V_MODE_KILL, GUIDANCE_V_MODE_NAV, GUIDANCE_V_MODE_RC_CLIMB, GUIDANCE_V_MODE_RC_DIRECT, guidance_v_set_vz(), pprz_autopilot::mode, stabilization, STABILIZATION_ATT_SUBMODE_CARE_FREE, STABILIZATION_ATT_SUBMODE_FORWARD, STABILIZATION_ATT_SUBMODE_HEADING, STABILIZATION_MODE_ATTITUDE, stabilization_mode_changed(), STABILIZATION_MODE_DIRECT, STABILIZATION_MODE_NONE, and STABILIZATION_MODE_RATE.
void autopilot_static_set_motors_on | ( | bool | motors_on | ) |
Definition at line 334 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 196 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, RC_OK, and RadioControl::status.