changes to motor library

Dependents:   pid-car-example

Fork of motor by Lawrence Harlow

Branch:
motorupdate
Revision:
28:9d4042b05640
Parent:
27:98aecf1889ed
Child:
29:d3efef939c18
--- a/motor.cpp	Wed Jan 11 11:17:25 2017 +0000
+++ b/motor.cpp	Wed Jan 11 19:29:01 2017 +0000
@@ -111,6 +111,7 @@
 void dutyCycleCorner( float speed, float theta)
 {
         bool leftOrRight;
+        // sets if the car is going left or right
         if(theta<0)
         {
             leftOrRight=true;
@@ -121,6 +122,7 @@
         float deltaW = ((0.1f*tan((theta/0.02222f)* (3.14f / 180.0f)))/0.2f)*speed;
         
         //TFC_SetMotorPWM(w2,w1);
+        // this sets the speeds of each motor (outer wheel goes faster than inner wheel)
         if(leftOrRight){
         TFC_SetMotorPWM(speed+ deltaW,speed- deltaW);
         }
@@ -140,6 +142,7 @@
    
     bool leftOrRight = false;
     float tune = 1.2;
+    // makes theta positive and sets if the car is turning left or right
     if(theta<0)
         {
             leftOrRight=true;
@@ -159,7 +162,9 @@
     //These equations set the angular speeds of the motors 
     //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;
+    // 
     if(leftOrRight){
           w1= speed+ deltaW * tune;
           w2= speed -deltaW * tune;
@@ -174,6 +179,7 @@
     }
     
     else{
+        //calulates the speed in eack wheel.
         float vin = speed(2 - 0.1/tan((theta/0.022222)*(3.14f / 180.0f));
         float vout = speed(2 + 0.1/tan((theta/0.022222)*(3.14f / 180.0f));
         if(leftOrRight){