34 #include "generated/airframe.h"
35 #include "generated/modules.h"
47 #if !(SYS_TIME_FREQUENCY/PERIODIC_FREQUENCY*PERIODIC_FREQUENCY == SYS_TIME_FREQUENCY)
48 #warning "The SYS_TIME_FREQUENCY can not be divided by PERIODIC_FREQUENCY. Make sure this is the case for correct timing."
67 #ifndef MAIN_FBW_RC_ID
68 #define MAIN_FBW_RC_ID ABI_BROADCAST
83 modules_radio_control_init();
84 modules_actuators_init();
85 modules_datalink_init();
113 if (rc_lost && ap_lost) {
117 else if (!rc_lost && ap_lost) {
124 else if (rc_lost && !ap_lost) {
150 if (
intermcu.stable_px4_baud != PPRZ_BAUD) {
164 if (!(dv++ % (PERIODIC_FREQUENCY / 20))) {
LED_TOGGLE(FBW_MODE_LED);}
166 if (!(dv++ % (PERIODIC_FREQUENCY))) {
LED_TOGGLE(FBW_MODE_LED);}
190 modules_radio_control_periodic_task();
195 modules_actuators_periodic_task();
196 modules_mcu_periodic_task();
197 modules_core_periodic_task();
205 modules_datalink_periodic_task();
219 #ifdef RADIO_KILL_SWITCH
220 static bool kill_state_init =
false;
223 kill_state_init =
true;
248 #ifdef SetCommandsFromRC
251 #warning "FBW: needs commands from RC in order to be useful."
258 if (DL_EMERGENCY_CMD_ac_id(buf) == AC_ID && DL_EMERGENCY_CMD_cmd(buf) == 0) {
265 modules_mcu_event_task();
267 modules_radio_control_event_task();
268 modules_actuators_event_task();
269 modules_datalink_event_task();
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
const pprz_t commands_failsafe[COMMANDS_NB]
pprz_t commands[COMMANDS_NB]
Handling of messages coming from ground and other A/Cs.
void electrical_periodic(void)
void intermcu_event(void)
@ INTERMCU_LOST
No interMCU communication anymore.
struct intermcu_t intermcu
enum intermcu_status status
Status of the INTERMCU.
pprz_t intermcu_commands[COMMANDS_NB]
bool intermcu_ap_motors_on
void main_fbw_parse_EMERGENCY_CMD(uint8_t *buf)
tid_t periodic_tid
IDs for timers.
void main_fbw_init(void)
Main initialization.
static void rc_cb(uint8_t sender_id, struct RadioControl *rc)
Callback when we received an RC frame.
tid_t electrical_tid
id for electrical_periodic() timer
tid_t radio_control_tid
id for radio_control_periodic() timer
#define MAIN_FBW_RC_ID
ABI RC binding.
static void main_task_periodic(void)
tid_t telemetry_tid
id for telemetry_periodic() timer
static void fbw_safety_check(void)
Periodic tasks.
void main_fbw_event(void)
uint8_t fbw_mode
Fly by wire modes.
void main_fbw_periodic(void)
#define FBW_MODE_AUTO_ONLY
holds whether the aircraft can only be flown with the AP and not RC-Direct/FBW-mode
#define FBW_MODE_FAILSAFE
#define RC_LOST_IN_AUTO_FBW_MODE
mode to enter when AP is lost while using autopilot
#define AP_LOST_FBW_MODE
mode to enter when AP is lost while using autopilot
#define RC_LOST_FBW_MODE
mode to enter when RC is lost while using a mode with RC input switching to AUTO allows a recover wit...
#define RADIO_FBW_MODE
Switching between FBW and autopilot is done with RADIO_FBW_MODE: default is to re-use RADIO_MODE.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
struct RadioControl radio_control
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
#define RADIO_KILL_SWITCH
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
int8_t tid_t
sys_time timer id type
Periodic telemetry system header (includes downlink utility and generated code).
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.