|
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
ANDI stabilization controller for tiltbody rotorcraft. More...
#include "firmwares/rotorcraft/stabilization/stabilization_andi.h"#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h"#include "math/pprz_algebra_float.h"#include "state.h"#include "generated/airframe.h"#include "modules/radio_control/radio_control.h"#include "modules/actuators/actuators.h"#include "modules/core/abi.h"#include "math/wls/wls_alloc.h"#include "modules/nav/nav_rotorcraft_hybrid.h"#include "firmwares/rotorcraft/navigation.h"#include "modules/rotwing_drone/rotwing_state.h"#include "modules/core/commands.h"#include "autopilot.h"#include "filters/low_pass_filter.h"#include "filters/low_pass_filter_types.h"#include "filters/complementary_filter.h"#include "filters/complementary_filter_types.h"#include "filters/transport_delay.h"#include "filters/transport_delay_types.h"#include "filters/low_pass_zoh_filter.h"#include "filters/low_pass_zoh_filter_types.h"#include <stdio.h>#include "modules/datalink/telemetry.h"
Include dependency graph for stabilization_andi.c:Go to the source code of this file.
ANDI stabilization controller for tiltbody rotorcraft.
Implements Adaptive Nonlinear Dynamic Inversion (ANDI) for attitude and thrust control with on-board model compensation.
Assumptions:
FIXME: WLS allocation normalization depends on control effectiveness scaling (state-dependent). Consider normalizing costs by max achievable derivatives per actuator/output.
Definition in file stabilization_andi.c.
|
static |
Callback function to handle incoming actuator telemetry data.
This function copies the data from the input struct pointer actuators_t4_in_ptr into a local static instance actuator_obs for further processing or monitoring.
| sender_id | Identifier of the sender of the telemetry data. |
| actuators_t4_in_ptr | Pointer to the incoming ActuatorsT4In struct containing ESC telemetry, servo angles, loads, and other actuator info. |
| actuators_t4_extra_data_in_ptr | Pointer to additional extra actuator data (unused). |
Definition at line 507 of file stabilization_andi.c.
References actuators_t4_obs, and foo.
Referenced by stabilization_andi_init().
Here is the caller graph for this function:Definition at line 1414 of file stabilization_andi.c.
|
static |
Compute error-compensation gains for a 2nd-order 3D system.
Each axis gain (x, y, z) is computed using ec_k*_order2_f() with omega_n and zeta parameters.
| [in] | poles | Pointer to PolesOrder2Vect3 containing omega_n and zeta for each axis. |
Definition at line 613 of file stabilization_andi.c.
References ec_k1_order2_f(), ec_k2_order2_f(), foo, gains, GainsOrder2Vect3::k1, and FloatVect3::x.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Compute error-compensation gains for a 3rd-order 3D system.
Each axis gain (x, y, z) is computed using ec_k*_order3_f() with omega_n, zeta, and p1 parameters.
| [in] | poles | Pointer to PolesOrder3Vect3 containing omega_n, zeta, and p1 for each axis. |
Definition at line 590 of file stabilization_andi.c.
References ec_k1_order3_f(), ec_k2_order3_f(), ec_k3_order3_f(), foo, gains, GainsOrder3Vect3::k1, and FloatVect3::x.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Compute reference-model gains for a 2nd-order 3D system.
Each axis gain (x, y, z) is computed using rm_k*_order2_f() with omega_n and zeta parameters.
| [in] | poles | Pointer to PolesOrder2Vect3 containing omega_n and zeta for each axis. |
Definition at line 571 of file stabilization_andi.c.
References foo, gains, GainsOrder2Vect3::k1, rm_k1_order2_f(), rm_k2_order2_f(), and FloatVect3::x.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Compute reference-model gains for a 3rd-order 3D system.
Each axis gain (x, y, z) is computed using rm_k*_order3_f() with omega_n, zeta, and p1 parameters.
| [in] | poles | Pointer to PolesOrder3Vect3 containing omega_n, zeta, and p1 for each axis. |
Definition at line 548 of file stabilization_andi.c.
References foo, gains, GainsOrder3Vect3::k1, rm_k1_order3_f(), rm_k2_order3_f(), rm_k3_order3_f(), and FloatVect3::x.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Compute lower bounds for actuator rate commands based on actuator state and constraints.
This function calculates the minimum allowable actuator rate commands (u_d_min) for each actuator to ensure that:
act_min) in the next timestep.act_rate_min). The computed lower bound is the maximum of the position-based rate limit and the minimum rate limit. Additionally, if the computed lower bound is greater than zero (i.e., actuator cannot reverse direction), it is clamped to zero.| [out] | u_d_min | Array to store the computed lower bounds for actuator rates. |
| [in] | act_state | Current states (positions) of the actuators. |
| [in] | act_min | Minimum allowable positions for the actuators. |
| [in] | act_rate_min | Minimum allowable rates for the actuators. |
| [in] | actuator_bandwidth | Bandwidth of the actuators used to compute rate limits. |
Definition at line 916 of file stabilization_andi.c.
References act_min, ANDI_NUM_ACT, and foo.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:
|
static |
Compute input scaling factors for normalizing weighted least squares.
This function calculates the input scaling factors (u_scaler) for each actuator based on the provided minimum (act_min) and maximum (act_max) actuator values. The scaling factor is computed as the inverse of the range (max - min). If the range is zero, the scaling factor is set to 1.0 to avoid division by zero.
u_norm = u_scaler * u
| [out] | u_scaler | Array to store the computed input scaling factors. |
| [in] | act_min | Array of minimum actuator values. |
| [in] | act_max | Array of maximum actuator values. |
Definition at line 941 of file stabilization_andi.c.
References act_max, act_min, ANDI_NUM_ACT, and foo.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:
|
static |
Compute upper bounds for actuator rate commands based on actuator state and constraints.
This function calculates the maximum allowable actuator rate commands (u_d_max) for each actuator to ensure that:
act_max) in the next timestep.act_rate_max). The computed upper bound is the minimum of the position-based rate limit and the maximum rate limit.| [out] | u_d_max | Array to store the computed upper bounds for actuator rates. |
| [in] | act_state | Current states (positions) of the actuators. |
| [in] | act_max | Maximum allowable positions for the actuators. |
| [in] | act_rate_max | Maximum allowable rates for the actuators. |
| [in] | actuator_bandwidth | Bandwidth of the actuators used to compute rate limits. |
Definition at line 890 of file stabilization_andi.c.
References act_max, ANDI_NUM_ACT, and foo.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:
|
static |
Compute output scaling factors for normalizing weighted least squares outputs.
For each output i this sets v_scaler[i] = 1.0f / abs(v[i]) when v[i] is non-zero; otherwise v_scaler[i] is set to 1.0f to avoid a division-by-zero. The normalized output used in WLS is then
v_norm = v_scaler * v.
| [out] | v_scaler | Array of length ANDI_NUM_ACT to store the computed inverse scaling factors. |
| [in] | v | Array of length ANDI_NUM_ACT containing reference/scaling values used to compute the inverse. |
Definition at line 965 of file stabilization_andi.c.
References ANDI_NUM_ACT, and foo.
|
static |
Computes the attitude rate error control command.
This function calculates the control input vector nu to correct the attitude error and the associated angular rate errors using proportional-derivative gains. The quaternion error between the reference and current attitudes is also factored in the control law.
| [in] | att_ref | Pointer to the reference attitude and rate states (quaternion-based). |
| [in] | att_state | Pointer to the current attitude and rate states. |
| [in] | k_att_ec | Pointer to gain parameters struct containing proportional, derivative, and jerk gains. |
Definition at line 826 of file stabilization_andi.c.
References att_state, float_quat_inv_comp_norm_shortest(), foo, nu, FloatRates::p, FloatRates::q, FloatRates::r, and FloatVect3::x.
Referenced by stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Computes the control error command for attitude rate regulation.
This function calculates the virtual control input vector nu required to reduce the error between the reference and current angular rate states. It uses proportional and derivative gains on the differences of rate and rate derivative components, respectively, and adds feedforward jerk.
| [in] | att_ref | Pointer to the reference attitude and rate state structure. |
| [in] | att_state | Pointer to the current attitude and rate state structure. |
| [in] | k_rate_ec | Pointer to gain parameters structure, containing proportional and derivative gains. |
FloatVect3 structure representing the computed virtual control input vector. Definition at line 795 of file stabilization_andi.c.
References att_state, foo, nu, FloatRates::p, FloatRates::q, FloatRates::r, and FloatVect3::x.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:
|
static |
Computes the thrust control command based on desired and current thrust.
This function calculates a corrected thrust command using a simple proportional feedback law. The correction term is scaled by the thrust error gain k_thrust_ec to reduce the difference between the desired thrust (thrust_ref->thrust) and the current thrust (thrust_state). The resulting command is based on the desired thrust feedforward input thrust_ref->thrust_d.
| [in] | thrust_ref | Pointer to a structure containing the desired thrust values. |
| [in] | thrust_state | Current measured thrust value. |
| [in] | k_thrust_ec | Proportional gain applied to the thrust error correction. |
Definition at line 866 of file stabilization_andi.c.
References foo, nu, ThrustRef::thrust, ThrustRef::thrust_d, thrust_ref, and thrust_state.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:Definition at line 257 of file stabilization_andi.c.
Referenced by compute_error_gains_order_2_vect_3().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 249 of file stabilization_andi.c.
Referenced by compute_error_gains_order_3_vect_3().
Here is the caller graph for this function:Definition at line 258 of file stabilization_andi.c.
Referenced by compute_error_gains_order_2_vect_3(), rm_k1_order2_f(), and rm_k2_order2_f().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 250 of file stabilization_andi.c.
Referenced by compute_error_gains_order_3_vect_3().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 251 of file stabilization_andi.c.
Referenced by compute_error_gains_order_3_vect_3().
Here is the caller graph for this function:
|
static |
Extract actuator states from ActuatorsT4In struct.
This function converts selected actuator telemetry data from the input struct into floating-point values representing angles in radians and rotational speeds in radians per second, storing them in the provided actuator_state array.
FIXME: Avoid hardcoding indices, conversion factors, and inversions; This requires additional functionality in actuators_t4. FIXME: Put actuator feedback / state management in a separate module. FIXME: All ESC type actuators will be squared rpm for thrust linearization.
| [out] | actuator_state | Array of floats with size ANDI_NUM_ACT where the converted actuator states will be stored. The caller must allocate this. |
| [in] | actuators_t4_in_ptr | Pointer to the input struct containing actuator telemetry, including servo angles (in 1e-2 degrees) and ESC RPM. |
Definition at line 532 of file stabilization_andi.c.
References actuator_meas, and foo.
Referenced by stabilization_andi_enter(), and stabilization_andi_run().
Here is the caller graph for this function:
|
static |
Generates a bounded second-order reference signal for quaternion-based attitude control.
Computes smooth angular rate, acceleration, and jerk references using quaternion error feedback. Bounds are applied to limit reference values and maintain system stability. The function updates the reference states in place within the provided att_ref structure, which includes quaternion attitude and associated rate states.
| [in] | dt | Sampling interval in seconds. |
| [in] | att_des | Desired attitude as a unit quaternion. |
| [in] | k_att_rm | Gain parameters (proportional and derivative gains for rate control). |
| [in] | bounds | Limits on rate references and derivatives (angular velocity and higher). |
| [in,out] | att_ref | Reference model state containing attitude quaternion and rate state, updated in place. |
FIXME: The bounds introduce nonlinearities that may destabilize the reference model for large changes in attitude. Currently removed, consider revising the bounding strategy. FIXME: Quaternion error calculation assumes small angle errors; may need to be revised for large attitude changes.
Definition at line 704 of file stabilization_andi.c.
References float_quat_integrate(), float_quat_inv_comp_norm_shortest(), float_quat_normalize(), foo, Gains3rdOrder::k1, Gains3rdOrder::k2, Gains3rdOrder::k3, and k_att_rm.
Referenced by stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Generates a bounded second-order reference signal for attitude rate control.
This function computes smooth angular rate, acceleration, and jerk references based on the desired rates, applying bounded limits to ensure stability and safe dynamic behavior. It updates the reference states in place within the provided att_ref structure, which is a quaternion-based reference with associated rate states.
| [in] | dt | The sampling interval in seconds. |
| [in] | rate_des | Desired angular rates (p, q, r) as a FloatRates structure. |
| [in] | k_rate_rm | Gain parameters as GainsOrder2Vect3, for the proportional and derivative terms. |
| [in] | bounds | Limits for the desired rates, rates derivatives, and accelerations, in AttRefEulers. |
| [in,out] | att_ref | The reference model states (attitude quaternion, rates, and derivatives), updated in place to produce the reference command. |
Definition at line 640 of file stabilization_andi.c.
References float_quat_identity(), and foo.
Referenced by stabilization_andi_run().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Generates a bounded second-order reference signal for thrust control.
Applies bounded limits to a desired thrust input and computes smoothed thrust rate and integrated thrust references. The reference states are updated in place inside the provided thrust_ref structure.
| [in] | dt | Sampling interval in seconds. |
| [in] | thrust_des | Desired thrust input value. |
| [in] | k_thrust_rm | Gain parameter for thrust rate control (proportional gain). |
| [in] | bounds | Maximum allowable thrust magnitude. |
| [in,out] | thrust_ref | Pointer to ThrustRef struct holding thrust reference states. |
Definition at line 767 of file stabilization_andi.c.
References foo, ThrustRef::thrust, ThrustRef::thrust_d, thrust_des, and thrust_ref.
Referenced by stabilization_andi_run().
Here is the caller graph for this function:Definition at line 259 of file stabilization_andi.c.
References ec_k2_order2_f().
Referenced by compute_reference_gains_order_2_vect_3().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 253 of file stabilization_andi.c.
Referenced by compute_reference_gains_order_3_vect_3().
Here is the caller graph for this function:Definition at line 260 of file stabilization_andi.c.
References ec_k2_order2_f().
Referenced by compute_reference_gains_order_2_vect_3().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 254 of file stabilization_andi.c.
Referenced by compute_reference_gains_order_3_vect_3().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 255 of file stabilization_andi.c.
Referenced by compute_reference_gains_order_3_vect_3().
Here is the caller graph for this function:
|
static |
Definition at line 426 of file stabilization_andi.c.
References ANDI_NUM_ACT, ce_mat, dev, and foo.
Referenced by stabilization_andi_init().
Here is the caller graph for this function:
|
static |
Definition at line 437 of file stabilization_andi.c.
References actuator_state, ANDI_OUTPUTS, AttQuat::att, AttStateQuat::att, AttQuat::att_2d, AttStateQuat::att_2d, AttQuat::att_3d, AttQuat::att_d, AttStateQuat::att_d, attitude_des, attitude_ref, attitude_state_cf, dev, and foo.
Referenced by stabilization_andi_init().
Here is the caller graph for this function:
|
static |
Definition at line 413 of file stabilization_andi.c.
References ANDI_NUM_ACT, dev, du_cmd, du_max, du_min, foo, and WLS_WU.
Referenced by stabilization_andi_init().
Here is the caller graph for this function:
|
static |
Definition at line 402 of file stabilization_andi.c.
References ANDI_OUTPUTS, dev, foo, WLS_t::gamma_sq, WLS_t::iter, nu_obj, wls_stab_p, and WLS_WV.
Referenced by stabilization_andi_init().
Here is the caller graph for this function:Initializes the ANDI stabilization controller state upon entering stabilization mode.
This function resets all relevant state variables, filters, and actuator states to match the current measurements when entering the ANDI stabilization mode. It ensures that the controller starts from a consistent state when entering stabilization.
NOTE: This function currently assumes that the actuator feedback message is being received. FIXME: Transient free initialization for the cascaded complementary filters is not implemented.
Definition at line 1094 of file stabilization_andi.c.
References LinState::acc, actuator_obm_delay, actuator_obm_zohlpf, ACTUATOR_PREF, actuator_state, actuators_t4_obs, ANDI_NUM_ACT, ANDI_OUTPUTS, angular_rates_obm, AttQuat::att, AttStateQuat::att, AttQuat::att_2d, AttStateQuat::att_2d, AttQuat::att_3d, AttQuat::att_d, AttStateQuat::att_d, attitude_accel_cf, attitude_rates_cf, attitude_ref, attitude_state_cf, ce_mat, evaluate_obm_f_stb_u(), evaluate_obm_thrust_z(), fetch_actuators_t4(), float_quat_vmult(), float_vect_zero(), linear_accel_cf, linear_state_cf, linear_vel_cf, linear_velocity_obm, nu_obm, FloatRates::p, FloatRates::q, FloatRates::r, rates_prev, reset_butterworth_2_complementary_vect3(), reset_first_order_complementary_rates(), reset_first_order_complementary_vect3(), reset_first_order_zoh_low_pass_array(), reset_transport_delay_array(), stateGetBodyRates_f(), stateGetNedToBodyQuat_f(), stateGetSpeedNed_f(), ThrustRef::thrust, ThrustRef::thrust_d, thrust_ref, thrust_state, u_cmd, LinState::vel, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Here is the call graph for this function:Definition at line 976 of file stabilization_andi.c.
References ABI_BROADCAST, LinState::acc, ACTUATOR_DELAY, actuator_obm_delay, actuator_obm_zohlpf, ACTUATOR_PREF, actuator_state, actuators_t4_in_callback(), actuators_t4_in_event, andi_k_att_ec, andi_k_att_rm, andi_k_rate_ec, andi_k_rate_rm, andi_k_thrust_ec, andi_k_thrust_rm, ANDI_NUM_ACT, andi_p_att_ec, andi_p_att_rm, andi_p_rate_ec, andi_p_rate_rm, andi_p_thrust_ec, andi_p_thrust_rm, angular_rates_obm, AttQuat::att, AttStateQuat::att, AttQuat::att_2d, AttStateQuat::att_2d, AttQuat::att_3d, AttQuat::att_d, AttStateQuat::att_d, attitude_accel_cf, attitude_bounds, attitude_rates_cf, attitude_ref, attitude_state_cf, ce_mat, compute_error_gains_order_2_vect_3(), compute_error_gains_order_3_vect_3(), compute_reference_gains_order_2_vect_3(), compute_reference_gains_order_3_vect_3(), DefaultPeriodic, du_cmd, evaluate_obm_f_stb_u(), float_quat_identity(), float_vect_zero(), foo, init_butterworth_2_complementary_vect3(), init_first_order_complementary_vect3(), init_first_order_zoh_low_pass_array(), init_transport_delay_array(), linear_accel_cf, linear_state_cf, linear_vel_cf, linear_velocity_obm, nu_ec, nu_obj, nu_obm, FloatRates::p, FloatRates::q, FloatRates::r, rates_prev, register_periodic_telemetry(), send_eff_mat_stabilization_andi(), send_stab_attitude_stabilization_andi(), send_wls_u_stabilization_andi(), send_wls_v_stabilization_andi(), ThrustRef::thrust, thrust_bounds_max, thrust_bounds_min, ThrustRef::thrust_d, THRUST_MIN, thrust_ref, thrust_state, u_cmd, LinState::vel, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Here is the call graph for this function:| void stabilization_andi_run | ( | bool | use_rate_control, |
| bool | in_flight, | ||
| struct StabilizationSetpoint * | stab_setpoint, | ||
| struct ThrustSetpoint * | thrust_setpoint, | ||
| int32_t * | cmd | ||
| ) |
Main ANDI stabilization control loop.
This function implements the core logic of the ANDI stabilization controller. The following steps are performed each time the function is called:
| [in] | use_rate_control | Flag indicating whether to use rate control mode. |
| [in] | in_flight | Flag indicating whether the vehicle is in flight. |
| [in,out] | stab_setpoint | Pointer to the stabilization setpoint structure. |
| [in,out] | thrust_setpoint | Pointer to the thrust setpoint structure. |
| [out] | cmd | Pointer to the output command array for actuators. |
ATTITUDE_HEADING_MODE. A heading estimate and setpoint is needed. Consider implementing ATTITUDE_HEADING_RATE_MODE to avoid needing a heading estimate.FIXME: The function currently recomputes gains at each call. This could be optimized to only recompute when parameters change. FIXME: The choice of actuator feedback source (T4 vs on-board model) should be configurable.
Definition at line 1185 of file stabilization_andi.c.
References LinState::acc, actuator_meas, actuator_obm_delay, actuator_obm_zohlpf, actuator_state, actuators_t4_obs, andi_k_att_ec, andi_k_att_rm, andi_k_rate_ec, andi_k_rate_rm, andi_k_thrust_ec, andi_k_thrust_rm, ANDI_NUM_ACT, ANDI_OUTPUTS, andi_p_att_ec, andi_p_att_rm, andi_p_rate_ec, andi_p_rate_rm, andi_p_thrust_ec, andi_p_thrust_rm, ANDI_RELAX_OBM, angular_rates_obm, AttStateQuat::att, AttStateQuat::att_2d, AttStateQuat::att_d, attitude_accel_cf, attitude_bounds, attitude_des, attitude_rates_cf, attitude_ref, attitude_state_cf, ce_mat, commands, compute_error_gains_order_2_vect_3(), compute_error_gains_order_3_vect_3(), compute_reference_gains_order_2_vect_3(), compute_reference_gains_order_3_vect_3(), compute_wls_lower_bounds(), compute_wls_u_scaler(), compute_wls_upper_bounds(), control_error_attitude(), control_error_rate(), control_error_thrust(), du_cmd, du_max, du_min, evaluate_obm_f_stb_u(), evaluate_obm_f_stb_x(), evaluate_obm_forces(), evaluate_obm_moments(), evaluate_obm_thrust_z(), fetch_actuators_t4(), float_quat_vmult(), float_rates_vect3_integrate_fi(), float_vect3_integrate_fi(), float_vect_zero(), foo, generate_reference_attitude(), generate_reference_rate(), generate_reference_thrust(), get_butterworth_2_complementary_vect3(), get_first_order_complementary_rates(), get_first_order_complementary_vect3(), get_first_order_zoh_low_pass_array(), get_transport_delay_array(), linear_accel_cf, linear_state_cf, linear_vel_cf, linear_velocity_obm, MAX_PPRZ, nu_ec, nu_obj, nu_obm, FloatRates::p, FloatRates::q, FloatRates::r, rates_des, rates_prev, SCHEDULE_EFF, stab_sp_to_quat_f(), stab_sp_to_rates_f(), stateGetAccelBody_f(), stateGetBodyRates_f(), stateGetNedToBodyQuat_f(), stateGetSpeedNed_f(), th_sp_to_thrust_f(), THRUST_AXIS_Z, thrust_bounds_max, thrust_bounds_min, thrust_des, thrust_ref, thrust_state, WLS_t::u, u_cmd, WLS_t::u_max, WLS_t::u_min, WLS_t::u_pref, update_butterworth_2_complementary_vect3(), update_first_order_complementary_rates(), update_first_order_complementary_vect3(), update_first_order_zoh_low_pass_array(), update_transport_delay_array(), USE_STATE_DYNAMICS, WLS_t::v, LinState::vel, wls_alloc(), wls_stab_p, WLS_WU, WLS_WV, WLS_t::Wu, and WLS_t::Wv.
Here is the call graph for this function:Attitude control enter function.
Definition at line 1372 of file stabilization_andi.c.
Referenced by ins_ekf2_publish_attitude(), and stabilization_mode_changed().
Here is the caller graph for this function:| void stabilization_attitude_run | ( | bool | in_flight, |
| struct StabilizationSetpoint * | sp, | ||
| struct ThrustSetpoint * | thrust, | ||
| int32_t * | cmd | ||
| ) |
Attitude control run function.
| [in] | in_flight | true if in flight |
| [in] | sp | pointer to the stabilization setpoint structure |
| [in] | thrust | pointer to the thrust setoint structure |
| [out] | cmd | pointer to the output command vector |
Definition at line 1389 of file stabilization_andi.c.
Referenced by guidance_flip_run(), guidance_module_run(), stabilization_run(), and vertical_ctrl_module_run().
Here is the caller graph for this function:Definition at line 1377 of file stabilization_andi.c.
Referenced by stabilization_mode_changed().
Here is the caller graph for this function:| struct StabilizationSetpoint stabilization_rate_read_rc | ( | struct RadioControl * | rc | ) |
Definition at line 1397 of file stabilization_andi.c.
References FLOAT_RATES_ZERO, foo, MAX_PPRZ, PITCH_RATE_DEADBAND_EXCEEDED, RC_RATE_MAX, RC_RATE_P, RC_RATE_Q, RC_RATE_R, ROLL_RATE_DEADBAND_EXCEEDED, stab_sp_from_rates_f(), and YAW_RATE_DEADBAND_EXCEEDED.
Referenced by rc_cb().
Here is the call graph for this function:
Here is the caller graph for this function:| void stabilization_rate_run | ( | bool | in_flight, |
| struct StabilizationSetpoint * | rate_sp, | ||
| struct ThrustSetpoint * | thrust, | ||
| int32_t * | cmd | ||
| ) |
Definition at line 1382 of file stabilization_andi.c.
Referenced by stabilization_run().
Here is the caller graph for this function:| const uint8_t ACTUATOR_DELAY[ANDI_NUM_ACT] = {0} |
Definition at line 103 of file stabilization_andi.c.
Referenced by stabilization_andi_init().
| const bool ACTUATOR_IS_SERVO[ANDI_NUM_ACT] = {0} |
Definition at line 91 of file stabilization_andi.c.
| float actuator_meas[ANDI_NUM_ACT] |
Definition at line 363 of file stabilization_andi.c.
Referenced by fetch_actuators_t4(), and stabilization_andi_run().
| struct TransportDelay actuator_obm_delay[ANDI_NUM_ACT] |
Definition at line 356 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct FirstOrderZOHLowPass actuator_obm_zohlpf[ANDI_NUM_ACT] |
Definition at line 355 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| const float ACTUATOR_PREF[ANDI_NUM_ACT] = {0.0f} |
Definition at line 123 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), and stabilization_andi_init().
| float actuator_state[ANDI_NUM_ACT] |
Definition at line 357 of file stabilization_andi.c.
Referenced by evaluate_obm_f_stb_u(), evaluate_obm_f_stb_x(), evaluate_obm_forces(), evaluate_obm_moments(), evaluate_obm_thrust_z(), send_stab_attitude_stabilization_andi(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float actuator_state_lpf[ANDI_NUM_ACT] |
Definition at line 358 of file stabilization_andi.c.
| abi_event actuators_t4_in_event |
Definition at line 362 of file stabilization_andi.c.
Referenced by stabilization_andi_init().
| struct ActuatorsT4In actuators_t4_obs |
Definition at line 361 of file stabilization_andi.c.
Referenced by actuators_t4_in_callback(), stabilization_andi_enter(), and stabilization_andi_run().
| struct GainsOrder3Vect3 andi_k_att_ec |
Definition at line 340 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct GainsOrder3Vect3 andi_k_att_rm |
Definition at line 341 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct GainsOrder2Vect3 andi_k_rate_ec |
Definition at line 338 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct GainsOrder2Vect3 andi_k_rate_rm |
Definition at line 339 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float andi_k_thrust_ec |
Definition at line 342 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float andi_k_thrust_rm |
Definition at line 343 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct PolesOrder3Vect3 andi_p_att_ec |
Definition at line 286 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct PolesOrder3Vect3 andi_p_att_rm |
Definition at line 303 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct PolesOrder2Vect3 andi_p_rate_ec |
Definition at line 262 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct PolesOrder2Vect3 andi_p_rate_rm |
Definition at line 274 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float andi_p_thrust_ec = STABILIZATION_ANDI_POLE_THRUST_EC |
Definition at line 320 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float andi_p_thrust_rm = STABILIZATION_ANDI_POLE_THRUST_RM |
Definition at line 321 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
Definition at line 85 of file stabilization_andi.c.
Referenced by stabilization_andi_run().
| struct FloatRates angular_rates_obm |
Definition at line 348 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct Butterworth2ComplementaryVect3 attitude_accel_cf |
Definition at line 347 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct AttQuat attitude_bounds |
Definition at line 383 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct FloatQuat attitude_des |
Definition at line 379 of file stabilization_andi.c.
Referenced by send_stab_attitude_stabilization_andi(), and stabilization_andi_run().
| struct FirstOrderComplementaryVect3 attitude_rates_cf |
Definition at line 346 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct AttQuat attitude_ref |
Definition at line 374 of file stabilization_andi.c.
Referenced by send_stab_attitude_stabilization_andi(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct AttStateQuat attitude_state_cf |
Definition at line 369 of file stabilization_andi.c.
Referenced by send_stab_attitude_stabilization_andi(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float ce_mat[ANDI_NUM_ACT *ANDI_OUTPUTS] |
Definition at line 388 of file stabilization_andi.c.
Referenced by send_eff_mat_stabilization_andi(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float du_cmd[ANDI_NUM_ACT] |
Definition at line 391 of file stabilization_andi.c.
Referenced by send_wls_u_stabilization_andi(), stabilization_andi_init(), and stabilization_andi_run().
| float du_max[ANDI_NUM_ACT] |
Definition at line 390 of file stabilization_andi.c.
Referenced by send_wls_u_stabilization_andi(), and stabilization_andi_run().
| float du_min[ANDI_NUM_ACT] |
Definition at line 389 of file stabilization_andi.c.
Referenced by send_wls_u_stabilization_andi(), and stabilization_andi_run().
| struct Butterworth2ComplementaryVect3 linear_accel_cf |
Definition at line 351 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct LinState linear_state_cf |
Definition at line 370 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct FirstOrderComplementaryVect3 linear_vel_cf |
Definition at line 350 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct FloatVect3 linear_velocity_obm |
Definition at line 352 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float nu_ec[ANDI_OUTPUTS] |
Definition at line 396 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float nu_obj[ANDI_OUTPUTS] |
Definition at line 395 of file stabilization_andi.c.
Referenced by send_wls_v_stabilization_andi(), stabilization_andi_init(), and stabilization_andi_run().
| float nu_obm[ANDI_OUTPUTS] |
Definition at line 397 of file stabilization_andi.c.
Referenced by evaluate_obm_f_stb_x(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| struct FloatRates rates_des |
Definition at line 378 of file stabilization_andi.c.
Referenced by stabilization_andi_run().
| struct FloatRates rates_prev |
Definition at line 366 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| const float RC_RATE_MAX[ANDI_OUTPUTS] = {[0 ... ANDI_OUTPUTS - 1] = 5.0f} |
Definition at line 129 of file stabilization_andi.c.
Referenced by stabilization_rate_read_rc().
Definition at line 73 of file stabilization_andi.c.
Referenced by stabilization_andi_run().
| struct ThrustRef thrust_bounds_max |
Definition at line 385 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| struct ThrustRef thrust_bounds_min |
Definition at line 384 of file stabilization_andi.c.
Referenced by stabilization_andi_init(), and stabilization_andi_run().
| float thrust_des |
Definition at line 380 of file stabilization_andi.c.
Referenced by generate_reference_thrust(), and stabilization_andi_run().
Definition at line 135 of file stabilization_andi.c.
Referenced by stabilization_andi_init().
| struct ThrustRef thrust_ref |
Definition at line 375 of file stabilization_andi.c.
Referenced by control_error_thrust(), generate_reference_thrust(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float thrust_state |
Definition at line 371 of file stabilization_andi.c.
Referenced by control_error_thrust(), stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
| float u_cmd[ANDI_NUM_ACT] |
Definition at line 392 of file stabilization_andi.c.
Referenced by stabilization_andi_enter(), stabilization_andi_init(), and stabilization_andi_run().
Definition at line 79 of file stabilization_andi.c.
Referenced by stabilization_andi_run().
| struct WLS_t wls_stab_p |
Definition at line 325 of file stabilization_andi.c.
Referenced by schdule_control_effectiveness(), send_wls_v_stabilization_andi(), stabilization_andi_run(), and stabilization_indi_set_wls_settings().
| float WLS_WU[ANDI_NUM_ACT] = {[0 ... ANDI_NUM_ACT - 1] = 1.0f} |
Normalized actuator cost for WLS allocation.
Each value corresponds to the relative cost of using each actuator, normalized over the possible range of u_dot for that actuator. FIXME: This normalization is not ideal or constant, as it depends on the scaling of the control.
Definition at line 172 of file stabilization_andi.c.
Referenced by send_wls_u_stabilization_andi(), and stabilization_andi_run().
| const float WLS_WV[ANDI_OUTPUTS] = {[0 ... ANDI_OUTPUTS - 1] = 1.0f} |
Definition at line 160 of file stabilization_andi.c.
Referenced by send_wls_v_stabilization_andi(), and stabilization_andi_run().