Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
stabilization_rate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
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 
28 #ifndef STABILIZATION_RATE
29 #define STABILIZATION_RATE
30 
34 
35 #ifndef STABILIZATION_RATE_DEADBAND_P
36 #define STABILIZATION_RATE_DEADBAND_P 0
37 #endif
38 #ifndef STABILIZATION_RATE_DEADBAND_Q
39 #define STABILIZATION_RATE_DEADBAND_Q 0
40 #endif
41 #ifndef STABILIZATION_RATE_DEADBAND_R
42 #define STABILIZATION_RATE_DEADBAND_R 200
43 #endif
44 
45 #define ROLL_RATE_DEADBAND_EXCEEDED(_rc) \
46  (_rc->values[RADIO_ROLL] > STABILIZATION_RATE_DEADBAND_P || \
47  _rc->values[RADIO_ROLL] < -STABILIZATION_RATE_DEADBAND_P)
48 
49 #define PITCH_RATE_DEADBAND_EXCEEDED(_rc) \
50  (_rc->values[RADIO_PITCH] > STABILIZATION_RATE_DEADBAND_Q || \
51  _rc->values[RADIO_PITCH] < -STABILIZATION_RATE_DEADBAND_Q)
52 
53 #define YAW_RATE_DEADBAND_EXCEEDED(_rc) \
54  (_rc->values[RADIO_YAW] > STABILIZATION_RATE_DEADBAND_R || \
55  _rc->values[RADIO_YAW] < -STABILIZATION_RATE_DEADBAND_R)
56 
57 #if SWITCH_STICKS_FOR_RATE_CONTROL
58 // Read rc with roll and yaw sitcks switched if the default orientation is vertical but airplane sticks are desired
59 #define RC_RATE_P RADIO_YAW
60 #define RC_RATE_Q RADIO_PITCH
61 #define RC_RATE_R RADIO_ROLL
62 #else
63 // Normal orientation
64 #define RC_RATE_P RADIO_ROLL
65 #define RC_RATE_Q RADIO_PITCH
66 #define RC_RATE_R RADIO_YAW
67 #endif
68 
69 extern void stabilization_rate_init(void);
70 extern void stabilization_rate_run(bool in_flight, struct StabilizationSetpoint *rate_sp, struct ThrustSetpoint *thrust, int32_t *cmd);
71 extern void stabilization_rate_enter(void);
73 
76 
77 #endif /* STABILIZATION_RATE */
angular rates
Paparazzi floating point algebra.
Generic interface for radio control modules.
General stabilization interface for rotorcrafts.
void stabilization_rate_enter(void)
Reset rate controller.
struct StabilizationSetpoint stabilization_rate_read_rc(struct RadioControl *rc)
void stabilization_rate_run(bool in_flight, struct StabilizationSetpoint *rate_sp, struct ThrustSetpoint *thrust, int32_t *cmd)
Run indi rate interface from the "stabilization_rate_run" function.
struct FloatRates stabilization_rate_igain
struct FloatRates stabilization_rate_gain
void stabilization_rate_init(void)
Initialize rate controller.
Stabilization setpoint.
Definition: stabilization.h:53
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
Definition: stabilization.h:82
int int32_t
Typedef defining 32 bit int type.
Definition: vl53l1_types.h:83