Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "autopilot.h"
#include "autopilot_arming.h"
#include "subsystems/radio_control.h"
#include "subsystems/commands.h"
#include "subsystems/actuators.h"
#include "subsystems/electrical.h"
#include "subsystems/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 "subsystems/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 / NAV_FREQ) |
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... | |
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 / NAV_FREQ) |
Definition at line 110 of file autopilot_static.c.
#define UNLOCKED_HOME_MODE TRUE |
Definition at line 79 of file autopilot_static.c.
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 ABI_BROADCAST, AP_MODE_AUTO2, AP_MODE_KILL, autopilot, autopilot_arming_init(), autopilot_static_set_mode(), gps_lost, lateral_mode, LATERAL_MODE_MANUAL, 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 328 of file autopilot_static.c.
References ap_ahrs_is_aligned(), AP_ARMING_STATUS_AHRS_NOT_ALLIGNED, ap_electrical, AP_MODE_AUTO1, AP_MODE_AUTO2, AP_MODE_FAILSAFE, AP_MODE_GPS_OUT_OF_ORDER, 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_send_mode(), autopilot_set_kill_throttle(), autopilot_set_mode(), autopilot_static_set_mode(), commands, copy_from_to_fbw(), datalink_lost(), fbw_state, pprz_autopilot::flight_time, FLOAT_OF_PPRZ, GpsIsLost, guidance_h_read_rc(), guidance_v_read_rc(), h_ctl_pitch_setpoint, h_ctl_roll_setpoint, higher_than_max_altitude(), kill_switch_is_on(), pprz_autopilot::kill_throttle, pprz_autopilot::launch, mcu1_ppm_cpt, mcu1_status_update(), MIN_PPRZ, pprz_autopilot::mode, MODE_MANUAL, pprz_autopilot::motors_on, pprz_mode_update(), PPRZ_MUTEX_LOCK, PPRZ_MUTEX_UNLOCK, radio_control, RADIO_KILL_SWITCH, RADIO_PITCH, RADIO_ROLL, RADIO_THROTTLE, RADIO_YAW, RC_LOST_MODE, rc_settings(), THROTTLE_THRESHOLD_TAKEOFF, too_far_from_home, UNLOCKED_HOME_MODE, v_ctl_throttle_setpoint, 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, attitude_loop(), autopilot, autopilot_in_flight(), autopilot_static_set_mode(), commands, commands_failsafe, compute_dist2_to_home(), datalink_lost(), pprz_autopilot::detect_ground_once, dist2_to_home, 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_home(), nav_periodic_task(), NAV_PRESCALER, SetCommands, SetRotorcraftCommands, stabilization_cmd, pprz_autopilot::throttle, and 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_ahrs_is_aligned(), 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_zd_sp, pprz_autopilot::mode, MODE_STARTUP, SPEED_BFP_OF_REAL, stabilization_attitude_set_failsafe_setpoint(), and stabilization_cmd.
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.
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.