Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "paparazzi.h"
#include "math/pprz_algebra_float.h"
#include "math/pprz_algebra_int.h"
#include "math/pprz_simple_matrix.h"
#include "state.h"
#include "generated/airframe.h"
#include "autopilot.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_heli_indi.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_quat_transformations.h"
#include "filters/low_pass_filter.h"
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Helicopter quaternion INDI attitude stabilization
Definition in file stabilization_attitude_heli_indi.c.
#define INDI_NOTCH_MIN_RPM STABILIZATION_ATTITUDE_HELI_INDI_NOTCH_MIN_RPM |
Definition at line 118 of file stabilization_attitude_heli_indi.c.
#define INT32_INVG_FRAC 16 |
Definition at line 125 of file stabilization_attitude_heli_indi.c.
#define INVG_00 STABILIZATION_ATTITUDE_HELI_INDI_GINV_ROLL_TO_ROLL |
Definition at line 121 of file stabilization_attitude_heli_indi.c.
#define INVG_11 STABILIZATION_ATTITUDE_HELI_INDI_GINV_PITCH_TO_PITCH |
Definition at line 122 of file stabilization_attitude_heli_indi.c.
#define INVG_22 STABILIZATION_ATTITUDE_HELI_INDI_GINV_YAW_TO_YAW |
Definition at line 123 of file stabilization_attitude_heli_indi.c.
#define INVG_33 -50000 |
Definition at line 124 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_DEFAULT 40.0 |
Definition at line 101 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_PITCH STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_DEFAULT |
Definition at line 107 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_ROLL STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_DEFAULT |
Definition at line 104 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_THRUST STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_DEFAULT |
Definition at line 113 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_YAW STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_DEFAULT |
Definition at line 110 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_GINV_PITCH_TO_PITCH 13873 |
Definition at line 74 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_GINV_ROLL_TO_ROLL 11681 |
Definition at line 71 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_GINV_YAW_TO_YAW 730 |
Definition at line 77 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCH_MIN_RPM 1500 |
Definition at line 116 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_DEFAULT 10.0 |
Definition at line 86 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_PITCH STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_DEFAULT |
Definition at line 92 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_ROLL STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_DEFAULT |
Definition at line 89 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_THRUST STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_DEFAULT |
Definition at line 98 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_YAW STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_DEFAULT |
Definition at line 95 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_PITCH_COMMAND_ROTATION -30.0 |
Definition at line 83 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_PITCH_P 8 |
Definition at line 62 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_ROLL_COMMAND_ROTATION 11.0 |
Definition at line 80 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_ROLL_P 12 |
Definition at line 59 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_STEADY_STATE_PITCH 0 |
Definition at line 56 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_STEADY_STATE_ROLL 4.5 |
Definition at line 53 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_USE_NOTCHFILTER 0 |
Definition at line 42 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_YAW_D 30 |
Definition at line 68 of file stabilization_attitude_heli_indi.c.
#define STABILIZATION_ATTITUDE_HELI_INDI_YAW_P 10 |
Definition at line 65 of file stabilization_attitude_heli_indi.c.
Definition at line 278 of file stabilization_attitude_heli_indi.c.
References actuator_lowpass_filters, INDI_DOF, and update_butterworth_2_low_pass_int().
Referenced by stabilization_attitude_init().
Definition at line 167 of file stabilization_attitude_heli_indi.c.
References actuator_model, delayed_first_order_lowpass_filter_t::alpha, alpha_yaw_dec, alpha_yaw_inc, delayed_first_order_lowpass_filter_t::buffer, delayed_first_order_lowpass_propagate(), delayed_first_order_lowpass_filter_t::idx, INDI_PITCH, INDI_ROLL, INDI_THRUST, and INDI_YAW.
Referenced by stabilization_attitude_init().
Definition at line 268 of file stabilization_attitude_heli_indi.c.
References actuator_notchfilter, and indi_apply_notch_filters().
Referenced by stabilization_attitude_init().
The main idea of this function is to slow down a certain actuator, so that the actuator dynamics filtered by the compensater are equal to another slower actuator.
In this case, the tail rotor is slower than collective pitch. The collective pitch signal can be reduced so that the total dynamics match the dynamics of the tail rotor. This prevents the tail from breaking out. But at the moment thrust is not implemented so this is not used.
Definition at line 206 of file stabilization_attitude_heli_indi.c.
References actuator_model, delayed_first_order_lowpass_filter_t::alpha, alpha, alpha_yaw_dec, alpha_yaw_inc, DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT, INDI_PITCH, INDI_ROLL, INDI_THRUST, INDI_YAW, and INDI_YAW_BUFFER_SIZE.
Referenced by stabilization_attitude_init().
Definition at line 285 of file stabilization_attitude_heli_indi.c.
References INDI_DOF, measurement_lowpass_filters, and update_butterworth_2_low_pass_int().
Referenced by stabilization_attitude_init().
Definition at line 273 of file stabilization_attitude_heli_indi.c.
References indi_apply_notch_filters(), and measurement_notchfilter.
Referenced by stabilization_attitude_init().
|
inlinestatic |
Definition at line 249 of file stabilization_attitude_heli_indi.c.
References IndiController_int::enable_notch, heli_indi_ctl, INDI_NOTCH_MIN_RPM, INDI_PITCH, INDI_ROLL, INDI_THRUST, INDI_YAW, IndiController_int::motor_rpm, notch_filter_set_filter_frequency(), and notch_filter_update().
Referenced by indi_apply_actuator_notch_filters(), and indi_apply_measurement_notch_filters().
void stabilization_attitude_enter | ( | void | ) |
Definition at line 565 of file stabilization_attitude_heli_indi.c.
References Int32Eulers::psi, stab_att_sp_euler, and stabilization_attitude_get_heading_i().
void stabilization_attitude_heli_indi_set_steadystate_pitch | ( | float | pitch | ) |
stabilization_attitude_heli_indi_set_steadystate_pitch
pitch | neutral pitch angle [deg]. |
Change the neutral pitch angle.
Definition at line 298 of file stabilization_attitude_heli_indi.c.
References heli_indi_ctl, IndiController_int::sp_offset_pitch, and stabilization_attitude_heli_indi_set_steadystate_pitchroll().
void stabilization_attitude_heli_indi_set_steadystate_pitchroll | ( | ) |
stabilization_attitude_heli_indi_set_steadystate_pitchroll
Updates the neutral pitch and roll angles and calculates the compensation quaternion.
Definition at line 323 of file stabilization_attitude_heli_indi.c.
References float_quat_of_orientation_vect(), heli_indi_ctl, QUAT_BFP_OF_REAL, sp_offset, IndiController_int::sp_offset_pitch, IndiController_int::sp_offset_roll, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by stabilization_attitude_heli_indi_set_steadystate_pitch(), stabilization_attitude_heli_indi_set_steadystate_roll(), and stabilization_attitude_init().
void stabilization_attitude_heli_indi_set_steadystate_roll | ( | float | roll | ) |
stabilization_attitude_heli_indi_set_steadystate_roll
roll | neutral roll angle [deg]. |
Change the neutral roll angle. Especially useful for helicopters, since they need a small roll angle in hover to compensate the tail force.
Definition at line 311 of file stabilization_attitude_heli_indi.c.
References heli_indi_ctl, IndiController_int::sp_offset_roll, and stabilization_attitude_heli_indi_set_steadystate_pitchroll().
void stabilization_attitude_init | ( | void | ) |
stabilization_attitude_init
Initialize the heli indi attitude controller.
Definition at line 342 of file stabilization_attitude_heli_indi.c.
References actuator_lowpass_filters, actuator_model, actuator_notchfilter, delayed_first_order_lowpass_filter_t::alpha, alpha_yaw_dec, alpha_yaw_inc, ANGLE_BFP_OF_REAL, c(), DELAYED_FIRST_ORDER_LOWPASS_FILTER_FILTER_ALPHA_SHIFT, delayed_first_order_lowpass_initialize(), FALSE, heli_indi_ctl, indi_apply_actuator_butterworth_filters(), indi_apply_actuator_models(), indi_apply_actuator_notch_filters(), indi_apply_compensator_filters(), indi_apply_measurement_butterworth_filters(), indi_apply_measurement_notch_filters(), INDI_PITCH, INDI_ROLL, INDI_THRUST, INDI_YAW, init_butterworth_2_low_pass_int(), INVG_00, INVG_11, INVG_22, INVG_33, MAX_PPRZ, measurement_lowpass_filters, measurement_notchfilter, notch_filter_init(), STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_PITCH, STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_ROLL, STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_THRUST, STABILIZATION_ATTITUDE_HELI_INDI_BUTTERW_CUTOFF_YAW, STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_PITCH, STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_ROLL, STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_THRUST, STABILIZATION_ATTITUDE_HELI_INDI_NOTCHFILT_BW_YAW, STABILIZATION_ATTITUDE_HELI_INDI_PITCH_COMMAND_ROTATION, STABILIZATION_ATTITUDE_HELI_INDI_ROLL_COMMAND_ROTATION, stabilization_attitude_heli_indi_set_steadystate_pitchroll(), STABILIZATION_ATTITUDE_HELI_INDI_STEADY_STATE_PITCH, STABILIZATION_ATTITUDE_HELI_INDI_STEADY_STATE_ROLL, and TRUE.
void stabilization_attitude_read_rc | ( | bool | in_flight, |
bool | in_carefree, | ||
bool | coordinated_turn | ||
) |
Definition at line 606 of file stabilization_attitude_heli_indi.c.
References QUAT_BFP_OF_REAL, stab_att_sp_quat, stabilization_attitude_read_rc_setpoint_quat_earth_bound_f(), and stabilization_attitude_read_rc_setpoint_quat_f().
void stabilization_attitude_run | ( | bool | in_flight | ) |
Definition at line 434 of file stabilization_attitude_heli_indi.c.
References __k, autopilot_get_motors_on(), c(), IndiController_int::enable_notch, heli_indi_ctl, heli_indi_gains, INDI_DOF, INDI_NR_FILTERS, INDI_PITCH, INDI_ROLL, INDI_THRUST, INDI_YAW, INT32_INVG_FRAC, int32_quat_comp_inv(), int32_quat_inv_comp(), int32_quat_normalize(), int32_quat_wrap_shortest(), int32_rmat_vmult(), int32_vect_copy(), int32_vect_diff(), int32_vect_sum(), MAT_MUL_VECT, MAX_PPRZ, IndiController_int::motor_rpm, Int32Rates::p, HeliIndiGains::pitch_p, pprz_itrig_cos(), pprz_itrig_sin(), Int32Rates::q, Int32Quat::qx, Int32Quat::qy, Int32Quat::qz, Int32Rates::r, HeliIndiGains::roll_p, rpm_sensor_get_rpm(), sp_offset, stab_att_sp_quat, stabilization_cmd, stateGetAccelNed_i(), stateGetBodyRates_i(), stateGetNedToBodyQuat_i(), stateGetNedToBodyRMat_i(), NedCoor_i::x, Int32Vect3::x, NedCoor_i::y, Int32Vect3::y, HeliIndiGains::yaw_d, HeliIndiGains::yaw_p, NedCoor_i::z, and Int32Vect3::z.
void stabilization_attitude_set_earth_cmd_i | ( | struct Int32Vect2 * | cmd, |
int32_t | heading | ||
) |
Definition at line 589 of file stabilization_attitude_heli_indi.c.
References heading, INT32_TRIG_FRAC, Int32Eulers::phi, PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Eulers::psi, quat_from_earth_cmd_i(), stab_att_sp_euler, stab_att_sp_quat, stateGetNedToBodyEulers_i(), Int32Eulers::theta, Int32Vect2::x, and Int32Vect2::y.
void stabilization_attitude_set_failsafe_setpoint | ( | void | ) |
Definition at line 571 of file stabilization_attitude_heli_indi.c.
References PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Quat::qi, Int32Quat::qx, Int32Quat::qy, Int32Quat::qz, stab_att_sp_quat, and stabilization_attitude_get_heading_i().
void stabilization_attitude_set_rpy_setpoint_i | ( | struct Int32Eulers * | rpy | ) |
Definition at line 581 of file stabilization_attitude_heli_indi.c.
References int32_quat_of_eulers(), stab_att_sp_euler, and stab_att_sp_quat.
Butterworth2LowPass_int actuator_lowpass_filters[INDI_DOF] |
Definition at line 146 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_actuator_butterworth_filters(), and stabilization_attitude_init().
struct delayed_first_order_lowpass_filter_t actuator_model[INDI_DOF] |
Definition at line 142 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_actuator_models(), indi_apply_compensator_filters(), and stabilization_attitude_init().
struct SecondOrderNotchFilter actuator_notchfilter[INDI_DOF] |
Definition at line 148 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_actuator_notch_filters(), and stabilization_attitude_init().
int32_t alpha_yaw_dec |
Definition at line 144 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_actuator_models(), indi_apply_compensator_filters(), and stabilization_attitude_init().
int32_t alpha_yaw_inc |
Definition at line 143 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_actuator_models(), indi_apply_compensator_filters(), and stabilization_attitude_init().
struct IndiController_int heli_indi_ctl |
Definition at line 139 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_notch_filters(), stabilization_attitude_heli_indi_set_steadystate_pitch(), stabilization_attitude_heli_indi_set_steadystate_pitchroll(), stabilization_attitude_heli_indi_set_steadystate_roll(), stabilization_attitude_init(), and stabilization_attitude_run().
struct HeliIndiGains heli_indi_gains |
Definition at line 131 of file stabilization_attitude_heli_indi.c.
Referenced by stabilization_attitude_run().
Butterworth2LowPass_int measurement_lowpass_filters[INDI_DOF] |
Definition at line 147 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_measurement_butterworth_filters(), and stabilization_attitude_init().
struct SecondOrderNotchFilter measurement_notchfilter[INDI_DOF] |
Definition at line 149 of file stabilization_attitude_heli_indi.c.
Referenced by indi_apply_measurement_notch_filters(), and stabilization_attitude_init().
struct Int32Quat sp_offset |
Definition at line 129 of file stabilization_attitude_heli_indi.c.
Referenced by stabilization_attitude_heli_indi_set_steadystate_pitchroll(), and stabilization_attitude_run().
struct Int32Eulers stab_att_sp_euler |
with INT32_ANGLE_FRAC
Definition at line 128 of file stabilization_attitude_heli_indi.c.
Referenced by stabilization_attitude_enter(), stabilization_attitude_set_earth_cmd_i(), and stabilization_attitude_set_rpy_setpoint_i().
struct Int32Quat stab_att_sp_quat |
with INT32_QUAT_FRAC
Definition at line 127 of file stabilization_attitude_heli_indi.c.
Referenced by guidance_hybrid_set_cmd_i(), guidance_indi_run(), reset_horizontal_vars(), stabilization_attitude_read_rc(), stabilization_attitude_run(), stabilization_attitude_set_earth_cmd_i(), stabilization_attitude_set_failsafe_setpoint(), and stabilization_attitude_set_rpy_setpoint_i().