changes to motor library

Dependents:   pid-car-example

Fork of motor by Lawrence Harlow

Revision:
3:5b5d5af46804
Parent:
2:cc8ddc587af7
Child:
4:e15ec9052a78
--- a/motor.cpp	Fri Oct 21 13:18:12 2016 +0000
+++ b/motor.cpp	Fri Oct 21 13:41:03 2016 +0000
@@ -186,18 +186,20 @@
 void deltaCornerLeft(float speed,float deltaTheta)
     {// when cornering left the left motor slows down more than the right hand side
     // may just replace with ACC and DECC
-    
+    float r;
+    float d;
+    float l;
     // 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;
+    diff= ((d*tan(deltatheta)/(2*l)));
+    
+    w1 = (speed/r)*(1+diff);
+    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
     TFC_SetMotorPWM(w2,w1); //temperary values
         
-    
-    
-    
         
-     
-     
      return;   
     }