Package com.crossbotics.ftchelper.drive
Class DifferentialMixer
java.lang.Object
com.crossbotics.ftchelper.drive.DifferentialMixer
The math that turns stick values into left and right powers for a standard (tank) drive.
No hardware here, so it is easy to test.
TankDrive uses it.
Signs: forward + = forward, turnClockwise + = turn right. Same as MecanumMixer.
All the sign rules: docs/conventions.md.
Docs: docs/modules/drive.md. Tutorial 05 drives a standard robot with it.
-
Field Summary
Fields -
Method Summary
-
Field Details
-
LEFT
public static final int LEFTIndex of each side in the arrays this class returns.- See Also:
-
RIGHT
public static final int RIGHTIndex of each side in the arrays this class returns.- See Also:
-
-
Method Details
-
arcade
public static double[] arcade(double forward, double turnClockwise, double limit) "Arcade" drive: one stick for forward, one for turning.If a side would get more than
limit, both sides are scaled down together, so the robot still follows the same curve.- Parameters:
forward- -1 to 1turnClockwise- -1 to 1limit- the largest power a side may get, 0 to 1- Returns:
- {left, right}. Both zero if an input is NaN or infinite.
-
tank
public static double[] tank(double left, double right, double limit) "Tank" style: one stick for each side.- Parameters:
left- -1 to 1right- -1 to 1limit- the largest power a side may get, 0 to 1- Returns:
- {left, right}, each multiplied by the limit (values past 1 are cut to 1 first)
-