Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer

Committer:
fbob
Date:
Wed Sep 26 21:47:37 2018 +0000
Revision:
4:8c7b42745080
Parent:
3:e782fe31ace2
Child:
5:b9947e3d20cf
t

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fbob 0:b1f2c9e88e32 1 #ifndef AttitudeController_h
fbob 0:b1f2c9e88e32 2 #define AttitudeController_h
fbob 0:b1f2c9e88e32 3
fbob 0:b1f2c9e88e32 4 #include "mbed.h"
fbob 0:b1f2c9e88e32 5
fbob 2:7e01bc32bf4c 6 // Controller time constants (s)
fbob 4:8c7b42745080 7 float const T_phi = 0.2f;
fbob 4:8c7b42745080 8 float const T_theta = 0.2f;
fbob 3:e782fe31ace2 9 float const T_psi = 0.2f;
fbob 3:e782fe31ace2 10 float const T_p = 0.04f;
fbob 3:e782fe31ace2 11 float const T_q = 0.04f;
fbob 3:e782fe31ace2 12 float const T_r = 0.1f;
fbob 0:b1f2c9e88e32 13
fbob 2:7e01bc32bf4c 14 // Quadcopter moments of inertia (kg.m^2)
fbob 0:b1f2c9e88e32 15 float const I_xx = 16.0e-6f;
fbob 0:b1f2c9e88e32 16 float const I_yy = 16.0e-6f;
fbob 0:b1f2c9e88e32 17 float const I_zz = 29.0e-6f;
fbob 0:b1f2c9e88e32 18
fbob 0:b1f2c9e88e32 19 class AttitudeController
fbob 0:b1f2c9e88e32 20 {
fbob 0:b1f2c9e88e32 21 public:
fbob 0:b1f2c9e88e32 22 // Class constructor
fbob 0:b1f2c9e88e32 23 AttitudeController();
fbob 3:e782fe31ace2 24 // Control torques given reference angles and current angles and angular velocities
fbob 2:7e01bc32bf4c 25 void control(float phi_r, float theta_r, float psi_r, float phi, float theta, float psi, float p, float q, float r);
fbob 0:b1f2c9e88e32 26 // Torques (N.m)
fbob 0:b1f2c9e88e32 27 float tau_phi, tau_theta, tau_psi;
fbob 0:b1f2c9e88e32 28 private:
fbob 3:e782fe31ace2 29 // Control torques given reference angles and current angles and angular velocities (with given time constants and moments of inertia)
fbob 3:e782fe31ace2 30 float control_single(float angle_r, float angle, float rate, float T_angle, float T_rate, float I);
fbob 0:b1f2c9e88e32 31 };
fbob 0:b1f2c9e88e32 32
fbob 3:e782fe31ace2 33 #endif