public class TankControlLayout extends java.lang.Object implements ControlLayout
TankControlLayout
is a ControlLayout
that represents a tank-like
control system. In a tank control system, the y-axis of the left thumbstick is used
to control the forward/backward power of the left side of the robot, and the right
thumbstick is used to control the forward/backward power of the right side of the
robot.
Since the movement methods of DriveSystem
accept only a single forward vector and a single clockwise vector, some
math is required to convert the relevant joystick inputs to a form that can be used by
the drive system. The forward power is calculated as the average of the two y-values,
and the clockwise power is calculated as the difference between the y-values of the two
thumbsticks.
Constructor and Description |
---|
TankControlLayout() |
Modifier and Type | Method and Description |
---|---|
double |
getClockwisePower(Joystick joy)
Gets the clockwise power that should be sent to the robot based on the current
state of the given joystick.
|
double |
getForwardPower(Joystick joy)
Gets the forward power that should be sent to the robot based on the current
state of the given joystick.
|
public double getForwardPower(Joystick joy)
ControlLayout
getForwardPower
in interface ControlLayout
joy
- the joystick to use for power calculations.public double getClockwisePower(Joystick joy)
ControlLayout
getClockwisePower
in interface ControlLayout
joy
- the joystick to use for power calculations.