Robotpy PC Controller Joysticks


Hi - having trouble with a PC controller reading the second joystick. Looking at the Simulator it shows left Joystick on X and Y axes of Stick 0, but Joystick 2 is showing up also as Stick 0 but as Z and T axes. As such getX() and getY() only returns the left axis movement. There is no getT() function, and functions like getRawAxis seems to be deprecated.

Any ideas on how to read the Z and T axis from joystick 0 ?


What platform? Windows, OSX, Linux? We use pygame for reading from the joystick, but currently we just take whatever default configuration it gives us.

It seems like it would be straightforward for someone to provide a way to remap axes. pyfrc doesn’t currently do that, but it could be something we add to the sim config json. The code is at

Filed an issue at so we don’t lose track of it.


Yes - am using windows and pygame. Both joysticks respond on stick 0 output. I did manage to use stick.getAxis(1) and stick.getAxis(4) to retrieve the values late last night. Not sure if this is the most elegant/correct approach, but it is essentially remapping the left and right joysticks. I guess if it works, use use it right? Thanks for the help.


Another approach you can use is something like

if wpilib.RobotBase.isSimulation():
   # retrieve values for sim
   # retrieve values for real robot


Oh - so it may behave differently when running on the robot? We have not uploaded code yet, so if that is an issue this a great suggestion. Thanks


Yeah, pygame’s joystick mappings will almost certainly not match what the driverstation will provide.