FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting joystick buttons to motors

Hey macro,

Yes, the outputs from the WPI_Joystick_GetValues.vi (in this year, FRC 2015) are a different format from the outputs of the WPI_Joystick_Get.vi (from last year, FRC 2014.

Now it just outputs an array of doubles for all the Axes, and an array of booleans for all the Buttons.

Use Index Array to extract the Axes you need (in the example below, Axis 0 and Axis 2) and the Buttons you need (below, Buttons 0, 2, 5, and 6).

JoystickGet.PNG

Sounds like you are on the right track!

-Ryan

Ryan C.
Applications Engineer
National Instruments
0 Kudos
Message 11 of 28
(1,454 Views)

Ryan,

Thanks for your freply,

It's now clear for me what the index array for, but is there any specific name to call the Axis (Axis 0 or axis0...) and if I need to use more then two Axis, Throttle, how the configuration should be on the input and output for the index array?

Same for the buttons

I don't see any link for the example you just mention.

Thanks for your help

macro

0 Kudos
Message 12 of 28
(1,454 Views)

I've included a VI snippet that you can drag into your teleop code that shows how this works.

FindJoystickAxes.png

You may want to save off the index of each axis once you find them to avoid searching for them each time your code runs.

0 Kudos
Message 13 of 28
(1,454 Views)

Dear DAQjr,

I don't have the vi file that I can drag to the teleop can ypu please resend it for me.

Thanks

0 Kudos
Message 14 of 28
(1,454 Views)

Just drag the image... it will turn into code.

0 Kudos
Message 15 of 28
(1,454 Views)

Hi macro009,

The image in DAQjr's post can be dragged and dropped into a LabVIEW VI.  Its called a VI Snippet, and you can find more information on it here: http://www.ni.com/white-paper/9330/en/

Regards,
Kelly B.

National Instruments
0 Kudos
Message 16 of 28
(1,454 Views)

Thanks because I tried to dragg it before didn't work now it's working fine.

thanks again

0 Kudos
Message 17 of 28
(1,454 Views)

I still don't know how to set the buttons based on what Ryan says, I didnt see it in the example that was displayed (Button 1, 2,..6)

Please can you help?

Thanks

macro

0 Kudos
Message 18 of 28
(1,454 Views)

Unfortunately the joystick API for HID and XBox does not have a way to describe the buttons on a joystick, and as such we can't pass that on to you.

If your joystick has numbered buttons, then you basically just index the array with that number (make sure you subtract one if the joystick buttons start at "1").  You can also simply experiment to find the indices of the buttons you care about.  The buttons will always have the same order in the array.

0 Kudos
Message 19 of 28
(1,454 Views)

Hello,

Another question concerning WPI_JoystickGet.vi.

Is it possible to use the WPI_Joystickget.vi (used in the FRC 2014) instead of the WPI_JoystickGetValue.vi (used this season FRC2015).

Or in other word replace the FRC2014 teleop.vi instead of the FRC2015 teleop.vi.

If yes How can we add the WPI_JoystickGet.vi to the WPI Robotic Library function under the Joystick palettes, since the WPI_JoystickGet.vi still located under C: >program files (x86)>...>Rock Robotics>WPI>Joystick>.

Regards,

macro

0 Kudos
Message 20 of 28
(1,454 Views)