|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
35 #include "generated/airframe.h"
52 #if PERIODIC_TELEMETRY
86 #if !OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP && !OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE
94 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
95 #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!!
96 static inline void set_failsafe_mode(
void);
103 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP_IRREVERSIBLE
104 #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
107 commands[COMMAND_FORCECRASH] = 9600;
155 #if defined ACTUATORS && defined INTER_MCU
159 pprz_t trimmed_commands[COMMANDS_NB];
161 for (i = 0; i < COMMANDS_NB; i++) {trimmed_commands[i] =
commands[i];}
187 void pre_inter_mcu_received_ap(
void);
188 void post_inter_mcu_received_ap(
void);
194 #define FBW_MODE_INTER_MCU_FAILSAFE FBW_MODE_AUTO
196 #if !OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_NO_AP_MUST_FAILSAFE && !OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_AP_CAN_FORCE_FAILSAFE
197 void pre_inter_mcu_received_ap(
void) {};
198 void post_inter_mcu_received_ap(
void) {};
202 #if OUTBACK_CHALLENGE_DANGEROUS_RULE_RC_LOST_NO_AP
203 #undef FBW_MODE_INTER_MCU_FAILSAFE
204 #define FBW_MODE_INTER_MCU_FAILSAFE fbw_mode
208 #if OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_NO_AP_MUST_FAILSAFE
209 #warning OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_NO_AP_MUST_FAILSAFE loose ap is forced crash
210 void pre_inter_mcu_received_ap(
void)
216 commands[COMMAND_FORCECRASH] = 9600;
219 void post_inter_mcu_received_ap(
void) {};
223 #if OUTBACK_CHALLENGE_VERY_DANGEROUS_RULE_AP_CAN_FORCE_FAILSAFE
224 #warning DANGER DANGER DANGER DANGER: Outback Challenge Rule FORCE-CRASH-RULE: DANGER DANGER:
225 #warning AP is now capable to FORCE your FBW in failsafe mode EVEN IF RC IS NOT LOST: Consider the consequences.
227 void pre_inter_mcu_received_ap(
void) {};
228 void post_inter_mcu_received_ap(
void)
230 if (
commands[COMMAND_FORCECRASH] >= 8000) {
240 static inline void set_failsafe_mode(
void)
252 inter_mcu_periodic_task();
257 #if defined MCU_UART_LINK || defined MCU_CAN_LINK
258 inter_mcu_fill_fbw_state();
268 #if defined MCU_SPI_LINK | defined MCU_UART_LINK
272 pre_inter_mcu_received_ap();
276 inter_mcu_event_task();
283 fbw_mode = FBW_MODE_INTER_MCU_FAILSAFE;
288 #if SET_AP_ONLY_COMMANDS
289 SetApOnlyCommands(
ap_state->commands);
296 inter_mcu_fill_fbw_state();
300 post_inter_mcu_received_ap();
307 inter_mcu_fill_fbw_state();
318 #if PERIODIC_TELEMETRY
321 pprz_msg_send_COMMANDS(trans,
dev, AC_ID, COMMANDS_NB,
commands);
327 pprz_msg_send_FBW_STATUS(trans,
dev, AC_ID,
331 static void send_rc(
struct transport_tx *trans,
struct link_device *
dev)
340 pprz_msg_send_FBW_STATUS(trans,
dev, AC_ID,
348 pprz_msg_send_ACTUATORS(trans,
dev, AC_ID , ACTUATORS_NB, actuators);
366 #if !(DISABLE_ELECTRICAL)
385 #if defined MCU_SPI_LINK || defined MCU_CAN_LINK
403 #if PERIODIC_TELEMETRY
451 #if !(DISABLE_ELECTRICAL)
pprz_t command_roll_trim
Trim commands for roll, pitch and yaw.
void fbw_datalink_periodic(void)
void radio_control_periodic_task(void)
void link_mcu_periodic_task(void)
void radio_control_periodic_handle(void)
static void send_rc(struct transport_tx *trans, struct link_device *dev)
volatile bool inter_mcu_received_ap
void mcu_event(void)
MCU event functions.
static void send_commands(struct transport_tx *trans, struct link_device *dev)
void update_actuators(void)
#define PPRZ_MUTEX_UNLOCK(_mtx)
const pprz_t commands_failsafe[COMMANDS_NB]
float vsupply
supply voltage in V
void radio_lost_mode(void)
Defines behavior when the RC is lost, default goes to AUTO.
void fbw_datalink_event(void)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void link_mcu_event_task(void)
void event_task_fbw(void)
Arch independent mcu ( Micro Controller Unit ) utilities.
static const struct usb_device_descriptor dev
void electrical_periodic(void)
Architecture independent timing functions.
#define RADIO_CONTROL_NB_CHANNEL
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
volatile uint8_t fbw_new_actuators
tid_t fbw_periodic_tid
id for periodic_task_fbw() timer
void electrical_init(void)
int8_t tid_t
sys_time timer id type
pprz_t command_pitch_trim
tid_t electrical_tid
id for electrical_periodic() timer
void radio_control_init(void)
#define PPRZ_MUTEX_LOCK(_mtx)
void radio_control_event(void)
static const ShellCommand commands[]
#define RadioControlEvent(_received_frame_handler)
static void handle_rc_frame(void)
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
static void send_actuators(struct transport_tx *trans, struct link_device *dev)
void periodic_telemetry_handle(void)
#define FBW_MODE_OF_PPRZ(mode)
struct ap_state * ap_state
void fbw_datalink_event_handle(void)
Hardware independent code for commands handling.
struct Electrical electrical
uint8_t autopilot_get_mode(void)
get autopilot mode
void inter_mcu_periodic_handle(void)
void periodic_task_fbw(void)
void handle_periodic_tasks_fbw(void)
static void send_fbw_status(struct transport_tx *trans, struct link_device *dev)
void mcu_init(void)
Microcontroller peripherals initialization.
void inter_mcu_event_handle(void)
#define DefaultPeriodic
Set default periodic telemetry.
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
float current
current in A
struct RadioControl radio_control
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
void fbw_datalink_periodic_handle(void)