changes to motor library

Dependents:   pid-car-example

Fork of motor by Lawrence Harlow

Revision:
4:e15ec9052a78
Parent:
3:5b5d5af46804
Child:
5:c50e40797114
diff -r 5b5d5af46804 -r e15ec9052a78 motor.cpp
--- a/motor.cpp	Fri Oct 21 13:41:03 2016 +0000
+++ b/motor.cpp	Fri Oct 21 13:44:19 2016 +0000
@@ -143,9 +143,9 @@
             cornerLeft(pwmRatio);
         }
         
-        else()//turn right
+        else//turn right
         {
-               cornerRight(pwmRatio)
+               cornerRight(pwmRatio);
         }
      return;   
     }
@@ -158,8 +158,9 @@
     // may just replace with ACC and DECC
     
     // it may be worth doing this off the change in theta. so that it is insesnsitive to the calibration.
-    w1 = speed + diff;
-    w2 = speed-diff;
+    float diff = speed*cornerPwmControl;
+    float w1 = speed + diff;
+    float w2 = speed-diff;
     TFC_SetMotorPWM(w2,w1); //temperary values
         
     
@@ -175,8 +176,8 @@
     {   // may need to put deceleration control within here.
         // may just replace with ACC and DECC
         float diff = speed*cornerPwmControl;
-        w1 = speed + diff;
-        w2 = speed-diff;
+        float w1 = speed + diff;
+        float w2 = speed-diff;
         TFC_SetMotorPWM(w1,w2); //temperary values
         
      return;   
@@ -190,10 +191,10 @@
     float d;
     float l;
     // it may be worth doing this off the change in theta. so that it is insesnsitive to the calibration.
-    diff= ((d*tan(deltatheta)/(2*l)));
+    float diff= ((d*tan(deltaTheta)/(2*l)));
     
-    w1 = (speed/r)*(1+diff);
-    w2 = (speed/r)*(1-diff);
+    float w1 = (speed/r)*(1+diff);
+    float w2 = (speed/r)*(1-diff);
     
     // when there is a speed sensor tghe conversion will be much more simplistic. this is basically just guessing.
     // need to convert w1 to the duty cycle