How to configure LT RT buttons in commandbase

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 

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