|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Joystick axis values in new controller
Are the values of joystick axis(x,y,and z) in new controller 0 to 255 like last controller? or do they have float value of -1.0 to +1.0?
i can't find what value it returns although my guess is float value of -1.0 to +1.0 since doxgen says function type is float. just making sure Last edited by koreabell : 16-12-2008 at 13:52. Reason: typo |
|
#2
|
||||
|
||||
|
Re: Joystick axis values in new controller
READ the Programming Guide, your question will be answered.
|
|
#3
|
|||
|
|||
|
Re: Joystick axis values in new controller
well I'm programming in c++ and there is no examples or something like that on C/C++ Users Guide for joystick axis value(there's nothing except for big "DRAFT" across the page when you go to joystick page)
there is GetRawAxis() function under joystick class which i assume it will return values between 0 to 255, but that is also float type function while GetRaw() function under PWM class is int type(actually UINT8 type) function. i know float can handle more wide range than int, thus GetRawAxis() might return values between 0 and 255, but still i'm not sure and i won't know until new controller comes anyway, i wrote a function that will return values between 0 and 255 even if GetY() or GetAxis() function returns values between -1.0 and +1.0 |
|
#4
|
||||
|
||||
|
Re: Joystick axis values in new controller
Refer to the C/C++ Programmer Reference Guide.
You can either use Joystick::GetRawAxis(UINT32 axis), where axis is a value between 1 and 6 specifying the axis, or you can simply use Joystick::GetX() and Joystick::GetY(). All of these functions return a floating point value between -1.0f and 1.0f. Returning values between 0 and 255 will lower your precision, as a floating point variable can hold much more data than an unsigned character. |
|
#5
|
||||||
|
||||||
|
Re: Joystick axis values in new controller
In most cases, the WPI Robotics Library is equivalent between LabVIEW and C++, although the documentation isn't always as good for one or the other. 99% of the time, you should be able to look at the LabVIEW documentation if the C++ documentation isn't clear (and vice versa). Don't get caught up in the name of the document.
Quote:
If you are trying to directly copy an algorithm from the IFI controller, it may be easier if you use the raw joystick values and the PWM class, but for implementing new things, you'll probably find it easier to work with the floating point values. Last edited by Joe Ross : 16-12-2008 at 17:30. |
|
#6
|
||||
|
||||
|
Re: Joystick axis values in new controller
I may be wrong, but in doing basic tests it seemed that the joystick had greater precision than that. What you're saying does make sense though. I'll have to take a deeper look at it.
|
|
#7
|
||||
|
||||
|
Re: Joystick axis values in new controller
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: Joystick axis values in new controller
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reversing the joystick axis | JBotAlan | Programming | 3 | 09-02-2005 19:47 |
| Tri-axis Analog Joystick | KVermilion | Control System | 5 | 19-01-2005 00:24 |
| pwm outputs vs. joystick y-axis | stephenthe1 | Programming | 4 | 01-12-2004 17:29 |
| Inverting Y axis on joystick | FormatteD_C | Programming | 7 | 24-02-2004 16:56 |
| switching joystick axis????? | team222badbrad | Technical Discussion | 9 | 16-01-2002 23:07 |