|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
37 #include "generated/flight_plan.h"
49 #if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
59 #define RC_LOST_MODE AP_MODE_HOME
64 #ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
68 static void new_att_cb(
uint8_t sender_id __attribute__((unused)),
69 uint32_t stamp __attribute__((unused)),
70 struct Int32Rates *gyro __attribute__((unused)))
98 #ifdef AHRS_TRIGGERED_ATTITUDE_LOOP
99 AbiBindMsgIMU_GYRO_INT32(
ABI_BROADCAST, &new_att_ev, &new_att_cb);
118 uint8_t rc_lost_while_in_use = bit_is_set(imcu_get_status(), STATUS_RADIO_REALLY_LOST) &&
122 if (rc_lost_while_in_use) {
126 #ifdef RADIO_KILL_SWITCH
139 if (bit_is_set(imcu_get_status(), AVERAGED_CHANNELS_SENT)) {
141 mode_changed |= pprz_mode_changed;
142 #if defined RADIO_CALIB && defined RADIO_CONTROL_SETTINGS
144 bool calib_mode_changed = RcSettingsModeUpdate(
fbw_state->channels);
146 rc_settings(calib_mode_changed || pprz_mode_changed);
147 mode_changed |= calib_mode_changed;
153 #if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
163 #if H_CTL_YAW_LOOP && defined RADIO_YAW
177 #endif // RADIO_CONTROL
214 #ifdef FAILSAFE_DELAY_WITHOUT_GPS
215 #define GpsTimeoutError (sys_time.nb_sec - gps.last_3dfix_time > FAILSAFE_DELAY_WITHOUT_GPS)
223 #if defined FAILSAFE_DELAY_WITHOUT_GPS
230 if (GpsTimeoutError) {
259 #if DOWNLINK && !defined PERIOD_NAVIGATION_Ap_0 // If not sent periodically (in default 0 mode)
272 #ifdef H_CTL_RATE_LOOP
289 #if CTRL_VERTICAL_LANDING
302 #if CTRL_VERTICAL_LANDING
306 #if defined V_CTL_THROTTLE_IDLE
310 #ifdef V_CTL_POWER_CTL_BAT_NOMINAL
335 #if defined MCU_SPI_LINK || defined MCU_UART_LINK || defined MCU_CAN_LINK
337 #elif defined INTER_MCU && defined SINGLE_MCU
348 #if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
357 #ifndef RADIO_AUTO_MODE
360 INFO(
"Using RADIO_AUTO_MODE to switch between AUTO1 and AUTO2.")
375 #endif // RADIO_AUTO_MODE
380 #else // not RADIO_CONTROL
389 uint8_t new_status = imcu_get_status();
391 bool changed = ((
mcu1_status & MASK_FBW_CHANGED) != (new_status & MASK_FBW_CHANGED));
405 #ifdef SetAutoCommandsFromRC
407 #elif defined RADIO_YAW && defined COMMAND_YAW
static uint8_t pprz_mode_update(void)
Update paparazzi mode.
#define FLOAT_OF_PPRZ(pprz, center, travel)
pprz_t to float with saturation
#define V_CTL_MODE_AUTO_ALT
static uint8_t mcu1_ppm_cpt
#define AP_COMMAND_SET_PITCH(_pitch)
void autopilot_static_set_motors_on(bool motors_on)
#define LATERAL_MODE_MANUAL
uint16_t flight_time
flight time in seconds
uint8_t mode
current autopilot mode
volatile bool inter_mcu_received_ap
Event structure to store callbacks in a linked list.
struct fbw_state * fbw_state
void autopilot_static_init(void)
Static autopilot API.
#define PPRZ_MUTEX_UNLOCK(_mtx)
void WEAK autopilot_event(void)
AP event call.
#define AP_MODE_OF_PULSE(pprz)
Get mode from pulse.
void nav_home(void)
Home mode navigation (circle around HOME)
float vsupply
supply voltage in V
float h_ctl_roll_setpoint
static void copy_from_to_fbw(void)
Send back uncontrolled channels.
#define UNLOCKED_HOME_MODE
static bool datalink_lost(void)
struct Electrical ap_electrical
bool motors_on
motor status
void h_ctl_course_loop(void)
Device independent GPS code (interface)
struct pprz_autopilot autopilot
Global autopilot structure.
#define AP_COMMAND_SET_YAW(_yaw)
void h_ctl_attitude_loop(void)
static bool higher_than_max_altitude(void)
void WEAK autopilot_send_mode(void)
send autopilot mode actual implementation is firmware dependent
pprz_t v_ctl_throttle_slewed
#define AP_COMMAND_SET_THROTTLE(_throttle)
#define AP_COMMAND_SET_CL(_cl)
uint8_t mcu1_status
Second MCU status (FBW part)
#define AP_COMMAND_SET_ROLL(_roll)
AP command setter macros for usual commands.
void v_ctl_altitude_loop(void)
outer loop
Common code for AP and FBW telemetry.
#define PPRZ_MUTEX_LOCK(_mtx)
void navigation_task(void)
Compute desired_course.
void autopilot_set_kill_throttle(bool kill)
set kill throttle
#define V_CTL_MODE_AUTO_THROTTLE
#define THROTTLE_THRESHOLD_TAKEOFF
Takeoff detection threshold from throttle.
pprz_t v_ctl_throttle_setpoint
void common_nav_periodic_task_4Hz()
void autopilot_static_set_mode(uint8_t new_autopilot_mode)
pprz_t h_ctl_elevator_setpoint
#define AP_MODE_GPS_OUT_OF_ORDER
#define SEND_NAVIGATION(_trans, _dev)
void autopilot_static_periodic(void)
void v_ctl_throttle_slew(void)
Computes slewed throttle from throttle setpoint called at 20Hz.
void v_ctl_climb_loop(void)
Auto-throttle inner loop.
#define LATERAL_MODE_COURSE
bool autopilot_set_mode(uint8_t new_autopilot_mode)
set autopilot mode
#define RC_LOST_MODE
mode to enter when RC is lost in AP_MODE_MANUAL or AP_MODE_AUTO1
void autopilot_static_SetModeHandler(float new_autopilot_mode)
#define V_CTL_MODE_LANDING
void nav_periodic_task(void)
Navigation main: call to the code generated from the XML flight plan.
#define AP_MODE_MANUAL
AP modes.
static uint8_t mcu1_status_update(void)
struct ap_state * ap_state
float h_ctl_pitch_setpoint
pprz_t h_ctl_aileron_setpoint
uint8_t autopilot_get_mode(void)
get autopilot mode
float v_ctl_pitch_setpoint
#define RADIO_KILL_SWITCH
pprz_t nav_throttle_setpoint
void v_ctl_landing_loop(void)
void autopilot_static_on_rc_frame(void)
Function to be called when a message from FBW is available.
#define V_CTL_MODE_AUTO_CLIMB
#define ABI_BROADCAST
Broadcast address.
volatile uint8_t new_ins_attitude
bool kill_throttle
allow autopilot to use throttle
void rc_settings(bool mode_changed)
Includes generated code from tuning_rc.xml.
bool launch
request launch
void nav_without_gps(void)
Failsafe navigation without position estimation.