|
Paparazzi UAS v7.1_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. | |
| #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. | |
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.
Referenced by autopilot_static_periodic().
| #define MODE_STARTUP AP_MODE_KILL |
Definition at line 72 of file autopilot_static.c.
Referenced by autopilot_static_init().
| #define NAV_PRESCALER (PERIODIC_FREQUENCY / NAVIGATION_FREQUENCY) |
Definition at line 109 of file autopilot_static.c.
Referenced by autopilot_static_periodic().
| #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.
| #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().
| 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 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.
| 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(), 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 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.
| 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(), commands, commands_failsafe, compute_dist2_to_home(), datalink_lost(), FAILSAFE_MODE_TOO_FAR_FROM_HOME, guidance_h, GUIDANCE_H_MODE_NONE, guidance_h_run(), guidance_v_run(), higher_than_max_altitude(), nav, nav_home(), nav_periodic_task(), NAV_PRESCALER, SetRotorcraftCommands, stabilization, stabilization_get_failsafe_sp(), stabilization_run(), th_sp_from_thrust_i(), THRUST_AXIS_Z, and thrust_sp.
| void autopilot_static_set_mode | ( | uint8_t | new_autopilot_mode | ) |
Definition at line 216 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(), 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(), 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 338 of file autopilot_static.c.
References AP_MODE_KILL, autopilot, and autopilot_arming_set().
| 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.