Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
stabilization_andi.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2025 Justin Dubois <j.p.g.dubois@student.tudelft.nl>
4 *
5 * This file is part of paparazzi
6 *
7 * paparazzi is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * paparazzi is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with paparazzi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
34#ifndef STABILIZATION_ANDI_H
35#define STABILIZATION_ANDI_H
36
39#include "generated/airframe.h"
40#include <stdio.h>
42
43
44#ifndef ANDI_NUM_ACT
45 #define ANDI_NUM_ACT COMMANDS_NB_REAL
46#endif
47
48#ifndef ANDI_OUTPUTS
49 #error "You must specify the number of controlled axis (outputs)"
50#endif
51
60struct AttQuat {
61 struct FloatQuat att;
65};
66
75 struct FloatQuat att;
78};
79
86struct LinState {
89};
90
97struct ThrustRef {
98 float thrust;
99 float thrust_d;
100};
101
113
123
130};
131
139};
140
141/* Declaration of Reference Model and Error Controller Poles */
142extern struct PolesOrder2Vect3 andi_p_rate_ec;
143extern struct PolesOrder2Vect3 andi_p_rate_rm;
144extern struct PolesOrder3Vect3 andi_p_att_ec;
145extern struct PolesOrder3Vect3 andi_p_att_rm;
146extern float andi_p_thrust_ec;
147extern float andi_p_thrust_rm;
148
149void stabilization_andi_init(void);
150void stabilization_andi_enter(void);
153// void actuator_debug(bool do_servo_step, bool do_motor_step, float step_rate);
154
173struct FloatVect3 evaluate_obm_forces(const struct FloatRates *rates, const struct FloatVect3 *vel_body,
174 const float actuator_state[ANDI_NUM_ACT]);
175
194struct FloatVect3 evaluate_obm_moments(const struct FloatRates *rates, const struct FloatVect3 *vel_body,
195 const float actuator_state[ANDI_NUM_ACT]);
196
223void evaluate_obm_f_stb_u(float fu_mat[ANDI_NUM_ACT * ANDI_OUTPUTS], const struct FloatRates *rates,
224 const struct FloatVect3 *vel_body, const float actuator_state[ANDI_NUM_ACT]);
225
251void evaluate_obm_f_stb_x(float nu_obm[ANDI_OUTPUTS], const struct FloatRates *rates, const struct FloatVect3 *vel_body,
252 const struct FloatVect3 *ang_accel, const struct FloatVect3 *accel_body, const float actuator_state[ANDI_NUM_ACT]);
253
254
277#endif // STABILIZATION_ANDI_H
Roation quaternion.
angular rates
Simple first order low pass filter with bilinear transform.
uint16_t foo
Definition main_demo5.c:58
#define ANDI_OUTPUTS
General stabilization interface for rotorcrafts.
float actuator_state[ANDI_NUM_ACT]
float nu_obm[ANDI_OUTPUTS]
struct PolesOrder2Vect3 andi_p_rate_rm
float andi_p_thrust_ec
void stabilization_andi_enter(void)
Initializes the ANDI stabilization controller state upon entering stabilization mode.
float andi_p_thrust_rm
struct FloatRates att_d
struct FloatVect3 k1
struct FloatVect3 vel
struct FloatVect3 k3
struct FloatQuat att
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.
float evaluate_obm_thrust_z(const float actuator_state[ANDI_NUM_ACT])
Compute total thrust produced by the current actuator state.
struct PolesOrder3Vect3 andi_p_att_ec
struct PolesOrder2Vect3 andi_p_rate_ec
struct FloatVect3 acc
void stabilization_andi_init(void)
#define ANDI_NUM_ACT
struct FloatVect3 att_2d
struct FloatQuat att
struct FloatVect3 zeta
struct FloatRates att_d
struct FloatVect3 omega_a
struct FloatVect3 omega_a
struct FloatVect3 omega_n
struct FloatVect3 k2
struct FloatVect3 evaluate_obm_forces(const struct FloatRates *rates, const struct FloatVect3 *vel_body, const float actuator_state[ANDI_NUM_ACT])
Evaluate total force acting on the vehicle from the OBM.
struct FloatVect3 evaluate_obm_moments(const struct FloatRates *rates, const struct FloatVect3 *vel_body, const float actuator_state[ANDI_NUM_ACT])
Evaluate total moments acting on the vehicle from the OBM.
struct FloatVect3 att_3d
struct PolesOrder3Vect3 andi_p_att_rm
void evaluate_obm_f_stb_u(float fu_mat[ANDI_NUM_ACT *ANDI_OUTPUTS], const struct FloatRates *rates, const struct FloatVect3 *vel_body, const float actuator_state[ANDI_NUM_ACT])
Evaluate the state-dependent control effectiveness matrix F_u for stabilization.
struct FloatVect3 att_2d
void evaluate_obm_f_stb_x(float nu_obm[ANDI_OUTPUTS], const struct FloatRates *rates, const struct FloatVect3 *vel_body, const struct FloatVect3 *ang_accel, const struct FloatVect3 *accel_body, const float actuator_state[ANDI_NUM_ACT])
Evaluate the state-dependent contribution F_x * x_dot for stabilization.
struct FloatVect3 k1
struct FloatVect3 k2
struct FloatVect3 zeta
Structure representing attitude in quaternion form along with its first three derivatives,...
Structure representing attitude in quaternion form along with its first two derivatives,...
Structure defining second-order gain parameters for vectorized 3D quantities.
Structure defining third-order gain parameters for vectorized 3D quantities.
Structure representing linear state with velocity and acceleration vectors.
Structure defining second-order pole parameters for vectorized 3D quantities.
Structure defining third-order pole parameters for vectorized 3D quantities.
Structure representing (specific) thrust reference and its derivative.
Rate stabilization for rotorcrafts.
Stabilization setpoint.
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
int int32_t
Typedef defining 32 bit int type.