LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get second joystick to work/register

Solved!
Go to solution

Hi,

 

I have two joysticks that I wish to use on LabVIEW to operate a machine. This machine has three axes of movement, namely: translation in x, y, and z. I want to use one joystick as the main joystick that controls movement in the x- and y-directions, whereas the second joystick must control movement in the z-direction. The joysticks are both Thrustmaster USB joysticks.

 

The problem I'm having is that the only one joystick works at a time. I have made a program (attached as "JoystickCheck.vi") that I use to check if the joysticks are being registered in LabVIEW and if they work. If I start up my computer with each joystick plugged into a USB port and open LabVIEW for the first time, then the controller that operates the x and y axes works, but not the z-axis controller. As soon as I plug either one of the controllers out and plug it back in, then only the z-axis controller works. If I repeat this, none of the controllers work anymore.

 

I assume this is some sort of device indexing problem where the index of the joystick has incremented. I don't know how to check where the device index is and I read many forums about something called a "Device Station" or "DeviceStation.vi", but I can't find either of these functionalities or vi's. I then thought that it was an add-on that I needed to install for labVIEW, but couldn't find that either, and all I could find was many threads to do with some robotic competition that LabVIEW had. 

 

I found another post that said it could help find the index number of the joysticks that are being used. This was the "Joystick test.vi". But this didn't seem to work for me either because I had no idea what the joystick's device name would be. I also don't want to have to search for the device index of each joystick every time I switch my computer on and run the vi. 

 

I went into "control panel" and then into "Set up USB game controllers", which allowed me to confirm that both joysticks work and are correctly calibrated. In this menu, both joysticks are labelled as "USB Game Controllers", so I thought this might be their device name. However, when I tried this in the Joystick test.vi, the "can't find device" indicator was still illuminated. 

 

These joysticks have been successfully used in simultaneous operation using LabVIEW by a previous student. I am using windows 8 and LabVIEW 2015 (Academic License). 

 

Looking forward to your response

Peter

Download All
0 Kudos
Message 1 of 10
(4,421 Views)

First off, why wouldn't you have two independent loops?  One for each controller.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 2 of 10
(4,382 Views)

@Minions wrote:

First off, why wouldn't you have two independent loops?  One for each controller.


The DLL calls require the UI thread so they are blocking


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 10
(4,369 Views)
Solution
Accepted by topic author peterlabuschagne

So I found the solution (to my problem at least). Because I wasn't sure of what the joystick device name was, using the "Query Input Devices.vi" was difficult to fully utilize to solve the problem. What I did though was create an indicator for the output of this VI, which allowed me to search through each device index and identify each joystick index number. Once I identified that, I stopped the program, readjusted the index values, and now it all works great! Hopefully this helps someone else in the future too! 

 

I have also attached the working VI.

0 Kudos
Message 4 of 10
(4,348 Views)

Hi,

 

I'm also having trouble with getting my joystick to work (XK-12 from X-Keys). I wrote my own little "Joystick Check.vi" (attached) which is stunningly similar to yours. I tried loading your program, but couldn't because a subVI was missing - "JoystickInputs.vi". Is that custom made? If so, could you reply with the subVI attached?

 

Thanks!

0 Kudos
Message 5 of 10
(3,736 Views)

This thread is over a year old so it's unlikely you'll get a response from the original poster.

 

It looks like the XK-12 is not actually a "standard" joystick.  You will likely have to use their Windows SDK to interface with it.

0 Kudos
Message 6 of 10
(3,728 Views)

Hi

 

I’m away from my computer for the weekend, but I do have some things on google drive. If you could send me an email at: labuschagnepeter@gmail.com then I can try and send you what I can for the time being until I get back to the office on Monday? 

Message 7 of 10
(3,723 Views)

Hi,

 

I think I solved my problem. The XK-12 joystick was the fifth device recognized by LabVIEW in my VI (see attached VI). My front panel cluster didn't expand far enough to see that many devices. I was negligent in checking each device. In my defense, the joystick doesn't show up in MAX at all. Further, the programmable keyboard on the joystick is recognized by LabVIEW by default, without any initialization or configuration from the VIs on the Input Devices palette.

 

I corrected the Joystick Devices cluster in my VI, as shown in the picture of the revised front panel attached to this email. Note that the XK-12 shows up in the device list twice - not sure why.

 

Hopefully the test VIs I wrote will be useful to someone. Thanks to those who replied.

Download All
Message 8 of 10
(3,715 Views)

For those interesting in Joysticks, I found and documented a "failure" in LabVIEW's Query Input Devices -- it failed to enumerate all of them, and depending on how Microsoft arranged the order of the devices, LabVIEW might not see it.  I put on the Idea Exchange "Allow Query Input Devices to return all available devices" (see here) -- it was turned down once because not enough people gave it a Kudo (a "Yes" vote), so two years ago, I put it back up.  So far, no action, but if you use Joysticks, you might want to Kudo this Idea ...

 

Bob Schor

Message 9 of 10
(3,706 Views)

Here are some extra files that I left out.

Message 10 of 10
(3,682 Views)