Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer
HorizontalController/HorizontalController.cpp@8:d05fe9f8bfb6, 2018-09-27 (annotated)
- Committer:
- fbob
- Date:
- Thu Sep 27 18:55:22 2018 +0000
- Revision:
- 8:d05fe9f8bfb6
- Child:
- 15:155ca63b7884
Included horizontal controller
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fbob | 8:d05fe9f8bfb6 | 1 | #include "mbed.h" |
fbob | 8:d05fe9f8bfb6 | 2 | #include "HorizontalController.h" |
fbob | 8:d05fe9f8bfb6 | 3 | |
fbob | 8:d05fe9f8bfb6 | 4 | // Class constructor |
fbob | 8:d05fe9f8bfb6 | 5 | HorizontalController::HorizontalController() |
fbob | 8:d05fe9f8bfb6 | 6 | { |
fbob | 8:d05fe9f8bfb6 | 7 | } |
fbob | 8:d05fe9f8bfb6 | 8 | |
fbob | 8:d05fe9f8bfb6 | 9 | // |
fbob | 8:d05fe9f8bfb6 | 10 | void HorizontalController::control(float u_r, float v_r, float u, float v) |
fbob | 8:d05fe9f8bfb6 | 11 | { |
fbob | 8:d05fe9f8bfb6 | 12 | theta_r = control_single(u_r,u,T_u)/g; |
fbob | 8:d05fe9f8bfb6 | 13 | phi_r = -control_single(v_r,v,T_v)/g; |
fbob | 8:d05fe9f8bfb6 | 14 | } |
fbob | 8:d05fe9f8bfb6 | 15 | |
fbob | 8:d05fe9f8bfb6 | 16 | // |
fbob | 8:d05fe9f8bfb6 | 17 | float HorizontalController::control_single(float velocity_r, float velocity, float T_velocity) |
fbob | 8:d05fe9f8bfb6 | 18 | { |
fbob | 8:d05fe9f8bfb6 | 19 | return (1.0f/T_velocity)*(velocity_r-velocity); |
fbob | 8:d05fe9f8bfb6 | 20 | } |