So my team is attempting to be able to plug in either a flight stick or a xbox controller to our driver station and have the robot determine which control scheme to use.
We have done this in the past using the Joystick class’s GetName() and GetType() functions. The problem is, no matter how we call them, this year, GetName() always returns an empty string, and GetType() always returns an integer value of 255, even though the only values in the enum range from -1 to 24.
Is anyone else having similar issues, or is it simply our install of WPILib?
Ah. Yes these would not have valid data until a DS connection actually occurs. During a constructor, the DS most likely has not sent a packet, so it has no data to actually receive. Waiting until teleop will definitely work. Note doing the setup in disabled would work as well.
That makes sense. I feel like the default return value shouldn’t be out of scope on the GetType() tho. especially when theres a -1 kUnknown value that would make a whole lot more sense.
Doing this during disabled makes a heck of a lot more sense anyways. I didn’t think of this. Thanks!
I have a few ideas I could do to make this work. Might even be able to make it work in the constructor too. But for your use case disabled works better anyway, since you could reconfigure during testing without a code reboot.