a controller for a furuta pendulum
Dependencies: QEI mbed-rtos mbed
Revision 11:7e19e51b325d, committed 2013-12-04
- Comitter:
- jaoramos
- Date:
- Wed Dec 04 04:19:30 2013 +0000
- Parent:
- 10:d14c702c1992
- Child:
- 12:d09b8ffa176f
- Commit message:
- Swinp-up OK, LQR improved OK, transition not working;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Dec 04 04:11:41 2013 +0000
+++ b/main.cpp Wed Dec 04 04:19:30 2013 +0000
@@ -43,7 +43,8 @@
//Controller gains - Full-state Feedback
//float k1 = -0.0316, k2 = 9.7076, k3 = -0.4095, k4 = 1.2340, k5 = 0.0410;
-float k1 = -0.3162, k2 = 18.278, k3 = -0.8964, k4 = 2.4441, k5 = 0.1843;
+//float k1 = -0.3162, k2 = 18.278, k3 = -0.8964, k4 = 2.4441, k5 = 0.1843;
+float k1 = -0.1000 , k2 = 12.0293, k3 = -0.5357, k4 = 1.5522, k5 = 0.1684;
float encoder_conv = 2*OUR_PI/(float(ENCODER_PPR)*float(ENC_QUADRATURE_TYPE));
float motor_conv = 2*OUR_PI/(float(MOTOR_PPR)*float(MOT_QUADRATURE_TYPE));
@@ -176,7 +177,8 @@
if (cos(theta2) < 0.96) {
flag = 1;
currentEnergy = calcEnergy();
- inputVoltage = -2.3*dtheta2*(0.0372 - currentEnergy);
+ inputVoltage = -2.3*dtheta2*(0.0372 - currentEnergy);
+ inputVoltage = 0.0;
} else {
flag = 1;