Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot.c File Reference

Autopilot. More...

+ Include dependency graph for autopilot.c:

Go to the source code of this file.

Macros

#define AUTOPILOT_IN_FLIGHT_TIME   20
 time steps for in_flight detection (at 20Hz, so 20=1second) More...
 
#define AUTOPILOT_IN_FLIGHT_MIN_SPEED   0.2
 minimum vertical speed for in_flight condition in m/s More...
 
#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL   2.0
 minimum vertical acceleration for in_flight condition in m/s^2 More...
 
#define AUTOPILOT_IN_FLIGHT_MIN_THRUST   500
 minimum thrust for in_flight condition in pprz_t units (max = 9600) More...
 
#define FAILSAFE_DESCENT_SPEED   1.5
 Set descent speed in failsafe mode. More...
 
#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

static int ahrs_is_aligned (void)
 
static void send_alive (void)
 
static void send_status (void)
 
static void send_energy (void)
 
static void send_fp (void)
 
static void send_rc (void)
 
static void send_rotorcraft_rc (void)
 
static void send_dl_value (void)
 
static void send_rotorcraft_cmd (void)
 
void autopilot_init (void)
 Autopilot inititalization. More...
 
void autopilot_periodic (void)
 
void autopilot_set_mode (uint8_t new_autopilot_mode)
 
void autopilot_check_in_flight (bool_t motors_on)
 
void autopilot_set_motors_on (bool_t motors_on)
 
void autopilot_on_rc_frame (void)
 

Variables

uint8_t autopilot_mode
 
uint8_t autopilot_mode_auto2
 
bool_t autopilot_in_flight
 
uint32_t autopilot_in_flight_counter
 
uint16_t autopilot_flight_time
 flight time in seconds. More...
 
bool_t autopilot_motors_on
 
bool_t kill_throttle
 
bool_t autopilot_rc
 
bool_t autopilot_power_switch
 
bool_t autopilot_ground_detected
 
bool_t autopilot_detect_ground_once
 

Detailed Description

Autopilot.

Definition in file autopilot.c.

Macro Definition Documentation

#define AUTOPILOT_IN_FLIGHT_MIN_ACCEL   2.0

minimum vertical acceleration for in_flight condition in m/s^2

Definition at line 75 of file autopilot.c.

Referenced by autopilot_check_in_flight().

#define AUTOPILOT_IN_FLIGHT_MIN_SPEED   0.2

minimum vertical speed for in_flight condition in m/s

Definition at line 70 of file autopilot.c.

Referenced by autopilot_check_in_flight().

#define AUTOPILOT_IN_FLIGHT_MIN_THRUST   500

minimum thrust for in_flight condition in pprz_t units (max = 9600)

Definition at line 80 of file autopilot.c.

Referenced by autopilot_check_in_flight().

#define AUTOPILOT_IN_FLIGHT_TIME   20

time steps for in_flight detection (at 20Hz, so 20=1second)

Definition at line 65 of file autopilot.c.

Referenced by autopilot_check_in_flight().

#define FAILSAFE_DESCENT_SPEED   1.5

Set descent speed in failsafe mode.

Definition at line 97 of file autopilot.c.

Referenced by autopilot_set_mode().

#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 103 of file autopilot.c.

Referenced by autopilot_periodic().

#define MODE_STARTUP   AP_MODE_KILL

Definition at line 119 of file autopilot.c.

Referenced by autopilot_init().

#define NAV_PRESCALER   (PERIODIC_FREQUENCY / NAV_FREQ)

Definition at line 278 of file autopilot.c.

Referenced by autopilot_periodic().

#define UNLOCKED_HOME_MODE   TRUE

Definition at line 125 of file autopilot.c.

Referenced by autopilot_on_rc_frame(), and pprz_mode_update().

Function Documentation

static int ahrs_is_aligned ( void  )
inlinestatic

Definition at line 85 of file autopilot.c.

References ahrs, AHRS_RUNNING, and Ahrs::status.

Referenced by autopilot_set_mode(), and autopilot_set_motors_on().

+ Here is the caller graph for this function:

void autopilot_check_in_flight ( bool_t  motors_on)

Definition at line 436 of file autopilot.c.

References autopilot_in_flight, autopilot_in_flight_counter, AUTOPILOT_IN_FLIGHT_MIN_ACCEL, AUTOPILOT_IN_FLIGHT_MIN_SPEED, AUTOPILOT_IN_FLIGHT_MIN_THRUST, AUTOPILOT_IN_FLIGHT_TIME, FALSE, stabilization_cmd, stateGetAccelNed_f(), stateGetSpeedNed_f(), and TRUE.

Referenced by failsafe_check().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void autopilot_set_motors_on ( bool_t  motors_on)

Definition at line 474 of file autopilot.c.

References ahrs_is_aligned(), AP_MODE_KILL, autopilot_arming_set(), autopilot_mode, autopilot_motors_on, FALSE, kill_throttle, and TRUE.

Referenced by actuators_ardrone_motor_status(), and autopilot_set_mode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void send_alive ( void  )
static

Definition at line 135 of file autopilot.c.

References DefaultChannel, and DefaultDevice.

Referenced by autopilot_init().

+ Here is the caller graph for this function:

static void send_dl_value ( void  )
static

Definition at line 221 of file autopilot.c.

References DefaultChannel, and DefaultDevice.

Referenced by autopilot_init().

+ Here is the caller graph for this function:

static void send_energy ( void  )
static

Definition at line 165 of file autopilot.c.

References Electrical::current, DefaultChannel, DefaultDevice, electrical, Electrical::energy, and Electrical::vsupply.

Referenced by autopilot_init().

+ Here is the caller graph for this function:

static void send_fp ( void  )
static
static void send_rc ( void  )
static

Definition at line 194 of file autopilot.c.

References DefaultChannel, DefaultDevice, radio_control, RADIO_CONTROL_NB_CHANNEL, and RadioControl::values.

Referenced by autopilot_init(), and init_fbw().

+ Here is the caller graph for this function:

static void send_rotorcraft_cmd ( void  )
static

Definition at line 225 of file autopilot.c.

References DefaultChannel, DefaultDevice, and stabilization_cmd.

Referenced by autopilot_init().

+ Here is the caller graph for this function:

static void send_rotorcraft_rc ( void  )
static

Definition at line 198 of file autopilot.c.

References DefaultChannel, DefaultDevice, radio_control, RADIO_KILL_SWITCH, RADIO_MODE, RADIO_PITCH, RADIO_ROLL, RADIO_THROTTLE, RADIO_YAW, RadioControl::status, and RadioControl::values.

Referenced by autopilot_init().

+ Here is the caller graph for this function:

Variable Documentation

bool_t autopilot_detect_ground_once

Definition at line 61 of file autopilot.c.

Referenced by autopilot_init(), autopilot_periodic(), and DetectGroundEvent().

uint16_t autopilot_flight_time

flight time in seconds.

Definition at line 52 of file autopilot.c.

bool_t autopilot_ground_detected
uint32_t autopilot_in_flight_counter

Definition at line 51 of file autopilot.c.

Referenced by autopilot_check_in_flight(), autopilot_init(), and autopilot_set_mode().

uint8_t autopilot_mode_auto2

Definition at line 48 of file autopilot.c.

Referenced by autopilot_init().

bool_t autopilot_power_switch

Definition at line 58 of file autopilot.c.

Referenced by autopilot_init().

bool_t autopilot_rc

Definition at line 57 of file autopilot.c.

Referenced by autopilot_init(), and main_event().

bool_t kill_throttle

Definition at line 55 of file autopilot.c.