Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
autopilot_rc_helpers.h File Reference

Some helper functions to check RC sticks. More...

#include "generated/airframe.h"
#include "subsystems/radio_control.h"
+ Include dependency graph for autopilot_rc_helpers.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AUTOPILOT_THROTTLE_THRESHOLD   (MAX_PPRZ / 20)
 
#define AUTOPILOT_YAW_THRESHOLD   (MAX_PPRZ * 19 / 20)
 
#define AUTOPILOT_STICK_CENTER_THRESHOLD   (MAX_PPRZ * 1 / 20)
 
#define THROTTLE_STICK_DOWN()   (radio_control.values[RADIO_THROTTLE] < AUTOPILOT_THROTTLE_THRESHOLD)
 
#define YAW_STICK_PUSHED()
 
#define YAW_STICK_CENTERED()
 
#define PITCH_STICK_CENTERED()
 
#define ROLL_STICK_CENTERED()
 

Functions

static bool rc_mode_switch (uint8_t chan, uint8_t pos, uint8_t max)
 RC mode switch position helper switch positions threshold are evenly spaced. More...
 
static bool rc_attitude_sticks_centered (void)
 Convenience macro for 3way switch. More...
 
static bool kill_switch_is_on (void)
 
static uint8_t percent_from_rc (int channel)
 

Detailed Description

Some helper functions to check RC sticks.

Definition in file autopilot_rc_helpers.h.

Macro Definition Documentation

#define AUTOPILOT_STICK_CENTER_THRESHOLD   (MAX_PPRZ * 1 / 20)

Definition at line 37 of file autopilot_rc_helpers.h.

#define AUTOPILOT_THROTTLE_THRESHOLD   (MAX_PPRZ / 20)

Definition at line 34 of file autopilot_rc_helpers.h.

#define AUTOPILOT_YAW_THRESHOLD   (MAX_PPRZ * 19 / 20)

Definition at line 35 of file autopilot_rc_helpers.h.

#define PITCH_STICK_CENTERED ( )
Value:
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
struct RadioControl radio_control
Definition: radio_control.c:30
#define AUTOPILOT_STICK_CENTER_THRESHOLD
#define RADIO_PITCH
Definition: intermcu_ap.h:42

Definition at line 48 of file autopilot_rc_helpers.h.

Referenced by autopilot_arming_check_valid(), and rc_attitude_sticks_centered().

#define ROLL_STICK_CENTERED ( )
Value:
#define RADIO_ROLL
Definition: intermcu_ap.h:41
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
struct RadioControl radio_control
Definition: radio_control.c:30
#define AUTOPILOT_STICK_CENTER_THRESHOLD

Definition at line 51 of file autopilot_rc_helpers.h.

Referenced by autopilot_arming_check_valid(), and rc_attitude_sticks_centered().

#define YAW_STICK_CENTERED ( )
Value:
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
struct RadioControl radio_control
Definition: radio_control.c:30
#define AUTOPILOT_STICK_CENTER_THRESHOLD
#define RADIO_YAW
Definition: intermcu_ap.h:43

Definition at line 45 of file autopilot_rc_helpers.h.

Referenced by autopilot_arming_check_motors_on(), autopilot_arming_check_valid(), and rc_attitude_sticks_centered().

#define YAW_STICK_PUSHED ( )
Value:
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:69
#define AUTOPILOT_YAW_THRESHOLD
struct RadioControl radio_control
Definition: radio_control.c:30
#define RADIO_YAW
Definition: intermcu_ap.h:43

Definition at line 42 of file autopilot_rc_helpers.h.

Referenced by autopilot_arming_check_motors_on().

Function Documentation

static bool kill_switch_is_on ( void  )
inlinestatic

Definition at line 97 of file autopilot_rc_helpers.h.

Referenced by autopilot_arming_check_motors_on(), and autopilot_static_on_rc_frame().

+ Here is the caller graph for this function:

static uint8_t percent_from_rc ( int  channel)
inlinestatic

Definition at line 103 of file autopilot_rc_helpers.h.

References MAX_PPRZ, radio_control, and RadioControl::values.

static bool rc_attitude_sticks_centered ( void  )
inlinestatic

Convenience macro for 3way switch.

Definition at line 82 of file autopilot_rc_helpers.h.

References PITCH_STICK_CENTERED, ROLL_STICK_CENTERED, and YAW_STICK_CENTERED.

Referenced by autopilot_arming_check_motors_on().

+ Here is the caller graph for this function:

static bool rc_mode_switch ( uint8_t  chan,
uint8_t  pos,
uint8_t  max 
)
inlinestatic

RC mode switch position helper switch positions threshold are evenly spaced.

Parameters
[in]chanRC mode channel number
[in]posswitch position to be tested
[in]maxmaximum number of position of the switch
Returns
true if current position is the same as requested (and RC status is OK)

Definition at line 63 of file autopilot_rc_helpers.h.

References MAX_PPRZ, MIN_PPRZ, p, radio_control, RC_OK, RadioControl::status, and RadioControl::values.