Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_static.h File Reference

Autopilot static implementation. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AP_MODE_KILL   0
 Static autopilot modes. More...
 
#define AP_MODE_FAILSAFE   1
 
#define AP_MODE_HOME   2
 
#define AP_MODE_RATE_DIRECT   3
 
#define AP_MODE_ATTITUDE_DIRECT   4
 
#define AP_MODE_RATE_RC_CLIMB   5
 
#define AP_MODE_ATTITUDE_RC_CLIMB   6
 
#define AP_MODE_ATTITUDE_CLIMB   7
 
#define AP_MODE_RATE_Z_HOLD   8
 
#define AP_MODE_ATTITUDE_Z_HOLD   9
 
#define AP_MODE_HOVER_DIRECT   10
 
#define AP_MODE_HOVER_CLIMB   11
 
#define AP_MODE_HOVER_Z_HOLD   12
 
#define AP_MODE_NAV   13
 
#define AP_MODE_RC_DIRECT   14
 
#define AP_MODE_CARE_FREE_DIRECT   15
 
#define AP_MODE_FORWARD   16
 
#define AP_MODE_MODULE   17
 
#define AP_MODE_FLIP   18
 
#define AP_MODE_GUIDED   19
 
#define AP_ARMING_STATUS_NO_RC   0
 
#define AP_ARMING_STATUS_WAITING   1
 
#define AP_ARMING_STATUS_ARMING   2
 
#define AP_ARMING_STATUS_ARMED   3
 
#define AP_ARMING_STATUS_DISARMING   4
 
#define AP_ARMING_STATUS_KILLED   5
 
#define AP_ARMING_STATUS_YAW_CENTERED   6
 
#define AP_ARMING_STATUS_THROTTLE_DOWN   7
 
#define AP_ARMING_STATUS_NOT_MODE_MANUAL   8
 
#define AP_ARMING_STATUS_UNARMED_IN_AUTO   9
 
#define AP_ARMING_STATUS_THROTTLE_NOT_DOWN   10
 
#define AP_ARMING_STATUS_STICKS_NOT_CENTERED   11
 
#define AP_ARMING_STATUS_PITCH_NOT_CENTERED   12
 
#define AP_ARMING_STATUS_ROLL_NOT_CENTERED   13
 
#define AP_ARMING_STATUS_YAW_NOT_CENTERED   14
 
#define AP_ARMING_STATUS_AHRS_NOT_ALLIGNED   15
 
#define AP_ARMING_STATUS_OUT_OF_GEOFENCE   16
 
#define AP_ARMING_STATUS_LOW_BATTERY   17
 
#define MODE_MANUAL   AP_MODE_ATTITUDE_DIRECT
 Default RC mode. More...
 
#define MODE_AUTO1   AP_MODE_HOVER_Z_HOLD
 
#define MODE_AUTO2   AP_MODE_NAV
 

Functions

void autopilot_static_init (void)
 Specific function for static AP. More...
 
void autopilot_static_periodic (void)
 
void autopilot_static_on_rc_frame (void)
 Function to be called when a message from FBW is available. More...
 
void autopilot_static_set_mode (uint8_t new_autopilot_mode)
 
void autopilot_static_SetModeHandler (float new_autopilot_mode)
 AP mode setting handler. More...
 
void autopilot_static_set_motors_on (bool motors_on)
 

Detailed Description

Autopilot static implementation.

Definition in file autopilot_static.h.

Macro Definition Documentation

#define AP_ARMING_STATUS_AHRS_NOT_ALLIGNED   15
#define AP_ARMING_STATUS_ARMED   3

Definition at line 61 of file autopilot_static.h.

Referenced by autopilot_arming_check_motors_on().

#define AP_ARMING_STATUS_ARMING   2

Definition at line 60 of file autopilot_static.h.

Referenced by autopilot_arming_check_motors_on().

#define AP_ARMING_STATUS_DISARMING   4

Definition at line 62 of file autopilot_static.h.

Referenced by autopilot_arming_check_motors_on().

#define AP_ARMING_STATUS_KILLED   5

Definition at line 63 of file autopilot_static.h.

