Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
autopilot_rc_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef AUTOPILOT_RC_HELPERS_H
23 #define AUTOPILOT_RC_HELPERS_H
24 
26 
27 #define AUTOPILOT_THROTTLE_THRESHOLD (MAX_PPRZ / 20)
28 #define AUTOPILOT_YAW_THRESHOLD (MAX_PPRZ * 19 / 20)
29 #ifndef AUTOPILOT_STICK_CENTER_THRESHOLD
30 #define AUTOPILOT_STICK_CENTER_THRESHOLD (MAX_PPRZ * 1 / 20)
31 #endif
32 
33 #define THROTTLE_STICK_DOWN() \
34  (radio_control.values[RADIO_THROTTLE] < AUTOPILOT_THROTTLE_THRESHOLD)
35 #define YAW_STICK_PUSHED() \
36  (radio_control.values[RADIO_YAW] > AUTOPILOT_YAW_THRESHOLD || \
37  radio_control.values[RADIO_YAW] < -AUTOPILOT_YAW_THRESHOLD)
38 #define YAW_STICK_CENTERED() \
39  (radio_control.values[RADIO_YAW] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
40  radio_control.values[RADIO_YAW] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
41 #define PITCH_STICK_CENTERED() \
42  (radio_control.values[RADIO_PITCH] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
43  radio_control.values[RADIO_PITCH] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
44 #define ROLL_STICK_CENTERED() \
45  (radio_control.values[RADIO_ROLL] < AUTOPILOT_STICK_CENTER_THRESHOLD && \
46  radio_control.values[RADIO_ROLL] > -AUTOPILOT_STICK_CENTER_THRESHOLD)
47 
48 static inline bool_t rc_attitude_sticks_centered(void) {
50 }
51 
52 #ifdef RADIO_KILL_SWITCH
53 static inline bool_t kill_switch_is_on(void) {
54  if (radio_control.values[RADIO_KILL_SWITCH] < 0)
55  return TRUE;
56  else
57  return FALSE;
58 }
59 #else
60 static inline bool_t kill_switch_is_on(void) {
61  return FALSE;
62 }
63 #endif
64 
65 
66 #endif /* AUTOPILOT_RC_HELPERS_H */
#define ROLL_STICK_CENTERED()
static bool_t kill_switch_is_on(void)
#define RADIO_KILL_SWITCH
static bool_t rc_attitude_sticks_centered(void)
#define PITCH_STICK_CENTERED()
#define FALSE
Definition: imu_chimu.h:141
struct RadioControl radio_control
Definition: radio_control.c:27
#define TRUE
Definition: imu_chimu.h:144
#define YAW_STICK_CENTERED()