Gamepad recognized by DriverStation but not by robot code.

My team is using an Xbox controller (although we have also tested with a Logitech controller and with a Logitech joystick to no avail) to control our robot this year and while the DriverStation displays the controller correctly and shows the position of the axes, the robot itself does not seem to recognize any input from the controller.

I have verified this by printing off the position of each controller axis to the console. When I run the code on the wpi simulation, the positions are displayed correctly. When I run the code on the robot, the positions are always reported as 0.

The DriverStation prints this message off when I enable the robot:

Warning 44003 FRC: No robot code is currently running. Driver Station
19:10:04:635 WARNING : wpilib.ds : Joystick Button 1 on port 0 not available, check if controller is plugged in
Warning 1 Joystick Button 1 on port 0 not available, check if controller is plugged in

As far as I can tell, there is, in fact, robot code running as it prints off 0’s to the console as per my code.

Some notes:
I am running python on the robot with robotpy. My code can be found here.

Any help is appreciated, thanks!

Check on the driverstation, maybe your Joystick does not have 0 as port number

All the buttons/axes work on the joystick/gamepad when I run the code in the simulation so I don’t think that’s the problem in this case. However, I won’t be able to verify this for sure until I can test the code on the robot on Thursday, unfortunately. I’ll update then if I haven’t already updated with a solution before then.

Thanks!

In the future, when posting python-related questions, use the Python subforum of the Programming forum (as that’s the only forum I monitor), chat at us on gitter, or file a bug on github.

Looks like you already did the latter two. :slight_smile:

I posted it here because I wasn’t sure the gamepad issue was related to robotpy but, like you said, I went ahead and mentioned it on github/gitter too. I’ll be sure to try out the patch on Thursday!

Thanks for everything you do! Python + FRC is a dream come true for me :slight_smile: