changes to motor library
Fork of motor by
Diff: motor.cpp
- Branch:
- motorupdate
- Revision:
- 33:734ce4c36c3f
- Parent:
- 31:51783b84a859
- Child:
- 35:f5933039b560
--- a/motor.cpp Thu Jan 12 13:29:08 2017 +0000 +++ b/motor.cpp Fri Jan 13 09:59:51 2017 +0000 @@ -136,12 +136,12 @@ } -void sensorCorner(float &w1,float &w2,float theta,float speed) +void sensorCorner(float &w1,float &w2,float theta,float speed, float tune) { // when cornering left the left motor slows down more than the right hand side // this is the ED for when the car is running off of the sensors rather than a set PWM bool leftOrRight = false; - float tune = 0.8; + // makes theta positive and sets if the car is turning left or right if(theta<0) { @@ -151,9 +151,9 @@ } //this limits the ED to stop it spinning out at high speeds. - if(theta>0.5) + if(theta>0.4) { - theta = 0.5; + theta = 0.4; } @@ -180,12 +180,15 @@ } else{ - //calulates the speed in eack wheel. + //calulates the speed in eack wheel + //speed of inner wheel float vin = speed*(2 - 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))); if(leftOrRight){ w1=vout; + w2=vin; }