|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
29 #include "generated/airframe.h"
40 #define MAX_SUM_ERR 40000
42 #ifndef STABILIZATION_RATE_IGAIN_P
43 #define STABILIZATION_RATE_IGAIN_P 0
46 #ifndef STABILIZATION_RATE_IGAIN_Q
47 #define STABILIZATION_RATE_IGAIN_Q 0
50 #ifndef STABILIZATION_RATE_IGAIN_R
51 #define STABILIZATION_RATE_IGAIN_R 0
54 #if (STABILIZATION_RATE_GAIN_P < 0) || \
55 (STABILIZATION_RATE_GAIN_Q < 0) || \
56 (STABILIZATION_RATE_GAIN_R < 0) || \
57 (STABILIZATION_RATE_IGAIN_P < 0) || \
58 (STABILIZATION_RATE_IGAIN_Q < 0) || \
59 (STABILIZATION_RATE_IGAIN_R < 0)
60 #error "ALL control gains have to be positive!!!"
64 #define OFFSET_AND_ROUND(_a, _b) (((_a)+(1<<((_b)-1)))>>(_b))
65 #define OFFSET_AND_ROUND2(_a, _b) (((_a)+(1<<((_b)-1))-((_a)<0?1:0))>>(_b))
74 #ifndef STABILIZATION_RATE_DEADBAND_P
75 #define STABILIZATION_RATE_DEADBAND_P 0
77 #ifndef STABILIZATION_RATE_DEADBAND_Q
78 #define STABILIZATION_RATE_DEADBAND_Q 0
80 #ifndef STABILIZATION_RATE_DEADBAND_R
81 #define STABILIZATION_RATE_DEADBAND_R 200
84 #define ROLL_RATE_DEADBAND_EXCEEDED() \
85 (radio_control.values[RADIO_ROLL] > STABILIZATION_RATE_DEADBAND_P || \
86 radio_control.values[RADIO_ROLL] < -STABILIZATION_RATE_DEADBAND_P)
88 #define PITCH_RATE_DEADBAND_EXCEEDED() \
89 (radio_control.values[RADIO_PITCH] > STABILIZATION_RATE_DEADBAND_Q || \
90 radio_control.values[RADIO_PITCH] < -STABILIZATION_RATE_DEADBAND_Q)
92 #define YAW_RATE_DEADBAND_EXCEEDED() \
93 (radio_control.values[RADIO_YAW] > STABILIZATION_RATE_DEADBAND_R || \
94 radio_control.values[RADIO_YAW] < -STABILIZATION_RATE_DEADBAND_R)
96 #if PERIODIC_TELEMETRY
99 static void send_rate(
struct transport_tx *trans,
struct link_device *
dev)
101 pprz_msg_send_RATE_LOOP(trans,
dev, AC_ID,
121 STABILIZATION_RATE_GAIN_P,
122 STABILIZATION_RATE_GAIN_Q,
123 STABILIZATION_RATE_GAIN_R);
131 #if PERIODIC_TELEMETRY
197 RATES_SDIV(sum_err_increment, _error, PERIODIC_FREQUENCY);
void stabilization_rate_read_rc(void)
#define FLOAT_RATES_ZERO(_r)
#define STABILIZATION_RATE_IGAIN_P
struct FloatRates stabilization_rate_sum_err
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
struct FloatRates stabilization_rate_fb_cmd
#define YAW_RATE_DEADBAND_EXCEEDED()
#define THROTTLE_STICK_DOWN()
#define ROLL_RATE_DEADBAND_EXCEEDED()
#define STABILIZATION_RATE_IGAIN_Q
#define RATES_ASSIGN(_ra, _p, _q, _r)
#define PITCH_RATE_DEADBAND_EXCEEDED()
#define RATES_DIFF(_c, _a, _b)
static const struct usb_device_descriptor dev
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
struct FloatRates stabilization_rate_gain
#define RATES_ADD(_a, _b)
void stabilization_rate_enter(void)
void stabilization_rate_init(void)
#define RATES_SDIV(_ro, _ri, _s)
struct FloatRates stabilization_rate_sp
static void send_rate(struct transport_tx *trans, struct link_device *dev)
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
#define RATES_BOUND_CUBE(_v, _min, _max)
void stabilization_rate_run(bool in_flight)
void stabilization_rate_read_rc_switched_sticks(void)
struct FloatRates stabilization_rate_igain
#define DefaultPeriodic
Set default periodic telemetry.
struct RadioControl radio_control
#define STABILIZATION_RATE_IGAIN_R
pprz_t values[RADIO_CONTROL_NB_CHANNEL]