View Single Post
  #5   Spotlight this post!  
Unread 02-23-2015, 01:55 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
There does seem to be a way in the basic Joystick class to remap axes to the X/Y/Z/Throttle functions, but I don't use C++ enough to have tried it.
I don't believe you can re-map the default value of the throttle, which is set to axis 3 (0-based values). You can define the number of axes and buttons, but not which axis is which.

Quote:
What do you need the source code for? All you'd be doing is inheriting from and extending an existing class. You wouldn't be reimplementing any of the lower-level code.
Last I "wrote" a custom class, I took gyro.cpp/.h source, renamed the files gyro48.cpp/.h, and changed the code to permit adjustment of the sensitivity parameter, which was previously not exposed to the end user. Seemed easier and more likely to work to adapt existing code than figure out all the BS of inheritance and writing my own classes and worrying about missing some inane piece of required syntax that would break the code or worse, compile it and cause unintended results I am not equipped to debug. If this somehow violates some code of appropriateness seasoned programmers adhere to, well, I'm not a seasoned programmer, nor do I aspire to be, so I guess it doesn't matter.

In the case of the joystick class, I'd simply change the default throttle axis from 3 to 2. Bing bang zoom. But with GetZ or GetRawAxis in the default class, I don't need to do that, so I won't even bother.
__________________

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

Last edited by Travis Hoffman : 02-23-2015 at 01:57 PM.
Reply With Quote