Hi all,
I am using Logitech joystick.
I am confused. I bound all the joystick buttons in configureBindings function. But I couldn’t figure out how to bind LT, RT and analog buttons to a command.
I can get these data with getRawAxis but I am stuck there.
How can I handle this issue?
You can use a CommandGenericHID object to bind an axis to a command.
CommandGenericHID controller = new CommandGenericHID(port)
controller.axisGreaterThan(axis, deadzone).onTrue(new Command())
If you want to get boolean values of the buttons from this class, you can get the GenericHID controller by doing
controller.getHID() //returns a GenericHID controller
controller.getHID().getRawAxis(axis) //allows you to read raw values of axis
Apart from autonomous commands, which are scheduled at the start of the autonomous period, and default commands, which are automatically scheduled whenever their subsystem is not currently in-use, ...
We are using xbox controllers but the idea is the same.
CommandXboxController m_driverController = new CommandXboxController(0);
m_driverController.rightTrigger().onTrue(new ConeInCommand()))
You should be able to do something like:
CommandPS4Controller m_driverController = new CommandPS4Controller(0);
m_driverController.R2().onTrue(new ConeInCommand()))
See the javadoc for other buttons you can bind to:
Here is our code using xbox controllers. Referring to this may help with where to put the above lines of code:
1 Like
system
Closed
March 5, 2024, 3:06pm
5
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.