Implementation¶
Usage¶
Battleaid offers TunedJoystick
to make using deadzones and response curves intuitive with minimal performance overhead.
1// create a controller like normal
2CommandXboxController controller = new CommandXboxController(0);
3
4// then use the same controller handle
5TunedJoystick tunedJoystick = new TunedJoystick(controller.getHID())
6 .useResponseCurve(ResponseCurve.SOFT)
7 .setDeadzone(0.1d);
Then, you can use the object to retrieve the joystick values:
8// these values are tuned
9tunedJoystick.getRightX();
10tunedJoystick.getRightY();
11tunedJoystick.getLeftX();
12tunedJoystick.getLeftY();
Notes¶
I.¶
TunedJoystick
was created with the intention to be used for drivetrain joysticks, so the only ResponseCurves
are exponential.
|
II.¶
The user can optionally change how often the values of the joystick are computed. For example:
1tunedJoystick.setPeriodMilliseconds(15);
The default CommandScheduler
loop is 20ms
. Setting the period longer will feel laggy but quicker periods might use more resources.