changes to motor library

Dependents:   pid-car-example

Fork of motor by Lawrence Harlow

Revision:
5:c50e40797114
Parent:
4:e15ec9052a78
Child:
7:9aaa4f73bb32
Child:
17:28216063e33e
--- a/motor.cpp	Fri Oct 21 13:44:19 2016 +0000
+++ b/motor.cpp	Mon Oct 24 14:12:43 2016 +0000
@@ -204,5 +204,24 @@
      return;   
     }
     
+void deltaCornerRight(float speed,float deltaTheta)
+    {// when cornering right the inner 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.
+    float diff= ((d*tan(deltaTheta)/(2*l)));
+    
+    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
+    TFC_SetMotorPWM(w2,w1); //temperary values
+        
+        
+     return;   
+    }