Go to Post I'm so conflicted right now. On one hand, you made the same page as a celebrity. On the other hand.... Justin Bieber. - Akash Rastogi [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-01-2013, 11:24
LOHS3868 LOHS3868 is offline
Registered User
FRC #3868
 
Join Date: Jan 2013
Location: Paducah, KY
Posts: 5
LOHS3868 is an unknown quantity at this point
Require help programming a Z-Axis on a Logitech joystick

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
  #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.
  #3   Spotlight this post!  
Unread 26-01-2013, 12:00
Teamcodeorange's Avatar
Teamcodeorange Teamcodeorange is offline
Registered User
FRC #3476
 
Join Date: Jan 2011
Location: US
Posts: 236
Teamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant futureTeamcodeorange has a brilliant future
Re: Require help programming a Z-Axis on a Logitech joystick

If you are using Labview you could just add one, divide by 2 and if it goes the wrong way, multiply by -1.
__________________
Try Code Orange's electronics tutorials!
---------------------------------------------------------
2015 - Tesla Division Champions
2015 - Inland Empire Engineering Inspiration Award
2015 - San Diego Regional Chairman's Award
2014 - San Diego Regional Chairman's Award
2013 - Newton Division Champions
2012 - San Diego Regional Winners
  #4   Spotlight this post!  
Unread 26-01-2013, 12:23
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Require help programming a Z-Axis on a Logitech joystick

Quote:
Originally Posted by agartner01 View Post
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++).
There are 2 things wrong with the last sentence above.

1) Dividing zero by something does not result in undefined behavior. Dividing something by zero does.

2) 0/.5 is not dividing by 2. It is dividing by 1/2, which is multiplying by 2.


Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:14.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi