Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
autopilot.h File Reference
#include "std.h"
#include "led.h"
#include "generated/airframe.h"
#include "subsystems/ins.h"
+ Include dependency graph for autopilot.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AP_MODE_FAILSAFE   0
 
#define AP_MODE_KILL   1
 
#define AP_MODE_RATE_DIRECT   2
 
#define AP_MODE_ATTITUDE_DIRECT   3
 
#define AP_MODE_RATE_RC_CLIMB   4
 
#define AP_MODE_ATTITUDE_RC_CLIMB   5
 
#define AP_MODE_ATTITUDE_CLIMB   6
 
#define AP_MODE_RATE_Z_HOLD   7
 
#define AP_MODE_ATTITUDE_Z_HOLD   8
 
#define AP_MODE_HOVER_DIRECT   9
 
#define AP_MODE_HOVER_CLIMB   10
 
#define AP_MODE_HOVER_Z_HOLD   11
 
#define AP_MODE_NAV   12
 
#define AP_MODE_RC_DIRECT   13
 
#define MODE_MANUAL   AP_MODE_RATE_DIRECT
 
#define MODE_AUTO1   AP_MODE_ATTITUDE_DIRECT
 
#define MODE_AUTO2   AP_MODE_ATTITUDE_Z_HOLD
 
#define THRESHOLD_1_PPRZ   (MIN_PPRZ / 2)
 
#define THRESHOLD_2_PPRZ   (MAX_PPRZ / 2)
 
#define AP_MODE_OF_PPRZ(_rc, _mode)
 
#define autopilot_KillThrottle(_kill)
 
#define autopilot_SetPowerSwitch(_v)
 
#define THRESHOLD_GROUND_DETECT   ACCEL_BFP_OF_REAL(15.)
 

Functions

void autopilot_init (void)
 
void autopilot_periodic (void)
 
void autopilot_on_rc_frame (void)
 
void autopilot_set_mode (uint8_t new_autopilot_mode)
 
void autopilot_set_motors_on (bool_t motors_on)
 
static void DetectGroundEvent (void)
 

Variables

uint8_t autopilot_mode
 
uint8_t autopilot_mode_auto2
 
bool_t autopilot_motors_on
 
bool_t autopilot_in_flight
 
bool_t kill_throttle
 
bool_t autopilot_rc
 
bool_t autopilot_power_switch
 
bool_t autopilot_detect_ground
 
bool_t autopilot_detect_ground_once
 
uint16_t autopilot_flight_time
 

Macro Definition Documentation

#define AP_MODE_ATTITUDE_CLIMB   6

Definition at line 38 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_ATTITUDE_DIRECT   3

Definition at line 35 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_ATTITUDE_RC_CLIMB   5

Definition at line 37 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_ATTITUDE_Z_HOLD   8

Definition at line 40 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_FAILSAFE   0
#define AP_MODE_HOVER_CLIMB   10

Definition at line 42 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_HOVER_DIRECT   9

Definition at line 41 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_HOVER_Z_HOLD   11

Definition at line 43 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_NAV   12

Definition at line 44 of file autopilot.h.

Referenced by autopilot_set_mode(), and failsafe_check().

#define AP_MODE_OF_PPRZ (   _rc,
  _mode 
)
Value:
{ \
if (_rc > THRESHOLD_2_PPRZ) \
else if (_rc > THRESHOLD_1_PPRZ) \
_mode = MODE_AUTO1; \
else \
_mode = MODE_MANUAL; \
}
#define THRESHOLD_1_PPRZ
Definition: autopilot.h:81
#define THRESHOLD_2_PPRZ
Definition: autopilot.h:82
#define MODE_AUTO1
Definition: autopilot.h:74
#define MODE_MANUAL
Definition: autopilot.h:71
uint8_t autopilot_mode_auto2
Definition: autopilot.c:32

Definition at line 84 of file autopilot.h.

Referenced by autopilot_on_rc_frame().

#define AP_MODE_RATE_DIRECT   2

Definition at line 34 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_RATE_RC_CLIMB   4

Definition at line 36 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_RATE_Z_HOLD   7

Definition at line 39 of file autopilot.h.

Referenced by autopilot_set_mode().

#define AP_MODE_RC_DIRECT   13

Definition at line 45 of file autopilot.h.

Referenced by autopilot_set_mode().

#define autopilot_KillThrottle (   _kill)
Value:
{ \
if (_kill) \
}
#define FALSE
Definition: imu_chimu.h:141
#define TRUE
Definition: imu_chimu.h:144
void autopilot_set_motors_on(bool_t motors_on)
Definition: autopilot.c:234

Definition at line 93 of file autopilot.h.

#define autopilot_SetPowerSwitch (   _v)
Value:
{ \
}
bool_t autopilot_power_switch
Definition: autopilot.c:42

Definition at line 107 of file autopilot.h.

#define MODE_AUTO1   AP_MODE_ATTITUDE_DIRECT

Definition at line 74 of file autopilot.h.

#define MODE_AUTO2   AP_MODE_ATTITUDE_Z_HOLD

Definition at line 77 of file autopilot.h.

Referenced by autopilot_init().

#define MODE_MANUAL   AP_MODE_RATE_DIRECT

Definition at line 71 of file autopilot.h.

Referenced by autopilot_arming_check_motors_on(), and autopilot_arming_set().

#define THRESHOLD_1_PPRZ   (MIN_PPRZ / 2)

Definition at line 81 of file autopilot.h.

#define THRESHOLD_2_PPRZ   (MAX_PPRZ / 2)

Definition at line 82 of file autopilot.h.

#define THRESHOLD_GROUND_DETECT   ACCEL_BFP_OF_REAL(15.)

Definition at line 113 of file autopilot.h.

Referenced by DetectGroundEvent().

Function Documentation

void autopilot_init ( void  )
void autopilot_on_rc_frame ( void  )
void autopilot_periodic ( void  )

Definition at line 87 of file autopilot.c.

References AP_MODE_FAILSAFE, AP_MODE_KILL, autopilot_detect_ground, autopilot_in_flight, autopilot_mode, autopilot_motors_on, autopilot_set_mode(), commands_failsafe, FALSE, guidance_h_run(), guidance_v_run(), nav_periodic_task(), NAV_PRESCALER, SetCommands, and stabilization_cmd.

Referenced by main_periodic().

+ 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 234 of file autopilot.c.

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

Referenced by autopilot_set_mode().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void DetectGroundEvent ( void  )
inlinestatic

Definition at line 115 of file autopilot.h.

References AP_MODE_FAILSAFE, autopilot_detect_ground, autopilot_detect_ground_once, autopilot_mode, FALSE, ins_ltp_accel, THRESHOLD_GROUND_DETECT, TRUE, and NedCoor_i::z.

Referenced by main_event().

+ Here is the caller graph for this function:

Variable Documentation

bool_t autopilot_detect_ground
bool_t autopilot_detect_ground_once

Definition at line 45 of file autopilot.c.

Referenced by autopilot_init(), and DetectGroundEvent().

uint16_t autopilot_flight_time

Definition at line 36 of file autopilot.c.

Referenced by autopilot_init(), and main_periodic().

uint8_t autopilot_mode_auto2

Definition at line 32 of file autopilot.c.

Referenced by autopilot_init().

bool_t autopilot_power_switch

Definition at line 42 of file autopilot.c.

Referenced by autopilot_init().

bool_t autopilot_rc

Definition at line 41 of file autopilot.c.

Referenced by autopilot_init(), and main_event().

bool_t kill_throttle