changes to motor library

Dependents:   pid-car-example

Fork of motor by Lawrence Harlow

Branch:
motorupdate
Revision:
38:4bb39bb1e685
Parent:
36:8b6c896e1ab5
Child:
39:772ff68123cc
--- a/motor.cpp	Fri Jan 13 10:11:30 2017 +0000
+++ b/motor.cpp	Sat Jan 28 15:50:41 2017 +0000
@@ -167,7 +167,8 @@
     //there are two equations for testing purposes
     if(true){
     // calculates the difference in the speed
-    float deltaW = ((0.1f*tan((theta/0.02222f)* (3.14f / 180.0f)))/0.2f)*speed;
+    float angle= tan((theta/0.02222f)* (3.14f / 180.0f));
+    float deltaW = (0.1f/(2*0.2f*angle))*speed;
     // 
     if(leftOrRight){
           w1= speed+ deltaW * tune;
@@ -185,9 +186,9 @@
     else{
         //calulates the speed in eack wheel
         //speed of inner wheel
-        float vin = speed*(2 - 0.1/tan((theta/0.022222)*(3.14f / 180.0f)));
+        float vin = speed*(1 - 0.1/tan((theta/0.022222)*(3.14f / 180.0f)));
         //speed of outer wheel.
-        float vout = speed*(2 + 0.1/tan((theta/0.022222)*(3.14f / 180.0f)));
+        float vout = speed*(1 + 0.1/tan((theta/0.022222)*(3.14f / 180.0f)));
         if(leftOrRight){
           
           w1=vout;