Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:ad080363a22c
- Parent:
- 1:bf71a7bd2d3e
- Child:
- 3:dd0c62b586ea
diff -r bf71a7bd2d3e -r ad080363a22c main.cpp
--- a/main.cpp Fri Mar 06 17:12:47 2015 +0000
+++ b/main.cpp Mon Apr 06 16:25:18 2015 +0000
@@ -44,7 +44,7 @@
float kp = 800; // Proportional gain
float kd = 90; // Derivative gain
float ki = 4; // Integrative gain
-float OVERALL_SCALAR = 7000; // Overall scalar that speed is divided by
+float OVERALL_SCALAR = 7000; // Overall scalar that speed is divided by
float accBias = 0; // Accelerometer Bias
float gyroBias = 0; // Gyro Bias
float accAngle = 0; // Global to hold angle measured by Accelerometer
@@ -94,7 +94,7 @@
dAngle = -(imu.gx-gyroBias); // This is angular velocity
iAngle=(0.99*iAngle+0.01*gyroAngle); // Sorta- running average-integral thing
if(abs(pAngle)>=0.6&&abs(pAngle)<=25) { // If it is tilted enough, but not too much
- speed=-(ki*iAngle+kd*dAngle+kp*pAngle)/OVERALL_SCALAR; // drive to correct
+ speed=-(ki*iAngle+kd*dAngle+kp*pAngle)/OVERALL_SCALAR; // drive to correct
if(speed<-1) speed=-1; // Cap if undershoot
else if(speed>1) speed=1; // Cap if overshoot
} else speed=0; // If we've fallen over or are steady on top