Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Rotorcraft FBW main loop. More...
#include <inttypes.h>
#include "mcu.h"
#include "led.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/commands.h"
#include "subsystems/actuators.h"
#include "subsystems/electrical.h"
#include "subsystems/radio_control.h"
#include "subsystems/intermcu/intermcu_fbw.h"
#include "firmwares/rotorcraft/main_fbw.h"
#include "firmwares/rotorcraft/autopilot_rc_helpers.h"
#include "generated/modules.h"
Go to the source code of this file.
Macros | |
#define | MODULES_C |
#define | And(x, y) ((x) && (y)) |
#define | Or(x, y) ((x) || (y)) |
#define | Min(x, y) (x < y ? x : y) |
#define | Max(x, y) (x > y ? x : y) |
#define | LessThan(_x, _y) ((_x) < (_y)) |
#define | MoreThan(_x, _y) ((_x) > (_y)) |
Enumerations | |
enum | fbw_mode_enum { FBW_MODE_MANUAL = 0, FBW_MODE_AUTO = 1, FBW_MODE_FAILSAFE = 2 } |
Fly by wire modes. More... | |
Functions | |
int | main (void) |
Real main function handling initialization, periodic- and event functions. More... | |
STATIC_INLINE void | main_init (void) |
Main initialization. More... | |
STATIC_INLINE void | handle_periodic_tasks (void) |
STATIC_INLINE void | telemetry_periodic (void) |
STATIC_INLINE void | fbw_safety_check (void) |
STATIC_INLINE void | main_periodic (void) |
static void | fbw_on_rc_frame (void) |
Callback when we received an RC frame. More... | |
static void | fbw_on_ap_command (void) |
Callback when receive commands from the AP. More... | |
STATIC_INLINE void | main_event (void) |
Variables | |
fbw_mode_enum | fbw_mode |
bool | fbw_motors_on = false |
tid_t | main_periodic_tid |
id for main_periodic() timer More... | |
tid_t | modules_tid |
id for modules_periodic_task() timer More... | |
tid_t | radio_control_tid |
id for radio_control_periodic_task() timer More... | |
tid_t | electrical_tid |
id for electrical_periodic() timer More... | |
tid_t | telemetry_tid |
id for telemetry_periodic() timer More... | |
Rotorcraft FBW main loop.
Definition in file main_fbw.c.
#define And | ( | x, | |
y | |||
) | ((x) && (y)) |
Definition at line 50 of file main_fbw.c.
#define LessThan | ( | _x, | |
_y | |||
) | ((_x) < (_y)) |
Definition at line 54 of file main_fbw.c.
#define Max | ( | x, | |
y | |||
) | (x > y ? x : y) |
Definition at line 53 of file main_fbw.c.
Referenced by airspeed_adc_update(), eas_from_dynamic_pressure(), formation_flight(), gls_run(), h_ctl_course_loop(), h_ctl_pitch_loop(), h_ctl_roll_loop(), ms45xx_i2c_event(), nav_anemotaxis(), nav_approaching_xy(), nav_circle_XY(), nav_eight(), nav_route(), nav_route_xy(), nav_survey_rectangle(), nav_survey_rectangle_init(), nav_survey_rectangle_rotorcraft_run(), nav_survey_rectangle_rotorcraft_setup(), pbn_read_event(), periodic_report_sysmon(), potential_task(), spi_submit(), SpiTransmit(), and tcas_periodic_task_4Hz().
#define Min | ( | x, | |
y | |||
) | (x < y ? x : y) |
Definition at line 52 of file main_fbw.c.
Referenced by gh_set_max_speed(), gps_ubx_read_message(), guidance_h_traj_run(), guidance_v_run(), h_ctl_course_loop(), mavlink_send_gps_status(), nav_circle_XY(), nav_survey_rectangle(), nav_survey_rectangle_init(), nav_survey_rectangle_rotorcraft_run(), nav_survey_rectangle_rotorcraft_setup(), parse_xsens700_msg(), parse_xsens_msg(), RadioControlEventImp(), and tcas_periodic_task_4Hz().
#define MODULES_C |
Definition at line 46 of file main_fbw.c.
#define MoreThan | ( | _x, | |
_y | |||
) | ((_x) > (_y)) |
Definition at line 55 of file main_fbw.c.
#define Or | ( | x, | |
y | |||
) | ((x) || (y)) |
Definition at line 51 of file main_fbw.c.
enum fbw_mode_enum |
Fly by wire modes.
Enumerator | |
---|---|
FBW_MODE_MANUAL | |
FBW_MODE_AUTO | |
FBW_MODE_FAILSAFE |
Definition at line 59 of file main_fbw.c.
|
static |
Callback when receive commands from the AP.
Definition at line 275 of file main_fbw.c.
References fbw_mode, FBW_MODE_AUTO, intermcu_commands, and SetCommands.
Referenced by main_event().
|
static |
Callback when we received an RC frame.
Definition at line 244 of file main_fbw.c.
References AP_LOST_FBW_MODE, commands, commands_failsafe, fbw_mode, FBW_MODE_AUTO, FBW_MODE_MANUAL, fbw_motors_on, intermcu, INTERMCU_LOST, intermcu_on_rc_frame(), MIN_PPRZ, radio_control, RADIO_FBW_MODE, SetCommands, intermcu_t::status, and RadioControl::values.
Referenced by main_event().
STATIC_INLINE void fbw_safety_check | ( | void | ) |
Definition at line 152 of file main_fbw.c.
References AP_LOST_FBW_MODE, fbw_mode, FBW_MODE_AUTO, FBW_MODE_FAILSAFE, FBW_MODE_MANUAL, intermcu, INTERMCU_LOST, radio_control, RC_LOST_FBW_MODE, RC_LOST_IN_AUTO_FBW_MODE, RC_REALLY_LOST, RadioControl::status, and intermcu_t::status.
Referenced by main_periodic().
STATIC_INLINE void handle_periodic_tasks | ( | void | ) |
Definition at line 123 of file main_fbw.c.
References baro_periodic(), electrical_periodic(), electrical_tid, failsafe_check(), main_periodic(), main_periodic_tid, modules_tid, radio_control_periodic_task(), radio_control_tid, sys_time_check_and_ack_timer(), telemetry_periodic(), and telemetry_tid.
Referenced by main().
int main | ( | void | ) |
Real main function handling initialization, periodic- and event functions.
Definition at line 75 of file main_fbw.c.
References handle_periodic_tasks(), main_event(), and main_init().
|
inline |
Definition at line 283 of file main_fbw.c.
References autopilot_on_rc_frame(), autopilot_rc, BaroEvent, DatalinkEvent, DetectGroundEvent(), fbw_on_ap_command(), fbw_on_rc_frame(), InterMcuEvent(), mcu_event(), and RadioControlEvent.
Referenced by main().
|
inline |
Main initialization.
Definition at line 88 of file main_fbw.c.
References ahrs_aligner_init(), ahrs_init(), autopilot_init(), baro_init(), BARO_PERIODIC_FREQUENCY, Imu::body_to_imu, downlink_init(), electrical_init(), electrical_tid, failsafe_check(), fbw_mode, FBW_MODE_FAILSAFE, imu, intermcu_init(), main_periodic_tid, mcu_init(), mcu_int_enable, modules_tid, motor_mixing_init(), orientationGetQuat_f(), radio_control_init(), radio_control_tid, settings_init(), stateInit(), sys_time_register_timer(), TELEMETRY_FREQUENCY, telemetry_tid, and waypoints_localize_all().
Referenced by main().
|
inline |
Definition at line 188 of file main_fbw.c.
References autopilot_flight_time, autopilot_in_flight, autopilot_mode, autopilot_motors_on, autopilot_periodic(), commands, commands_failsafe, datalink_time, fbw_mode, FBW_MODE_AUTO, FBW_MODE_FAILSAFE, FBW_MODE_MANUAL, fbw_motors_on, fbw_safety_check(), intermcu, intermcu_periodic(), intermcu_set_actuators(), LED_OFF, LED_ON, LED_PERIODIC, LED_TOGGLE, PPRZ_BAUD, and SetCommands.
Referenced by handle_periodic_tasks().
STATIC_INLINE void telemetry_periodic | ( | void | ) |
Definition at line 142 of file main_fbw.c.
References DefaultChannel, DefaultDevice, DefaultPeriodic, fbw_mode, intermcu_send_status(), and send_autopilot_version().
Referenced by handle_periodic_tasks().
tid_t electrical_tid |
id for electrical_periodic() timer
Definition at line 71 of file main_fbw.c.
fbw_mode_enum fbw_mode |
Definition at line 60 of file main_fbw.c.
bool fbw_motors_on = false |
Definition at line 61 of file main_fbw.c.
Referenced by fbw_on_rc_frame(), and main_periodic().
tid_t main_periodic_tid |
id for main_periodic() timer
Definition at line 68 of file main_fbw.c.
Referenced by handle_periodic_tasks(), and main_init().
tid_t modules_tid |
id for modules_periodic_task() timer
Definition at line 69 of file main_fbw.c.
Referenced by handle_periodic_tasks(), and main_init().
tid_t radio_control_tid |
id for radio_control_periodic_task() timer
Definition at line 70 of file main_fbw.c.
Referenced by handle_periodic_tasks(), and main_init().
tid_t telemetry_tid |
id for telemetry_periodic() timer
Definition at line 72 of file main_fbw.c.
Referenced by handle_periodic_tasks(), and main_init().