![]() |
Change in buttons and axes sub vi's
3 Attachment(s)
I programmed in labview last year using the 2013 version and am using the 2014 this year like most people also. I have a question. In the 2013 edition of labview, you declared buttons and axes much differently than you do now. I actually like 2013 version of labview more than the 2014 for this reason.
Can someone explain the difference between the two images I have uploaded and how to pick which axes and buttons to use from it? File named axes and button is 2014 version and the other file is 2013 version. |
Re: Change in buttons and axes sub vi's
The joystick VIs were modified so that they support a wider variety of joysticks and in particular they support Xbox controllers better. One result of this was that the number of buttons, axes, and POVs were not really known, and the names given to them were not necessarily that accurate. Sure, they still had a name, but it may be a bit off.
The new Joystick Get function returns an array of each item, and they can be accessed using the index array function. If unwired, the top element defaults to returning element zero and other elements increment the previous index by one. For Example: If you want to index elements 3, 4, and 5, you simply wire a 3 to the top and the others still increment. If you want 2, and 5, you can wire the numbers to two elements, and you can do so in any order you want. If you do not want to use index array and prefer to have names, determine the names you want for your axes. Perhaps (run, strafe, rotate). Build a cluster of three numbers with those names. Then cast your array to your cluster. I'd do this in a new subVI that is your own joystick customization VI that you layer on top. Then you can access the elements as before, but with your robot's specific names. Note that this is even more useful for buttons, as they can be named (up and down) instead of Button 1 and Button 2. Greg McKaskle |
Re: Change in buttons and axes sub vi's
Quote:
|
Re: Change in buttons and axes sub vi's
Not necessarily. Since NI has decided to not cluster the axes and buttons in the get joystick values vi for the current version of LabVIEW, you would not be able to do the unbundle function to get your axes and buttons. Now I understand it's hard for you to differentiate between which button is which and how to figure out which element of the array to which. Use the game controller settings on the joystick or controller you're using to find out which buttons or axes correspond with which. You can access this by going into the devices and printers, which can be found on the windows start menu and right click on the controller. Click game controller settings and navigate to settings and there you should be able to test out what number the axes or button is. If you are having trouble with this check on Microsoft's website to find detailed instructions to access the game controller settings. After finding your numbers, you can correspond this with the element number in the array for instance the x-axis is by default on array element #1 (or 0, I don't recall if LabVIEW's starting index for arrays).
|
Re: Change in buttons and axes sub vi's
Quote:
|
Re: Change in buttons and axes sub vi's
Quote:
The button/axis number you see corresponds to the element number for the array of buttons/axis you get out of the WPIlib joystick VI. Note when you go to program this the first element in an array and subsequently button #1 on the joystick will be the number zero. Things in programming count up starting at zero not one. |
Re: Change in buttons and axes sub vi's
1 Attachment(s)
The joystick VIs had not changed in five years, and it was commonly requested to have better Xbox controller support. You can use the 2013 description if that is what you want.
You will want to copy the cluster that has the buttons and use that as the output from your wrapper subVI. The attached images shows an example. Then use that one instead of the one in the palette. Greg McKaskle |
Re: Change in buttons and axes sub vi's
Quote:
|
Re: Change in buttons and axes sub vi's
1 Attachment(s)
Quote:
Code:
/* Complete USB Joystick Example |
| All times are GMT -5. The time now is 10:28. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi