LabView Joystick Help Needed

We are not great with LabView. Let’s get that out of the way.

How do we change what the joysticks do? We used the base Arcade Drive and the code is working with our robot after we assigned the motors and PWMs. However, it’s just forwards and backwards.

How do we make it so we can assign certain axis to do certain things?

Thanks in advance.

Arcade (the default robot project) should allow you to turn as well.
Does the robot not turn if you lean the joystick to one side or the other?

DefaultArcadeDrive.png


DefaultArcadeDrive.png

If you’re robot is only going forward and backward, it may be a mismatch between the physical system and how the motors are opened in Begin.vi (are there four motors?). If the problem persists, could you post screen shots of opening the motors in Begin.vi and what you have for setting them (in Teleop)?

Team 358 has posted a lot of example code on their website: http://www.team358.org/files/programming/ControlSystem2015-2019/labview/index.php#ArcadeDrive

Please feel free to personal message or email me if you have any issues and want a quick reply.

Just a follow up, have you been able to get this going?

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.

You are the real MVP. That is exactly what I needed. It was doing goofy things without being able to map to certain axis. Thank you so much!