View Single Post
  #2   Spotlight this post!  
Unread 26-01-2013, 11:55
agartner01 agartner01 is offline
Captain + Control Sys & Design
FRC #4174
Team Role: Engineer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Hector MN
Posts: 109
agartner01 is an unknown quantity at this point
Re: Require help programming a Z-Axis on a Logitech joystick

Quote:
Originally Posted by LOHS3868 View Post
Our programming team wants to use the Z-axis on a Logitech joystick as the throttle for our shooter motor. Our problem is that we want the negative portion to be zero and the positive to represent full throttle. Sorry for not being clear - it's hard to convey what I mean over text. If you need any more details, feel free to ask.

Thanks
-3868
What language are you programming in? If the most positive value is 1 and the most negative value is -1, what I've done in the past is added 1 and divided by 2 (to the joystick value). Also, an exception needs to be put in place when is the value is -1 because -1+1=0/.5 results in potentially undefined behavior (at least in c++).

Last edited by agartner01 : 26-01-2013 at 12:31.