View Single Post
  #3   Spotlight this post!  
Unread 02-23-2015, 01:03 PM
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,044
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: Properly calling a Logitech Attack 3 Joystick Class

Quote:
Originally Posted by Alan Anderson View Post
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.
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner
Reply With Quote