Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer
Parameters/Parameters.h@13:1a871ebd35bb, 2018-10-03 (annotated)
- Committer:
- fbob
- Date:
- Wed Oct 03 17:50:16 2018 +0000
- Revision:
- 13:1a871ebd35bb
- Parent:
- 12:9fed6f656f88
- Child:
- 14:7439203a9e44
dt
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 | 13:1a871ebd35bb | 4 | // Interrupt frequencies |
fbob | 13:1a871ebd35bb | 5 | const float f = 200.0f; // Hz |
fbob | 13:1a871ebd35bb | 6 | const float f_range = 20.0f; // Hz |
fbob | 13:1a871ebd35bb | 7 | const float f_flow = 50.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 | 5:b9947e3d20cf | 31 | const float rho = 0.02f; |
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 | 9:15058b4fa090 | 49 | |
fbob | 9:15058b4fa090 | 50 | // Horizontal estimator weighthing (measurement X prediction) |
fbob | 9:15058b4fa090 | 51 | const float rho_hor = 0.1f; |
fbob | 8:d05fe9f8bfb6 | 52 | |
fbob | 8:d05fe9f8bfb6 | 53 | // Horizontal controller time constants |
fbob | 12:9fed6f656f88 | 54 | const float T_u = 2.0f; // s |
fbob | 12:9fed6f656f88 | 55 | const float T_v = 2.0f; // s |
fbob | 7:220ce3839be8 | 56 | |
fbob | 6:3188b00263e8 | 57 | #endif |