|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
45 #if USE_STABILIZATION_RATE
51 #include "generated/settings.h"
56 #if NO_GPS_NEEDED_FOR_NAV
57 #define GpsIsLost() FALSE
59 #define GpsIsLost() TRUE
67 #ifndef FAILSAFE_MODE_TOO_FAR_FROM_HOME
68 #define FAILSAFE_MODE_TOO_FAR_FROM_HOME AP_MODE_FAILSAFE
73 #define MODE_STARTUP AP_MODE_KILL
77 #ifndef UNLOCKED_HOME_MODE
78 #if MODE_AUTO1 == AP_MODE_HOME
79 #define UNLOCKED_HOME_MODE TRUE
80 PRINT_CONFIG_MSG(
"Enabled UNLOCKED_HOME_MODE since MODE_AUTO1 is AP_MODE_HOME")
81 #elif MODE_AUTO2 == AP_MODE_HOME
82 #define UNLOCKED_HOME_MODE TRUE
83 PRINT_CONFIG_MSG(
"Enabled UNLOCKED_HOME_MODE since MODE_AUTO2 is AP_MODE_HOME")
85 #define UNLOCKED_HOME_MODE FALSE
89 #if MODE_MANUAL == AP_MODE_NAV
90 #error "MODE_MANUAL mustn't be AP_MODE_NAV"
110 #define NAV_PRESCALER (PERIODIC_FREQUENCY / NAV_FREQ)
142 #if FAILSAFE_GROUND_DETECT
143 INFO(
"Using FAILSAFE_GROUND_DETECT: KILL")
202 switch (new_autopilot_mode) {
204 #ifndef KILL_AS_FAILSAFE
219 #if USE_STABILIZATION_RATE
247 #ifdef GUIDANCE_H_MODE_MODULE_SETTING
261 switch (new_autopilot_mode) {
263 #ifndef KILL_AS_FAILSAFE
299 #ifdef GUIDANCE_V_MODE_MODULE_SETTING
334 #ifdef RADIO_AUTO_MODE
335 INFO(
"Using RADIO_AUTO_MODE to switch between AUTO1 and AUTO2.")
336 uint8_t new_autopilot_mode = ap_mode_of_two_switches();
338 #ifdef RADIO_MODE_2x3
339 uint8_t new_autopilot_mode = ap_mode_of_3x2way_switch();
378 #ifdef SetAutoCommandsFromRC
383 #ifdef SetCommandsFromRC
#define GUIDANCE_H_MODE_MODULE_SETTING
void autopilot_set_in_flight(bool in_flight)
set in_flight flag
#define AP_MODE_ATTITUDE_DIRECT
#define AP_MODE_HOVER_CLIMB
void autopilot_static_set_motors_on(bool motors_on)
#define GUIDANCE_H_MODE_ATTITUDE
float dist2_to_home
squared distance to home waypoint
void guidance_v_mode_changed(uint8_t new_mode)
void compute_dist2_to_home(void)
Computes squared distance to the HOME waypoint potentially sets too_far_from_home.
void guidance_h_mode_changed(uint8_t new_mode)
uint8_t mode
current autopilot mode
void guidance_v_read_rc(void)
#define GUIDANCE_H_MODE_GUIDED
#define GUIDANCE_V_MODE_CLIMB
bool ap_ahrs_is_aligned(void)
Display descent speed in failsafe mode if needed.
#define AP_MODE_ATTITUDE_CLIMB
#define SPEED_BFP_OF_REAL(_af)
void autopilot_static_init(void)
Static autopilot API.
#define GUIDANCE_H_MODE_RC_DIRECT
#define AP_MODE_ATTITUDE_Z_HOLD
#define AP_MODE_RATE_Z_HOLD
const pprz_t commands_failsafe[COMMANDS_NB]
void nav_home(void)
Home mode navigation (circle around HOME)
#define AP_MODE_KILL
Static autopilot modes.
#define GUIDANCE_H_MODE_FLIP
#define AP_MODE_CARE_FREE_DIRECT
#define UNLOCKED_HOME_MODE
static bool datalink_lost(void)
bool autopilot_in_flight(void)
get in_flight flag
#define AP_MODE_HOVER_Z_HOLD
void stabilization_attitude_set_failsafe_setpoint(void)
bool motors_on
motor status
Device independent GPS code (interface)
struct pprz_autopilot autopilot
Global autopilot structure.
#define GUIDANCE_H_MODE_HOVER
#define GUIDANCE_V_MODE_RC_CLIMB
bool in_flight
in flight status
void guidance_h_run(bool in_flight)
#define GUIDANCE_H_MODE_FORWARD
#define GUIDANCE_V_MODE_KILL
#define GUIDANCE_V_MODE_RC_DIRECT
pprz_t throttle
throttle level as will be displayed in GCS
int32_t guidance_v_zd_sp
vertical speed setpoint in meter/s (input).
#define AP_MODE_HOVER_DIRECT
static bool higher_than_max_altitude(void)
uint8_t ap_mode_of_3way_switch(void)
get autopilot mode as set by RADIO_MODE 3-way switch
static void autopilot_arming_init(void)
bool ground_detected
automatic detection of landing
float failsafe_mode_dist2
maximum squared distance to home wp before going to failsafe mode
#define AP_MODE_ATTITUDE_RC_CLIMB
void guidance_v_run(bool in_flight)
#define GUIDANCE_V_MODE_HOVER
static const ShellCommand commands[]
#define GUIDANCE_H_MODE_KILL
void autopilot_set_motors_on(bool motors_on)
turn motors on/off, eventually depending of the current mode set kill_throttle accordingly FIXME is i...
#define GUIDANCE_V_MODE_FLIP
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
#define SetRotorcraftCommands(_cmd, _in_flight, _motors_on)
#define GUIDANCE_H_MODE_RATE
void autopilot_static_set_mode(uint8_t new_autopilot_mode)
#define FAILSAFE_MODE_TOO_FAR_FROM_HOME
Mode that is set when the plane is really too far from home.
#define AP_MODE_RC_DIRECT
void autopilot_static_periodic(void)
static bool kill_switch_is_on(void)
#define AP_ARMING_STATUS_AHRS_NOT_ALLIGNED
#define GUIDANCE_V_MODE_MODULE_SETTING
#define GUIDANCE_V_MODE_NAV
void guidance_h_read_rc(bool in_flight)
#define GUIDANCE_V_MODE_GUIDED
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
void autopilot_static_SetModeHandler(float new_autopilot_mode)
void nav_periodic_task(void)
Navigation main: call to the code generated from the XML flight plan.
static void autopilot_arming_check_motors_on(void)
State machine to check if motors should be turned ON or OFF using the kill switch.
static void autopilot_arming_set(bool motors_on)
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
Hardware independent code for commands handling.
#define FAILSAFE_DESCENT_SPEED
Set descent speed in failsafe mode.
#define GUIDANCE_H_MODE_NAV
#define MODE_MANUAL
Default RC mode.
void autopilot_static_on_rc_frame(void)
Function to be called when a message from FBW is available.
#define AP_MODE_RATE_DIRECT
bool kill_throttle
allow autopilot to use throttle
uint8_t arming_status
arming status
#define GUIDANCE_H_MODE_CARE_FREE
#define AP_MODE_RATE_RC_CLIMB
bool detect_ground_once
enable automatic detection of ground (one shot)
struct RadioControl radio_control
pprz_t values[RADIO_CONTROL_NB_CHANNEL]