Command to Button

I’ve tried kX.whilePressed and a few things that pop up when googling it

1 Like

That’s exactly what I mentioned above that I tried

What exactly did you try? You likely made a mistake somewhere, because the library is known to work.

This is what I have

That’s really not enough to do any debugging. Put your code on github, and insert some print statements during your next run to try to figure out what’s actually happening.

2 Likes

I think it was the Button.kX.Value I replaced it with the button number and the simulation works

The issue was probably that you seem to be using a playstation controller, but using the Xbox controller bindings (playstation does not have a Y button). If you want to use premade constants you can import the PlaystationController.Button class vs the XboxController.Button class

It’s a odd controller that’s mapped like a Xbox in the shape of a ps it’s the one I see a lot of teams using

We use F310 gamepads, here’s our RobotContainer showing the controller instantiation and the actual commands being bound.

Buttons are all instantiated in the RobotContainer constructor.

Commands are all bound in the configureButtonBindings() method.

Hopefully that helps you get things squared away.

We keep this comment in our code every year, that shows us what the exact mapping is for that controller:

/*
 * ON LOGITECH F310 CONTROLLER:
 * X = 1            (Blue)
 * A = 2            (Green)
 * B = 3            (Red)
 * Y = 4            (Yellow)
 * LB = 5           (Left-Bumper: top button)
 * RB = 6           (Right-Bumper: top button)
 * LT = 7           (Left-Trigger: bottom button)
 * RT = 8           (Right-Trigger: bottom button)
 * Select/Back = 9  (Above left joystick)
 * Start = 10       (Above right joytsick)
 * L3 = 11          (Press left joystick)
 * R3 = 12          (Press right joystick)
 * 
 * Left Joystick Vertical Axis = 1
 * Left Joystick Horizontal Axis = 0
 * Right Joystick Vertical Axis = 3
 * Right Joystick Horizontal Axis = 2
 */

Note - there’s a switch on the back of these things which changes the mapping. I forget which one we stick to, but if these aren’t aligning with what you expect, just flip the button mapping switch.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.