New Robotics Code

Dependencies:   mbed-rtos mbed

Fork of Project by Thomas Elliott

Welcome to the robot wiki.

Files at this revision

API Documentation at this revision

Comitter:
IanTheMBEDMaster
Date:
Fri Apr 05 17:41:23 2013 +0000
Parent:
19:b9c4952f4acc
Child:
21:c5713aafdc9d
Commit message:
a few more changes

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Apr 05 17:37:35 2013 +0000
+++ b/main.cpp	Fri Apr 05 17:41:23 2013 +0000
@@ -586,16 +586,17 @@
     float T;
     float d;
     float onTime;
+    float maxMotorSpeed = 0.5;
     
     // bound the input
-    if (u > 1)
+    if (u > maxMotorSpeed)
     {
-        u = 1;
+        u = maxMotorSpeed;
     }
                 
-    if (u < -1)
+    if (u < -maxMotorSpeed)
     {
-        u = -1;
+        u = -maxMotorSpeed;
     }
     
     // calculate duty cycle timing
@@ -620,16 +621,17 @@
     float T;
     float d;
     float onTime;
+    float maxMotorSpeed = 0.5;
     
     // bound the input
-    if (u > 1)
+    if (u > maxMotorSpeed)
     {
-        u = 1;
+        u = maxMotorSpeed;
     }
                 
-    if (u < -1)
+    if (u < -maxMotorSpeed)
     {
-        u = -1;
+        u = -maxMotorSpeed;
     }
     
     // calculate duty cycle timing