View Single Post
  #5   Spotlight this post!  
Unread 09-02-2017, 11:17
JeffB JeffB is offline
Registered User
FRC #5052 (RoboLobos)
Team Role: Mentor
 
Join Date: Apr 2015
Rookie Year: 2014
Location: Austin
Posts: 67
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: LabView Joystick Help Needed

As I don't see this mentioned in the thread, I'll add on to the follow up.

The first place you want to start when trying to modify joystick code is your driver station. This seems a bit strange as you don't actually code anything here. But, it's important to know WHAT you're working with.

On the left, there are several tabs. Click the 2nd from the bottom that looks like the USB plug. In this tab, you can see the joysticks connected to your PC. If you have more than one, move a joystick to see if it moves any of the values. If so, great. You're on the right one. If not, click the other. With only one joystick, we'd expect to see a change.

Towards the right of that window you'll see some mixture of Axis, square boolean LEDs, and potentially a POV. Move your joystick and watch what moves. The Axis are all labelled by their corresponding number in LabVIEW.

Push the buttons. These are numbered starting at 0. The first column is 0, 1, .... The second column starts at the next value.

It's a good idea to create a map. Grab a sheet of paper and write down what each of these are. That way, you can reference it later.

Once you know these values, take a look at the pre-built Teleop.vi. There's a "Get Joystick Values" VI that pulls off a thick orange and a thick green wire. The thick orange wires into an "Index Array" that is then fed into your motor control. The Index Array can be hovered over to see a blue box at the bottom. You can drag it down to get as many joystick axis values as you're interested in. By default, Index Array will start at 0 and count down. If that doesn't match the mapping of your joystick, right-click the input "Index" and choose "Create -> Constant" That will pop out a numeric constant that you can change to match your joystick axis value.

You can similarly add an Index Array and wire in the thick green wire to get all of your button values. With that, you can use the same methods to break out the individual values and run whatever logic you're after.
__________________
Reply With Quote