28 #ifndef AUTOPILOT_RC_HELPERS_H
29 #define AUTOPILOT_RC_HELPERS_H
31 #include "generated/airframe.h"
34 #define AUTOPILOT_THROTTLE_THRESHOLD (MAX_PPRZ / 20)
35 #define AUTOPILOT_YAW_THRESHOLD (MAX_PPRZ * 19 / 20)
36 #ifndef AUTOPILOT_STICK_CENTER_THRESHOLD
37 #define AUTOPILOT_STICK_CENTER_THRESHOLD (MAX_PPRZ * 1 / 20)
40 #define THROTTLE_STICK_DOWN() \
41 (radio_control.values[RADIO_THROTTLE] < AUTOPILOT_THROTTLE_THRESHOLD)
42 #define YAW_STICK_PUSHED() \
43 (radio_control.values[RADIO_YAW] > AUTOPILOT_YAW_THRESHOLD || \
44 radio_control.values[RADIO_YAW] < -AUTOPILOT_YAW_THRESHOLD)
45 #define YAW_STICK_CENTERED() \
46 (radio_control.values[RADIO_YAW] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
47 radio_control.values[RADIO_YAW] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
48 #define PITCH_STICK_CENTERED() \
49 (radio_control.values[RADIO_PITCH] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
50 radio_control.values[RADIO_PITCH] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
51 #define ROLL_STICK_CENTERED() \
52 (radio_control.values[RADIO_ROLL] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
53 radio_control.values[RADIO_ROLL] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
60 #ifdef RADIO_KILL_SWITCH
81 }
else if (per > 100) {
#define ROLL_STICK_CENTERED()
static bool_t kill_switch_is_on(void)
#define RADIO_KILL_SWITCH
static bool_t rc_attitude_sticks_centered(void)
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
#define PITCH_STICK_CENTERED()
struct RadioControl radio_control
static uint8_t percent_from_rc(int channel)
#define YAW_STICK_CENTERED()