Quote:
Originally Posted by Alan Anderson
I don't understand why you suggest that writing a custom class is not the appropriate answer. If you want to support the Attack 3 in particular, I think the best way to do it is to extend the Joystick class as an Attack_3 class.
Since the named functions don't give you what you want, the second-best way to do it is probably to avoid them and instead use things like getRawAxis().
We did basically the custom class solution in LabVIEW for several different brands of game controllers this year. It lets us provide the axes and buttons as named components of a cluster, which helps keep the programmer and the driver speaking the same language. Instead of having to remember which array element's number is the left stick's Y axis, we just unbundle LeftX. Similarly, we can refer to the A, X, Start, etc. buttons by name.
|
I don't enjoy diverging from the well-beaten path, so if there was a way to instantiate a standard joystick class to fit an Attack 3 without making a custom class, I'd be all for it, which is why I asked.
As for the custom class, it doesn't help matters much when the WPILib C++ source code location isn't a heavily advertised thing...I found it...but it doesn't seem to be something that is as readily available as it was in the past.
We read all joystick and gamepad values into more functionally-descriptive variables, and this code is well-commented to provide a cross reference between actual controller axis/button and function, so using "GetZ" or "GetRawAxis" won't be an issue.