Referenced by autopilot_arming_check_motors_on().

#define AP_ARMING_STATUS_LOW_BATTERY   17

Definition at line 75 of file autopilot_static.h.

#define AP_ARMING_STATUS_NO_RC   0

Definition at line 58 of file autopilot_static.h.

#define AP_ARMING_STATUS_NOT_MODE_MANUAL   8

Definition at line 66 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_ARMING_STATUS_OUT_OF_GEOFENCE   16

Definition at line 74 of file autopilot_static.h.

#define AP_ARMING_STATUS_PITCH_NOT_CENTERED   12

Definition at line 70 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_ARMING_STATUS_ROLL_NOT_CENTERED   13

Definition at line 71 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_ARMING_STATUS_STICKS_NOT_CENTERED   11

Definition at line 69 of file autopilot_static.h.

#define AP_ARMING_STATUS_THROTTLE_DOWN   7

Definition at line 65 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_ARMING_STATUS_THROTTLE_NOT_DOWN   10
#define AP_ARMING_STATUS_UNARMED_IN_AUTO   9

Definition at line 67 of file autopilot_static.h.

#define AP_ARMING_STATUS_WAITING   1

Definition at line 59 of file autopilot_static.h.

Referenced by autopilot_arming_check_motors_on().

#define AP_ARMING_STATUS_YAW_CENTERED   6

Definition at line 64 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_ARMING_STATUS_YAW_NOT_CENTERED   14

Definition at line 72 of file autopilot_static.h.

Referenced by autopilot_arming_check_valid().

#define AP_MODE_ATTITUDE_CLIMB   7

Definition at line 42 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_ATTITUDE_DIRECT   4

Definition at line 39 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_ATTITUDE_RC_CLIMB   6

Definition at line 41 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_ATTITUDE_Z_HOLD   9

Definition at line 44 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_CARE_FREE_DIRECT   15

Definition at line 50 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_FLIP   18
#define AP_MODE_FORWARD   16

Definition at line 51 of file autopilot_static.h.

Referenced by autopilot_static_set_mode().

#define AP_MODE_HOME   2

Definition at line 37 of file autopilot_static.h.

#define AP_MODE_HOVER_CLIMB   11

Definition at line 46 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_HOVER_DIRECT   10

Definition at line 45 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_HOVER_Z_HOLD   12

Definition at line 47 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_MODULE   17
#define AP_MODE_RATE_DIRECT   3

Definition at line 38 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_RATE_RC_CLIMB   5

Definition at line 40 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_RATE_Z_HOLD   8

Definition at line 43 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define AP_MODE_RC_DIRECT   14

Definition at line 49 of file autopilot_static.h.

Referenced by autopilot_static_set_mode(), and mavlink_send_heartbeat().

#define MODE_AUTO1   AP_MODE_HOVER_Z_HOLD

Definition at line 83 of file autopilot_static.h.

Referenced by ap_mode_of_3way_switch().

#define MODE_AUTO2   AP_MODE_NAV

Function Documentation

void autopilot_static_init ( void  )

Specific function for static AP.

Specific function for static AP.

Static autopilot functions.

Todo:
, properly implement or remove
Todo:
: properly implement/fix a triggered attitude loop
Todo:
: properly implement/fix a triggered attitude loop

Definition at line 90 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.

Referenced by init_ap(), and main_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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();

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 112 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.

Referenced by autopilot_on_rc_frame().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void autopilot_static_set_mode ( uint8_t  new_autopilot_mode)

Definition at line 194 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.

Referenced by autopilot_set_mode(), autopilot_static_init(), autopilot_static_on_rc_frame(), autopilot_static_periodic(), autopilot_static_SetModeHandler(), guidance_h_module_run(), and guidance_v_module_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void autopilot_static_set_motors_on ( bool  motors_on)

Definition at line 206 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.

Referenced by autopilot_set_motors_on().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void autopilot_static_SetModeHandler ( float  mode)

AP mode setting handler.

Checks RC status before calling autopilot_static_set_mode function

Definition at line 201 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(), radio_control, RC_OK, and RadioControl::status.

Referenced by autopilot_SetModeHandler().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: