
25-02-2015, 14:43
|
 |
That one guy
AKA: Josh
 FRC #3053 (Stingers)
Team Role: Programmer
|
|
Join Date: Feb 2014
Rookie Year: 2012
Location: NYC
Posts: 39
|
|
|
Re: Change in buttons and axes sub vi's
Quote:
Originally Posted by Greg McKaskle
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
|
I think i understand. Would i be able to copy and paste the button and axes from the third photo(labview 2013) into 2014 and it would work?
Last edited by Ragingenferno : 25-02-2015 at 14:51.
|