30 #include "generated/airframe.h"
41 #include "autopilot.h"
49 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
50 float thrust_in_specific_force_gain = GUIDANCE_INDI_SPECIFIC_FORCE_GAIN;
52 #ifndef GUIDANCE_INDI_THRUST_DYNAMICS
53 #ifndef STABILIZATION_INDI_ACT_DYN_P
54 #error "You need to define GUIDANCE_INDI_THRUST_DYNAMICS to be able to use indi vertical control"
55 #else // assume that the same actuators are used for thrust as for roll (e.g. quadrotor)
56 #define GUIDANCE_INDI_THRUST_DYNAMICS STABILIZATION_INDI_ACT_DYN_P
58 #endif //GUIDANCE_INDI_THRUST_DYNAMICS
60 #endif //GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
140 #ifdef GUIDANCE_INDI_RC_DEBUG
145 sp_accel.
x = cosf(psi) * rc_x - sinf(psi) * rc_y;
146 sp_accel.
y = sinf(psi) * rc_x + cosf(psi) * rc_y;
160 Bound(a_diff.
x, -6.0, 6.0);
161 Bound(a_diff.
y, -6.0, 6.0);
162 Bound(a_diff.
z, -9.0, 9.0);
166 #ifndef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
178 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
185 #ifdef GUIDANCE_INDI_RC_DEBUG
203 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
260 float sphi = sinf(euler->
phi);
261 float cphi = cosf(euler->
phi);
262 float stheta = sinf(euler->
theta);
263 float ctheta = cosf(euler->
theta);
264 float spsi = sinf(euler->
psi);
265 float cpsi = cosf(euler->
psi);
269 RMAT_ELMT(*Gmat, 0, 0) = (cphi*spsi - sphi*cpsi*stheta)*T;
270 RMAT_ELMT(*Gmat, 1, 0) = (-sphi*spsi*stheta - cpsi*cphi)*T;
272 RMAT_ELMT(*Gmat, 0, 1) = (cphi*cpsi*ctheta)*T;
273 RMAT_ELMT(*Gmat, 1, 1) = (cphi*spsi*ctheta)*T;
275 RMAT_ELMT(*Gmat, 0, 2) = sphi*spsi + cphi*cpsi*stheta;
276 RMAT_ELMT(*Gmat, 1, 2) = cphi*spsi*stheta - cpsi*sphi;
void guidance_indi_enter(void)
Call upon entering indi guidance.
void float_quat_comp_inv(struct FloatQuat *a2b, struct FloatQuat *a2c, struct FloatQuat *b2c)
Composition (multiplication) of two quaternions.
void float_quat_of_eulers(struct FloatQuat *q, struct FloatEulers *e)
Quaternion from Euler angles.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
void float_quat_comp(struct FloatQuat *a2c, struct FloatQuat *a2b, struct FloatQuat *b2c)
Composition (multiplication) of two quaternions.
General attitude stabilization interface for rotorcrafts.
struct FloatVect3 sp_accel
Vertical guidance for rotorcrafts.
struct HorizontalGuidanceReference ref
reference calculated from setpoints
struct HorizontalGuidance guidance_h
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
void guidance_indi_filter_thrust(void)
#define ANGLE_FLOAT_OF_BFP(_ai)
struct Int32Quat stab_att_sp_quat
with INT32_QUAT_FRAC
struct FloatVect3 filt_accel_ned_d
void guidance_indi_filter_accel(void)
low pass the accelerometer measurements with a second order filter to remove noise from vibrations ...
#define QUAT_COPY(_qo, _qi)
#define FLOAT_VECT3_ZERO(_v)
struct FloatVect3 filt_accel_ned_dd
void guidance_indi_calcG(struct FloatMat33 *Gmat)
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Architecture independent timing functions.
float guidance_indi_pos_gain
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
#define QUAT_BFP_OF_REAL(_qi, _qf)
void stabilization_attitude_set_setpoint_rp_quat_f(struct FloatEulers *indi_rp_cmd, bool in_flight, int32_t heading)
static void float_quat_normalize(struct FloatQuat *q)
struct RadioControl radio_control
int32_t guidance_v_z_ref
altitude reference in meters.
struct FloatEulers guidance_euler_cmd
struct FloatVect3 euler_cmd
#define GUIDANCE_H_MAX_BANK
Inertial Measurement Unit interface.
float guidance_indi_speed_gain
Some helper functions to check RC sticks.
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
API to get/set the generic vehicle states.
#define RMAT_ELMT(_rm, _row, _col)
void float_quat_of_axis_angle(struct FloatQuat *q, const struct FloatVect3 *uv, float angle)
Quaternion from unit vector and angle.
void float_quat_comp_norm_shortest(struct FloatQuat *a2c, struct FloatQuat *a2b, struct FloatQuat *b2c)
Composition (multiplication) of two quaternions with normalization.
General stabilization interface for rotorcrafts.
Horizontal guidance for rotorcrafts.
struct Int32Vect2 pos
with INT32_POS_FRAC
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
struct FloatVect3 filt_accel_ned
#define VECT3_ADD_SCALED(_a, _b, _s)
#define POS_FLOAT_OF_BFP(_ai)
void guidance_indi_filter_attitude(void)
Filter the attitude, such that it corresponds to the filtered measured acceleration.
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
#define MAT33_INV(_minv, _m)
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
void guidance_indi_run(bool in_flight, int32_t heading)
Rotorcraft attitude reference generation.
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to ICRA2016 to learn more! ...
INS for rotorcrafts combining vertical and horizontal filters.