|
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
|