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

Committer:
fbob
Date:
Fri Oct 05 13:19:03 2018 +0000
Revision:
16:54d2f299e404
Parent:
15:155ca63b7884
Child:
17:f682b4a5686d
Take off

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fbob 5:b9947e3d20cf 1 #ifndef Parameters_h
fbob 5:b9947e3d20cf 2 #define Parameters_h
fbob 5:b9947e3d20cf 3
fbob 13:1a871ebd35bb 4 // Interrupt frequencies
fbob 15:155ca63b7884 5 const float f = 500.0f; // Hz
fbob 13:1a871ebd35bb 6 const float f_range = 20.0f; // Hz
fbob 15:155ca63b7884 7 const float f_flow = 200.0f; // Hz
fbob 13:1a871ebd35bb 8 const float dt = 1.0f/f; // s
fbob 13:1a871ebd35bb 9 const float dt_range = 1.0f/f_range;// s
fbob 13:1a871ebd35bb 10 const float dt_flow = 1.0f/f_flow; // s
fbob 9:15058b4fa090 11
fbob 5:b9947e3d20cf 12 // Motor constants
fbob 5:b9947e3d20cf 13 const float alpha = 1.16e-07f;
fbob 5:b9947e3d20cf 14 const float beta = 7.149e-10f;
fbob 5:b9947e3d20cf 15
fbob 5:b9947e3d20cf 16 // Propeller constants
fbob 9:15058b4fa090 17 const float kl = 1.726e-08f; // N.s^2/rad^2
fbob 9:15058b4fa090 18 const float kd = 1.426e-10f; // N.m.s^2/rad^2
fbob 5:b9947e3d20cf 19
fbob 5:b9947e3d20cf 20 // Quadcopter dimensions
fbob 9:15058b4fa090 21 const float l = 0.033f; // m
fbob 9:15058b4fa090 22 const float m = 0.030f; // kg
fbob 9:15058b4fa090 23 const float I_xx = 16.0e-6f; // kg.m^2
fbob 9:15058b4fa090 24 const float I_yy = 16.0e-6f; // kg.m^2
fbob 9:15058b4fa090 25 const float I_zz = 29.0e-6f; // kg.m^2
fbob 5:b9947e3d20cf 26
fbob 9:15058b4fa090 27 // Gravity constant
fbob 9:15058b4fa090 28 const float g = 9.81f; // m/s^2
fbob 7:220ce3839be8 29
fbob 9:15058b4fa090 30 // Attitude estimator weighthing (accelerometer X gyroscope)
fbob 15:155ca63b7884 31 const float rho_att = 0.01f;
fbob 5:b9947e3d20cf 32
fbob 5:b9947e3d20cf 33 // Attitude controller time constants
fbob 12:9fed6f656f88 34 const float T_phi = 0.16f; // s
fbob 12:9fed6f656f88 35 const float T_theta = 0.16f; // s
fbob 9:15058b4fa090 36 const float T_psi = 0.2f; // s
fbob 9:15058b4fa090 37 const float T_p = 0.04f; // s
fbob 9:15058b4fa090 38 const float T_q = 0.04f; // s
fbob 9:15058b4fa090 39 const float T_r = 0.1f; // s
fbob 5:b9947e3d20cf 40
fbob 9:15058b4fa090 41 // Vertical estimator weighthing (measurement X prediction)
fbob 9:15058b4fa090 42 const float rho_ver = 0.3f;
fbob 7:220ce3839be8 43
fbob 7:220ce3839be8 44 // Vertical controller time constants
fbob 7:220ce3839be8 45 const float zeta = 0.7f;
fbob 9:15058b4fa090 46 const float omega_n = 2.0f; // rad/s
fbob 12:9fed6f656f88 47 const float K_z = pow(omega_n,2.0f);
fbob 12:9fed6f656f88 48 const float K_w = 2.0f*zeta*omega_n;
fbob 16:54d2f299e404 49 const float zeta_take_off = 1.4f;
fbob 16:54d2f299e404 50 const float omega_n_take_off = 2.0f; // rad/s
fbob 16:54d2f299e404 51 const float K_z_take_off = pow(omega_n_take_off,2.0f);
fbob 16:54d2f299e404 52 const float K_w_take_off = 2.0f*zeta_take_off*omega_n_take_off;
fbob 9:15058b4fa090 53
fbob 9:15058b4fa090 54 // Horizontal estimator weighthing (measurement X prediction)
fbob 15:155ca63b7884 55 const float rho_hor = 0.5f;
fbob 8:d05fe9f8bfb6 56
fbob 8:d05fe9f8bfb6 57 // Horizontal controller time constants
fbob 15:155ca63b7884 58 const float T_u = 2.0f; // s
fbob 15:155ca63b7884 59 const float T_v = 2.0f; // s
fbob 16:54d2f299e404 60 const float T_u_take_off = 4.0f; // s
fbob 16:54d2f299e404 61 const float T_v_take_off = 4.0f; // s
fbob 7:220ce3839be8 62
fbob 6:3188b00263e8 63 #endif