LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Joystick Axis Raw Data

I want to read the raw data from a 2-axis joystick.  It is a USB HID device.

I am able to connect to the device and read data using a program similar to this example:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9aOSAS

 

My problem is that the "acquire input data.vi" is automatically doing some kind of scaling to the output.  For each axis, I am getting a value that is +/-32768.  I know that the raw data from this device should only be 12 bit and unsigned (i.e. 0-4096).

 

I am pretty sure that this does not have to do with windows calibration.  Using the game controller control panel settings, I can calibrate the joystick such that it gives a strange output to windows, but the Labview values are unaffected.

 

I know that I could add 32768 and divide by 16 to get a very close approximation.  I don't want to do this because this will be used for a validation activity.  I know that Labview must be reading the raw value to be able to generate this data.

 

Does anyone know how I can get this axis value in its original form?

0 Kudos
Message 1 of 6
(4,498 Views)

Is this a USB-connected Joystick?  I think there may be circuitry within the Joystick that includes a microprocessor to generate data compatible with DirectInput or XInput APIs.  Note that there may also be a "calibration" procedure that adjusts the gains so you get output that is "mapped" to an I16 value.

 

Bob Schor

0 Kudos
Message 2 of 6
(4,467 Views)

Yes, it is USB HID.  There is a microprocessor in the joystick that generates the signal but I do not have control over it.  I know that it is 12 bit per axis.  I can view the raw signal using a python library I found and it also shows in the windows calibration.  I want to get these numbers into Labview, but Labview is trying to "help" by trying to normalize and scale the signal.

0 Kudos
Message 3 of 6
(4,461 Views)

Seems like LabVIEW uses the Microsoft API to allow you to use Joysticks "without worrying about the details" (which makes sense to me).  By your description, Python has libraries that can either directly intercept the Joystick signals or else call other API functions to get you both raw and processed data.  I believe there is something called LabPython that might be able to allow you to include the Python calls to get the data you want into LabVIEW.  You can find it on the Web, and also on the LabVIEW Tools Network (there it is called Python Integration Toolkit, but it's made by the same company).

 

Bob Schor

0 Kudos
Message 4 of 6
(4,457 Views)

Thanks for the input.  If that is the case, then it sounds like there is not a native way to get this data in Labview.  LabPython looks interesting, but for this application I might as well just do the whole thing in Python if it comes to that.

0 Kudos
Message 5 of 6
(4,452 Views)

A USB HID has a lot of configuration in it's device configuration package.

 

HERE. Be warned, it's a lot to read and most of it won't apply to your device.

 

This is generally used for the OS to know the correct polling rate, scaling of axes and so on.  Windows is going to use this data to perform a scaling according to the HID standard.  I could imagine that LabPython communicates directly with the device and doesn't fully implement the HID specification.

 

If you have control over the device, make sure the HID parameters are set accordingly.

0 Kudos
Message 6 of 6
(4,430 Views)