Go to Post Maybe if we get lucky [the GDC] will just say chute door. - IronicDeadBird [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 03-02-2005, 18:03
Jatheon4316's Avatar
Jatheon4316 Jatheon4316 is offline
Registered User
AKA: Jason
None #0500
Team Role: Programmer
 
Join Date: Jan 2005
Location: RI
Posts: 9
Jatheon4316 can only hope to improve
Send a message via AIM to Jatheon4316
Post Joystick Inputs

Hello fellow programmers!

Would someone please tell me what the inputs are for the the 2004 and or 2005 FIRST joysticks? Including x and y axis, trigger, top button/HAT (depending on year) etc...

Thanks!
  #2   Spotlight this post!  
Unread 03-02-2005, 18:16
Bleric's Avatar
Bleric Bleric is offline
Registered User
#0624 (CRyptonite)
Team Role: Programmer
 
Join Date: Jan 2005
Location: Houston
Posts: 19
Bleric is on a distinguished road
Send a message via AIM to Bleric Send a message via MSN to Bleric
Re: Joystick Inputs

*cough* documentation *cough*

Anyway, the variables you will be using are

p1_y
p2_y
p3_y
p4_y
p1_x
p2_x
p3_x
p4_x

p# refers to the port you're plugging the joystick into. x / y refer to the x and y axis. Values range from 0 - 255.

For example, if you're looking at the joystick in port one, and it is held in the center, p1_y is 127 and p1_x is 127.

p1_sw_trig
p1_sw_top

p3_sw_trig
p3_sw_top

p2_sw_trig
p2_sw_top

p4_sw_trig
p4_sw_top

These refer to the trigger and top buttons. (If you're using the white kit joysticks, I think the "top" button is actually on the side) They're set to 1 if the button is being pushed, and 0 if it isn't.

I'm pretty sure the "hat" button isn't even wired. So, you can't use it unless you take your joystick apart and wire it up yourself. (I may be wrong on this, though)

Also, I would read all the documentation I could find if I were you. Innovation first has a programming guide which I found very useful, and should answer most of your questions.
useful links
programming guide

Last edited by Bleric : 03-02-2005 at 18:36.
  #3   Spotlight this post!  
Unread 03-02-2005, 19:00
Jatheon4316's Avatar
Jatheon4316 Jatheon4316 is offline
Registered User
AKA: Jason
None #0500
Team Role: Programmer
 
Join Date: Jan 2005
Location: RI
Posts: 9
Jatheon4316 can only hope to improve
Send a message via AIM to Jatheon4316
Re: Joystick Inputs

Thanks...I must've missed that in the documentation *rubs eyes wearily*...
  #4   Spotlight this post!  
Unread 03-02-2005, 19:28
whakojacko's Avatar
whakojacko whakojacko is offline
Registered User
FRC #1072 (hrt)
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2003
Location: San Jose, California
Posts: 137
whakojacko is on a distinguished road
Send a message via AIM to whakojacko Send a message via MSN to whakojacko
Re: Joystick Inputs

all the definitions are in ifi_aliases.h . you shouldnt need to change anything there, but that will give you a good idea of the variables. Btw the p_wheel definitions is for the hat. Its wierd how it works, but i messed around with it and it does work
__________________
Harker Robotics:1072
http://www.harker-robotics.org
  #5   Spotlight this post!  
Unread 03-02-2005, 23:13
Jatheon4316's Avatar
Jatheon4316 Jatheon4316 is offline
Registered User
AKA: Jason
None #0500
Team Role: Programmer
 
Join Date: Jan 2005
Location: RI
Posts: 9
Jatheon4316 can only hope to improve
Send a message via AIM to Jatheon4316
Re: Joystick Inputs

Ok, here's another question...

I know that the joystick's y axis value is highest (ideally 254) when it's full forward and lowest (ideally 0) when it's full backward.

However, what about the x_axis? Is highest (ideally 254) at the left or the right? And is the lowest (ideally 0) at the right or the left.

y=254?
full forward
|
x=? full left ----+---- full right x=?
|
full backward
y=254?
  #6   Spotlight this post!  
Unread 04-02-2005, 06:38
Anton's Avatar
Anton Anton is offline
Anton Povzner
#1581 (Element)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Israel
Posts: 51
Anton can only hope to improve
Re: Joystick Inputs

I can't remember it at the moment, but you can easily check it with printf, for example:
printf("Port1 Y %3d, X %3d, Fire %d, Top %d, lm %d, rm%d\n, ,%d , %f",(int)p1_y,(int)p1_x,(int)p1_sw_trig,(int)p1_sw _top,lm,255-rm,5/3, 5/3 );
  #7   Spotlight this post!  
Unread 04-02-2005, 06:42
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Joystick Inputs

Quote:
Originally Posted by Jatheon4316
Ok, here's another question...

I know that the joystick's y axis value is highest (ideally 254) when it's full forward and lowest (ideally 0) when it's full backward.

However, what about the x_axis? Is highest (ideally 254) at the left or the right? And is the lowest (ideally 0) at the right or the left.

y=254?
full forward
|
x=? full left ----+---- full right x=?
|
full backward
y=254?
Yes, it is 0 and 254, if I recall correctly.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #8   Spotlight this post!  
Unread 04-02-2005, 07:35
Jatheon4316's Avatar
Jatheon4316 Jatheon4316 is offline
Registered User
AKA: Jason
None #0500
Team Role: Programmer
 
Join Date: Jan 2005
Location: RI
Posts: 9
Jatheon4316 can only hope to improve
Send a message via AIM to Jatheon4316
Re: Joystick Inputs

0=full left (ideally)
-to-
254=full right (ideally)

Right?

Sorry to bug ya'll. But I won't see our bot and joysticks again till Saturday (or would've used a printf statement to find them)...thanks!
  #9   Spotlight this post!  
Unread 04-02-2005, 16:08
Anton's Avatar
Anton Anton is offline
Anton Povzner
#1581 (Element)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Israel
Posts: 51
Anton can only hope to improve
Re: Joystick Inputs

I remember being really surprised to see that the algorithm I developed wouldn't wprk just because x- axis had 255 as the left value, not the right one as I expected, but soon I realised that to invert it I just had to add a line of code p1_x=255-p1_x;
What I'm trying to tell is that even if you don't know the correct axes values you don't need to worry, you can easily map them as you wish-you can even make them -127 to 128, if you think that it's worth the effort. Personally, I htink it would be nice, but I already wrote half my brogramm using the default values, so there's no point giving myself more work than needed. But if you are just beginning the joysticks, I think it's a good thing to do.
  #10   Spotlight this post!  
Unread 04-02-2005, 16:53
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: Joystick Inputs

Quote:
Originally Posted by Jatheon4316
Would someone please tell me what the inputs are for the the 2004 and or 2005 FIRST joysticks? Including ... top button/HAT
This thread from last year covered the"top button/HAT". I don't know if IFI has fixed the "feature" whereby any deflection in the up direction are indistinguishable.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me
  #11   Spotlight this post!  
Unread 04-02-2005, 17:06
Darkelement's Avatar
Darkelement Darkelement is offline
Team 241 Lead Programmer
AKA: JC Morgan
FRC #0241 (The Astros)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2000
Location: New Hampshire
Posts: 8
Darkelement is an unknown quantity at this point
Re: Joystick Inputs

Quote:
Yes, it is 0 and 254, if I recall correctly.
I thought that the joystick range was 0 to 255. That's what I have been inputting and I haven't had any problems.
__________________
  #12   Spotlight this post!  
Unread 06-02-2005, 12:01
The yellowdart's Avatar
The yellowdart The yellowdart is offline
Registered User
FRC #1506 (Metal Muscle)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Oakland County
Posts: 22
The yellowdart has a little shameless behaviour in the past
Re: Joystick Inputs

full ahead should be 254
127 is neutral.....
full reverse should be 0

full right should be 254
and full left should be 0
again with neutral being 127

hope that helps
  #13   Spotlight this post!  
Unread 06-02-2005, 17:25
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Joystick Inputs

The hobby controller I used for my team's EDUbot fell short of the full analog range by 20-40, robbing us of some control resolution. I don't think the joysticks in the FRC kit had this problem, but you can always test the range, and which side is which, by outputting the contents of p1_y (and the others) to User_Mode_byte and switching to user mode in your operator interface.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems hooking up a joystick to edubot Salik Syed Programming 2 24-03-2004 23:56
Changing 1 joystick code to 2 (rookie team) Brawler006 Programming 5 20-02-2004 17:00
robot goes haywire with the one joystick default code Miles Programming 7 24-01-2003 14:58
joystick problem archiver 2000 12 23-06-2002 23:08
switching joystick axis????? team222badbrad Technical Discussion 9 16-01-2002 23:07


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

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