34 #include "generated/airframe.h"
48 #if PERIODIC_TELEMETRY
62 #include "nps_autopilot.h"
79 #if PERIODIC_TELEMETRY
82 pprz_msg_send_COMMANDS(trans, dev, AC_ID, COMMANDS_NB,
commands);
88 pprz_msg_send_FBW_STATUS(trans, dev, AC_ID,
101 pprz_msg_send_FBW_STATUS(trans, dev, AC_ID,
109 pprz_msg_send_ACTUATORS(trans, dev, AC_ID , ACTUATORS_NB, actuators);
121 #if !(DISABLE_ELECTRICAL)
137 #if defined MCU_SPI_LINK || defined MCU_CAN_LINK
154 #if PERIODIC_TELEMETRY
200 #if defined MCU_SPI_LINK | defined MCU_UART_LINK
205 #if OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_NO_AP_MUST_FAILSAFE
206 #warning OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_NO_AP_MUST_FAILSAFE loose ap is forced crash
208 ap_has_been_ok =
TRUE;
211 if ((ap_has_been_ok) && (!ap_ok)) {
212 commands[COMMAND_FORCECRASH] = 9600;
218 inter_mcu_event_task();
222 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
234 #ifdef SetApOnlyCommands
236 SetApOnlyCommands(
ap_state->commands);
242 inter_mcu_fill_fbw_state();
246 #if OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_AP_CAN_FORCE_FAILSAFE
247 #warning DANGER DANGER DANGER DANGER: Outback Challenge Rule FORCE-CRASH-RULE: DANGER DANGER: AP is now capable to FORCE your FBW in failsafe mode EVEN IF RC IS NOT LOST: Consider the consequences.
250 if (
commands[COMMAND_FORCECRASH] >= 8000) {
258 pprz_t trimmed_commands[COMMANDS_NB];
260 for (i = 0; i < COMMANDS_NB; i++) { trimmed_commands[i] =
commands[i]; }
274 #if OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_AP_CAN_FORCE_FAILSAFE
291 inter_mcu_fill_fbw_state();
314 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
315 #warning WARNING DANGER: OUTBACK_CHALLENGE RULE RC_LOST_NO_AP defined. If you loose RC you will NOT go to automatically go to AUTO2 Anymore!!
317 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE
318 #warning WARNING DANGER: OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE defined. If you ever temporarly lost RC while in manual, you will failsafe forever even if RC is restored
319 commands[COMMAND_FORCECRASH] = 9600;
328 inter_mcu_periodic_task();
334 #if defined MCU_UART_LINK || defined MCU_CAN_LINK
335 inter_mcu_fill_fbw_state();
339 #if PERIODIC_TELEMETRY
352 #if !(DISABLE_ELECTRICAL)
int32_t current
current in milliamps
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void mcu_init(void)
Microcontroller peripherals initialization.
Communication between fbw and ap processes.
Generic transmission transport header.
Periodic telemetry system header (includes downlink utility and generated code).
pprz_t command_pitch_trim
tid_t electrical_tid
id for electrical_periodic() timer
volatile bool_t inter_mcu_received_ap
void fbw_datalink_periodic(void)
uint8_t tid_t
sys_time timer id type
void event_task_fbw(void)
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
void fbw_datalink_event(void)
void periodic_task_fbw(void)
static void send_actuators(struct transport_tx *trans, struct link_device *dev)
void link_mcu_event_task(void)
void radio_control_init(void)
const pprz_t commands_failsafe[COMMANDS_NB]
struct ap_state * ap_state
tid_t fbw_periodic_tid
id for periodic_task_fbw() timer
#define RadioControlEvent(_received_frame_handler)
Hardware independent API for actuators (servos, motor controllers).
volatile uint8_t fbw_new_actuators
void electrical_init(void)
void handle_periodic_tasks_fbw(void)
Common transport functions for the communication between FBW and AP.
Interface for electrical status: supply voltage, current, battery status, etc.
Architecture independent timing functions.
pprz_t command_roll_trim
Trim commands for roll, pitch and yaw.
void radio_control_periodic_task(void)
#define DefaultPeriodic
Set default periodic telemetry.
Hardware independent code for commands handling.
struct RadioControl radio_control
static void set_failsafe_mode(void)
int sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
static bool_t sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
#define RADIO_CONTROL_NB_CHANNEL
void electrical_periodic(void)
static const struct usb_device_descriptor dev
#define DefaultChannel
SITL.
#define FBW_MODE_OF_PPRZ(mode)
Arch independent mcu ( Micro Controller Unit ) utilities.
pprz_t commands[COMMANDS_NB]
Storage of intermediate command values.
static void send_commands(struct transport_tx *trans, struct link_device *dev)
uint16_t vsupply
supply voltage in decivolts
void mcu_event(void)
MCU event functions.
struct Electrical electrical
FBW ( FlyByWire ) process API.
static void send_rc(struct transport_tx *trans, struct link_device *dev)
static void handle_rc_frame(void)
Handling of messages coming from ground in FTD.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
void link_mcu_periodic_task(void)
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
Fixedwing autopilot modes.