View Single Post
  #7   Spotlight this post!  
Unread 24-01-2017, 14:13
JeffB JeffB is online now
Registered User
FRC #5052 (RoboLobos)
Team Role: Mentor
 
Join Date: Apr 2015
Rookie Year: 2014
Location: Austin
Posts: 64
JeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to behold
Re: Tank Drive Talon SRX

I'm going to walk through the entire joystick process hoping this gets you, and others, on the right path.

The first thing you want to do is plug in your joysticks. Once they're plugged in, open up your Driver Station and click on the 4th tab down. It looks like the USB icon and is right above the lightning bolt, just below the gear.

This will give you a list of devices under USB order. They'll all have a number next to them. Pay attention to these numbers.

On one of your joysticks, move it forward. Do you see any axis change? If not, click on another joystick in the list and repeat until you see an axis move. Once you see the axis move, you've identified which number matches that specific joystick.

Take a look at all of the things that populate now. You have booleans and some axis values. You can move your joystick around to find where each axis is as well as push each button to see which responds. Both the axis and booleans are 0-indexed. That means the first axis is 0, the second is 1, and so on. While you're coding, you'll want to have a map of these index values to the buttons they match.

Once you've done this for all of your joysticks, open up the Begin.vi. Open a reference to each joystick using the USB number we just found matching the joystick. Give your joystick a meaningful name. The default project has "Joystick 0" Please don't use this naming scheme for yours. Replace that with something meaningful. "Drive joystick" "Left side joystick" Use a name that describes what it is. Match the code in the Begin.vi to create a reference.

In your teleop code, get the joystick reference using the name you just created.

From here, you can pull out the button or axis values and index the array of values using the index we found testing in the driver station. Pass the desired axis/boolean to your logic to see what happens.
__________________
Reply With Quote