Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer
Parameters/Parameters.h@12:9fed6f656f88, 2018-09-28 (annotated)
- Committer:
- fbob
- Date:
- Fri Sep 28 21:45:50 2018 +0000
- Revision:
- 12:9fed6f656f88
- Parent:
- 11:fad579538b4c
- Child:
- 13:1a871ebd35bb
Parameters improvements
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fbob | 5:b9947e3d20cf | 1 | #ifndef Parameters_h |
fbob | 5:b9947e3d20cf | 2 | #define Parameters_h |
fbob | 5:b9947e3d20cf | 3 | |
fbob | 9:15058b4fa090 | 4 | // Attitude and position interrupt frequencies |
fbob | 9:15058b4fa090 | 5 | const float f_att = 200.0f; // Hz |
fbob | 9:15058b4fa090 | 6 | const float f_pos = 20.0f; // Hz |
fbob | 9:15058b4fa090 | 7 | const float dt_att = 1.0f/f_att; // s |
fbob | 11:fad579538b4c | 8 | const float dt_pos = 1.0f/f_pos; // s |
fbob | 9:15058b4fa090 | 9 | |
fbob | 5:b9947e3d20cf | 10 | // Motor constants |
fbob | 5:b9947e3d20cf | 11 | const float alpha = 1.16e-07f; |
fbob | 5:b9947e3d20cf | 12 | const float beta = 7.149e-10f; |
fbob | 5:b9947e3d20cf | 13 | |
fbob | 5:b9947e3d20cf | 14 | // Propeller constants |
fbob | 9:15058b4fa090 | 15 | const float kl = 1.726e-08f; // N.s^2/rad^2 |
fbob | 9:15058b4fa090 | 16 | const float kd = 1.426e-10f; // N.m.s^2/rad^2 |
fbob | 5:b9947e3d20cf | 17 | |
fbob | 5:b9947e3d20cf | 18 | // Quadcopter dimensions |
fbob | 9:15058b4fa090 | 19 | const float l = 0.033f; // m |
fbob | 9:15058b4fa090 | 20 | const float m = 0.030f; // kg |
fbob | 9:15058b4fa090 | 21 | const float I_xx = 16.0e-6f; // kg.m^2 |
fbob | 9:15058b4fa090 | 22 | const float I_yy = 16.0e-6f; // kg.m^2 |
fbob | 9:15058b4fa090 | 23 | const float I_zz = 29.0e-6f; // kg.m^2 |
fbob | 5:b9947e3d20cf | 24 | |
fbob | 9:15058b4fa090 | 25 | // Gravity constant |
fbob | 9:15058b4fa090 | 26 | const float g = 9.81f; // m/s^2 |
fbob | 7:220ce3839be8 | 27 | |
fbob | 9:15058b4fa090 | 28 | // Attitude estimator weighthing (accelerometer X gyroscope) |
fbob | 5:b9947e3d20cf | 29 | const float rho = 0.02f; |
fbob | 5:b9947e3d20cf | 30 | |
fbob | 5:b9947e3d20cf | 31 | // Attitude controller time constants |
fbob | 12:9fed6f656f88 | 32 | const float T_phi = 0.16f; // s |
fbob | 12:9fed6f656f88 | 33 | const float T_theta = 0.16f; // s |
fbob | 9:15058b4fa090 | 34 | const float T_psi = 0.2f; // s |
fbob | 9:15058b4fa090 | 35 | const float T_p = 0.04f; // s |
fbob | 9:15058b4fa090 | 36 | const float T_q = 0.04f; // s |
fbob | 9:15058b4fa090 | 37 | const float T_r = 0.1f; // s |
fbob | 5:b9947e3d20cf | 38 | |
fbob | 9:15058b4fa090 | 39 | // Vertical estimator weighthing (measurement X prediction) |
fbob | 9:15058b4fa090 | 40 | const float rho_ver = 0.3f; |
fbob | 7:220ce3839be8 | 41 | |
fbob | 7:220ce3839be8 | 42 | // Vertical controller time constants |
fbob | 7:220ce3839be8 | 43 | const float zeta = 0.7f; |
fbob | 9:15058b4fa090 | 44 | const float omega_n = 2.0f; // rad/s |
fbob | 12:9fed6f656f88 | 45 | const float K_z = pow(omega_n,2.0f); |
fbob | 12:9fed6f656f88 | 46 | const float K_w = 2.0f*zeta*omega_n; |
fbob | 9:15058b4fa090 | 47 | |
fbob | 9:15058b4fa090 | 48 | // Horizontal estimator weighthing (measurement X prediction) |
fbob | 9:15058b4fa090 | 49 | const float rho_hor = 0.1f; |
fbob | 8:d05fe9f8bfb6 | 50 | |
fbob | 8:d05fe9f8bfb6 | 51 | // Horizontal controller time constants |
fbob | 12:9fed6f656f88 | 52 | const float T_u = 2.0f; // s |
fbob | 12:9fed6f656f88 | 53 | const float T_v = 2.0f; // s |
fbob | 7:220ce3839be8 | 54 | |
fbob | 6:3188b00263e8 | 55 | #endif |