Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
main_fbw.c File Reference
#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"
+ Include dependency graph for main_fbw.c:

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))
 

Functions

void main_init (void)
 Main initialization. More...
 
void handle_periodic_tasks (void)
 
void telemetry_periodic (void)
 
static void fbw_safety_check (void)
 
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...
 
void main_event (void)
 

Variables

fbw_mode_enum fbw_mode
 Fly by wire modes. More...
 
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...
 

Detailed Description

Rotorcraft FBW main loop.

Definition in file main_fbw.c.

Macro Definition Documentation

◆ And

#define And (   x,
 
)    ((x) && (y))

Definition at line 50 of file main_fbw.c.

◆ LessThan

#define LessThan (   _x,
  _y 
)    ((_x) < (_y))

Definition at line 54 of file main_fbw.c.

◆ Max

#define Max (   x,
 
)    (x > y ? x : y)

Definition at line 53 of file main_fbw.c.

◆ Min

#define Min (   x,
 
)    (x < y ? x : y)

Definition at line 52 of file main_fbw.c.

◆ MODULES_C

#define MODULES_C

Definition at line 46 of file main_fbw.c.

◆ MoreThan

#define MoreThan (   _x,
  _y 
)    ((_x) > (_y))

Definition at line 55 of file main_fbw.c.

◆ Or

#define Or (   x,
 
)    ((x) || (y))

Definition at line 51 of file main_fbw.c.

Function Documentation

◆ fbw_on_ap_command()

static void fbw_on_ap_command ( void  )
static

Callback when receive commands from the AP.

Definition at line 277 of file main_fbw.c.

References fbw_mode, FBW_MODE_AUTO, intermcu_commands, and SetCommands.

Referenced by main_event().

+ Here is the caller graph for this function:

◆ fbw_on_rc_frame()

static void fbw_on_rc_frame ( void  )
static

Callback when we received an RC frame.

Definition at line 231 of file main_fbw.c.

References AP_LOST_FBW_MODE, commands, commands_failsafe, fbw_mode, FBW_MODE_AUTO, FBW_MODE_AUTO_ONLY, FBW_MODE_FAILSAFE, FBW_MODE_MANUAL, fbw_motors_on, intermcu, INTERMCU_LOST, intermcu_on_rc_frame(), MIN_PPRZ, radio_control, RADIO_FBW_MODE, RADIO_KILL_SWITCH, SetCommands, intermcu_t::status, and RadioControl::values.

Referenced by main_event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fbw_safety_check()

static void fbw_safety_check ( void  )
static

◆ handle_periodic_tasks()

void handle_periodic_tasks ( void  )

◆ main_event()

void main_event ( void  )
inline

Definition at line 285 of file main_fbw.c.

References fbw_on_ap_command(), fbw_on_rc_frame(), InterMcuEvent(), mcu_event(), and RadioControlEvent.

+ Here is the call graph for this function:

◆ main_init()

void main_init ( void  )
inline

◆ main_periodic()

void main_periodic ( void  )
inline

Definition at line 175 of file main_fbw.c.

References autopilot_get_mode(), autopilot_motors_on, commands, commands_failsafe, fbw_mode, FBW_MODE_AUTO, FBW_MODE_FAILSAFE, FBW_MODE_MANUAL, fbw_motors_on, fbw_safety_check(), intermcu, intermcu_periodic(), LED_OFF, LED_ON, LED_PERIODIC, LED_TOGGLE, PPRZ_BAUD, and SetCommands.

Referenced by handle_periodic_tasks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ telemetry_periodic()

void telemetry_periodic ( void  )

Definition at line 129 of file main_fbw.c.

References fbw_mode, and intermcu_send_status().

Referenced by handle_periodic_tasks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ electrical_tid

tid_t electrical_tid

id for electrical_periodic() timer

Definition at line 70 of file main_fbw.c.

◆ fbw_mode

fbw_mode_enum fbw_mode

Fly by wire modes.

Definition at line 59 of file main_fbw.c.

Referenced by telemetry_intermcu_event().

◆ fbw_motors_on

bool fbw_motors_on = false

Definition at line 60 of file main_fbw.c.

Referenced by fbw_on_rc_frame(), and main_periodic().

◆ main_periodic_tid

tid_t main_periodic_tid

id for main_periodic() timer

Definition at line 67 of file main_fbw.c.

Referenced by handle_periodic_tasks(), and main_init().

◆ modules_tid

tid_t modules_tid

id for modules_periodic_task() timer

Definition at line 68 of file main_fbw.c.

Referenced by handle_periodic_tasks(), and main_init().

◆ radio_control_tid

tid_t radio_control_tid

id for radio_control_periodic_task() timer

Definition at line 69 of file main_fbw.c.

Referenced by handle_periodic_tasks(), and main_init().

◆ telemetry_tid

tid_t telemetry_tid

id for telemetry_periodic() timer

Definition at line 71 of file main_fbw.c.

Referenced by handle_periodic_tasks(), and main_init().