|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
Re: Joystick Inputs
Thanks...I must've missed that in the documentation *rubs eyes wearily*...
![]() |
|
#4
|
||||
|
||||
|
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
|
|
#5
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
|||||
|
|||||
|
Re: Joystick Inputs
Quote:
|
|
#8
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
|||||
|
|||||
|
Re: Joystick Inputs
Quote:
|
|
#11
|
||||
|
||||
|
Re: Joystick Inputs
Quote:
|
|
#12
|
||||
|
||||
|
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
|
|||
|
|||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |