Understanding MDTankDrive - MDHSRobotics/TeamWiki GitHub Wiki

Home / References

#Understanding MDTankDrive

MDTankDrive is a custom tank drive implementation that was implemented in the 2015 ToteBot. It provided better handling and tuning cabability than the out of the box Tank Drive implementation provided in the WPILib.

The implementation is based on the Tunable Linear Interpolated Drive Chief Delphi post

/*

Arcade algorithm to compute left and right wheel commands from forward and rotate-clockwise joystick commands.

"fwd" is the Forward command (-1 to +1); "rcw" is the Rotate Clockwise command (-1 to +1); "a" and "b" are tuning parameters: a is the amount to turn at 100% fwd in the range 0 to 1; b is the amount to turn at 0% fwd in the range 0 to 1; when a=0 and b=1 this gives you the WPILib arcade behavior; */

function L(fwd,rcw,a,b: float): float; begin L := fwd + brcw(1-fwd); end;

function R(fwd,rcw,a,b: float): float; begin R := fwd - brcw + fwdrcw*(b-a-1); end;

procedure LR(fwd,rcw,a,b: float; var left,right: float); begin if fwd>=0 then begin if rcw>=0 then begin {Q1} left := L(fwd,rcw,a,b); right := R(fwd,rcw,a,b); end else begin {Q2} left := R(fwd,-rcw,a,b); right := L(fwd,-rcw,a,b); end end else begin if rcw>=0 then begin {Q4} left := -R(-fwd,rcw,a,b); right := -L(-fwd,rcw,a,b); end else begin {Q3} left := -L(-fwd,-rcw,a,b); right := -R(-fwd,-rcw,a,b); end end; end;


###Target Countours
![Countour map for a=0.5, b=0.5](https://github.com/MDHSRobotics/TeamWiki/raw/master/reference/arcade%20contour%20map%20a%3D0.5%20b%3D0.5.png)
![Countour map for a=0.25, b=0.4](https://github.com/MDHSRobotics/TeamWiki/raw/master/reference/arcade%20contour%20map%20a%3D0.25%20b%3D0.40.png)

###Calculated Countours

##### countour a=, b=1

| -1.0 | -0.75 | -0.5 | -0.25 | 0.0 | 0.25 | 0.5 | 0.75 | 1.0
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
__1.0__ | (0.00,1.00) | (0.25,1.00) | (0.50,1.00) | (0.75,1.00) | (1.00,1.00) | (1.00,0.75) | (1.00,0.50) | (1.00,0.25) | (1.00,0.00)
__0.75__ | (-0.25,1.00) | (0.00,0.94) | (0.25,0.88) | (0.50,0.81) | (0.75,0.75) | (0.81,0.50) | (0.88,0.25) | (0.94,0.00) | (1.00,-0.25)
__0.5__ | (-0.50,1.00) | (-0.25,0.88) | (0.00,0.75) | (0.25,0.63) | (0.50,0.50) | (0.63,0.25) | (0.75,0.00) | (0.88,-0.25) | (1.00,-0.50)
__0.25__ | (-0.75,1.00) | (-0.50,0.81) | (-0.25,0.63) | (0.00,0.44) | (0.25,0.25) | (0.44,0.00) | (0.63,-0.25) | (0.81,-0.50) | (1.00,-0.75)
__0.0__ | (-1.00,1.00) | (-0.75,0.75) | (-0.50,0.50) | (-0.25,0.25) | (0.00,0.00) | (0.25,-0.25) | (0.50,-0.50) | (0.75,-0.75) | (1.00,-1.00)
__-0.25__ | (-1.00,0.75) | (-0.81,0.50) | (-0.63,0.25) | (-0.44,-0.00) | (-0.25,-0.25) | (-0.00,-0.44) | (0.25,-0.63) | (0.50,-0.81) | (0.75,-1.00)
__-0.5__ | (-1.00,0.50) | (-0.88,0.25) | (-0.75,-0.00) | (-0.63,-0.25) | (-0.50,-0.50) | (-0.25,-0.63) | (-0.00,-0.75) | (0.25,-0.88) | (0.50,-1.00)
__-0.75__ | (-1.00,0.25) | (-0.94,-0.00) | (-0.88,-0.25) | (-0.81,-0.50) | (-0.75,-0.75) | (-0.50,-0.81) | (-0.25,-0.88) | (-0.00,-0.94) | (0.25,-1.00)
__-1.0__ | (-1.00,-0.00) | (-1.00,-0.25) | (-1.00,-0.50) | (-1.00,-0.75) | (-1.00,-1.00) | (-0.75,-1.00) | (-0.50,-1.00) | (-0.25,-1.00) | (-0.00,-1.00)

##### countour a=0.5, b=0.5

| -1.0 | -0.75 | -0.5 | -0.25 | 0.0 | 0.25 | 0.5 | 0.75 | 1.0
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
__1.0__ | (-0.50,1.00) | (-0.13,1.00) | (0.25,1.00) | (0.63,1.00) | (1.00,1.00) | (1.00,0.63) | (1.00,0.25) | (1.00,-0.13) | (1.00,-0.50)
__0.75__ | (-0.50,0.88) | (-0.19,0.84) | (0.13,0.81) | (0.44,0.78) | (0.75,0.75) | (0.78,0.44) | (0.81,0.13) | (0.84,-0.19) | (0.88,-0.50)
__0.5__ | (-0.50,0.75) | (-0.25,0.69) | (0.00,0.63) | (0.25,0.56) | (0.50,0.50) | (0.56,0.25) | (0.63,0.00) | (0.69,-0.25) | (0.75,-0.50)
__0.25__ | (-0.50,0.63) | (-0.31,0.53) | (-0.13,0.44) | (0.06,0.34) | (0.25,0.25) | (0.34,0.06) | (0.44,-0.13) | (0.53,-0.31) | (0.63,-0.50)
__0.0__ | (-0.50,0.50) | (-0.38,0.38) | (-0.25,0.25) | (-0.13,0.13) | (0.00,0.00) | (0.13,-0.13) | (0.25,-0.25) | (0.38,-0.38) | (0.50,-0.50)
__-0.25__ | (-0.63,0.50) | (-0.53,0.31) | (-0.44,0.13) | (-0.34,-0.06) | (-0.25,-0.25) | (-0.06,-0.34) | (0.13,-0.44) | (0.31,-0.53) | (0.50,-0.63)
__-0.5__ | (-0.75,0.50) | (-0.69,0.25) | (-0.63,-0.00) | (-0.56,-0.25) | (-0.50,-0.50) | (-0.25,-0.56) | (-0.00,-0.63) | (0.25,-0.69) | (0.50,-0.75)
__-0.75__ | (-0.88,0.50) | (-0.84,0.19) | (-0.81,-0.13) | (-0.78,-0.44) | (-0.75,-0.75) | (-0.44,-0.78) | (-0.13,-0.81) | (0.19,-0.84) | (0.50,-0.88)
__-1.0__ | (-1.00,0.50) | (-1.00,0.13) | (-1.00,-0.25) | (-1.00,-0.63) | (-1.00,-1.00) | (-0.63,-1.00) | (-0.25,-1.00) | (0.13,-1.00) | (0.50,-1.00)

##### countour a=0.25, b=0.4

| -1.0 | -0.75 | -0.5 | -0.25 | 0.0 | 0.25 | 0.5 | 0.75 | 1.0
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
__1.0__ | (-0.25,1.00) | (0.06,1.00) | (0.38,1.00) | (0.69,1.00) | (1.00,1.00) | (1.00,0.69) | (1.00,0.38) | (1.00,0.06) | (1.00,-0.25)
__0.75__ | (-0.29,0.85) | (-0.03,0.83) | (0.23,0.80) | (0.49,0.78) | (0.75,0.75) | (0.78,0.49) | (0.80,0.23) | (0.83,-0.03) | (0.85,-0.29)
__0.5__ | (-0.33,0.70) | (-0.12,0.65) | (0.09,0.60) | (0.29,0.55) | (0.50,0.50) | (0.55,0.29) | (0.60,0.09) | (0.65,-0.12) | (0.70,-0.33)
__0.25__ | (-0.36,0.55) | (-0.21,0.48) | (-0.06,0.40) | (0.10,0.33) | (0.25,0.25) | (0.33,0.10) | (0.40,-0.06) | (0.48,-0.21) | (0.55,-0.36)
__0.0__ | (-0.40,0.40) | (-0.30,0.30) | (-0.20,0.20) | (-0.10,0.10) | (0.00,0.00) | (0.10,-0.10) | (0.20,-0.20) | (0.30,-0.30) | (0.40,-0.40)
__-0.25__ | (-0.55,0.36) | (-0.48,0.21) | (-0.40,0.06) | (-0.33,-0.10) | (-0.25,-0.25) | (-0.10,-0.33) | (0.06,-0.40) | (0.21,-0.48) | (0.36,-0.55)
__-0.5__ | (-0.70,0.33) | (-0.65,0.12) | (-0.60,-0.09) | (-0.55,-0.29) | (-0.50,-0.50) | (-0.29,-0.55) | (-0.09,-0.60) | (0.12,-0.65) | (0.33,-0.70)
__-0.75__ | (-0.85,0.29) | (-0.83,0.03) | (-0.80,-0.23) | (-0.78,-0.49) | (-0.75,-0.75) | (-0.49,-0.78) | (-0.23,-0.80) | (0.03,-0.83) | (0.29,-0.85)
__-1.0__ | (-1.00,0.25) | (-1.00,-0.06) | (-1.00,-0.38) | (-1.00,-0.69) | (-1.00,-1.00) | (-0.69,-1.00) | (-0.38,-1.00) | (-0.06,-1.00) | (0.25,-1.00)