GDP 4 / Mbed 2 deprecated pid-car-example

Dependencies:   FRDM-TFC mbed CBuffer XBEE mbed_angular_speed motor2 MMA8451Q

Fork of KL25Z_Camera_Test by GDP 4

Files at this revision

API Documentation at this revision

Comitter:
lh14g13
Date:
Thu Apr 27 15:51:01 2017 +0000
Parent:
49:0d4ad8dc265b
Child:
51:6a84fbc404c8
Commit message:
added ability to change to torque based system

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
motor2.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Apr 27 12:10:40 2017 +0000
+++ b/main.cpp	Thu Apr 27 15:51:01 2017 +0000
@@ -160,17 +160,32 @@
             switch(choice) {
                  case 0:
                      initPID(&servo_pid, 2.2f, 0.6f, 0.f);
+                     if(!torque){
                      speed = 40;
+                     }
+                     else{
+                        speed = 0.4;
+                     }
                      ed_tune = man_tuner;
                     break;
                 case 1:
                      initPID(&servo_pid, 2.2f, 0.6f, 0.f);
+                     if(!torque){
                      speed = 65;
+                     }
+                     else{
+                        speed = 0.6
+                     }
                      ed_tune = man_tuner;
                     break;
                 case 2:
                      initPID(&servo_pid, 2.2f, 0.6f, 0.f);
+                     if(!torque){
                      speed = 80;
+                     }
+                     else{
+                        speed= 0.8
+                     }
                      ed_tune = man_tuner;
                     break;
                 case 3:
--- a/main.h	Thu Apr 27 12:10:40 2017 +0000
+++ b/main.h	Thu Apr 27 15:51:01 2017 +0000
@@ -128,7 +128,7 @@
 
 float oldTime;
 int lapNo;
-
+bool torque = 1;
 //Accelerometer:
 float checkAcc();
 float accTheshold=0.4;
--- a/motor2.lib	Thu Apr 27 12:10:40 2017 +0000
+++ b/motor2.lib	Thu Apr 27 15:51:01 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/GDP-4/code/motor2/#b46efc310b83
+http://developer.mbed.org/teams/GDP-4/code/motor2/#fec835dfd43a