FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

adding joystick controls

We are a rookie team and are struggling with Labview.  Our joystick 0 on our xbox controller controls the chasis motor and we want joystick one or trigger one or two to control ouro other two motors.  We have watched a bunch of the videos, downloaded and watched tutorials and are still struggling.  We get conflicting messages depending on what we are looking at or talking to.  Some tutorials tell us to add this in teleop vi and others tell us to start with begin vi, then periodic task and then teleop vi and work your way through them. I am including a screen shot of what we created in teleop vi to run a second motor off of joystick 1.  Could someone please tell me if they think this would work or at least direct us to somewhere with some up to date tutorials. 

0 Kudos
Message 1 of 4
(5,112 Views)

Can you post a picture of your begin block diagram so we can see if the motors and Joysticks are setup correctly?

0 Kudos
Message 2 of 4
(3,926 Views)

Hi Thorbots5903,

We spoke on the phone the other day.  I've posted a screenshot here that might help.  In the driver station you can see the USB Gamepad has 6 axes - Left X Axis, Left Y Axis, Left Trigger, Right Trigger, Right X Axis, and Right Y Axis.  Back on the block diagram, when you get the values from Joystick 0 (this gamepad) they are wired to an index array function, where you can retreive each of the axis values.  By default the index array function is only expanded to show the first two elements, but you can resize it to show all 6.  Once you've done that, the array elements will be in the same order as they are on the driver station (I put boxes around each to help illustrate this).  You can then use the Right joystick X and Y axis to control a motor, similarly to the way arcade drive is configured.

Since both joysticks are on the same gamepad you'll reference them both as joystick 0.  You shouldn't need to add joystick 1 to the block diagram.

Capture.PNG

I hope this helps, let us know if you have any other questions!

Kelly B.

National Instruments

Regards,
Kelly B.

National Instruments
0 Kudos
Message 3 of 4
(3,926 Views)

I was able to expand the index array to show all six elements.  Does your block diagram then show element 5 and 6 being wired to ?  Having a hard time seeing what they get wired to.  Thanks for the help Kelly.

0 Kudos
Message 4 of 4
(3,926 Views)