labVIEW joystick connection issues

Hello I am the programmer for team 4717. This is our first year first in the competition and we are having trouble getting our code to work properly in our robot, we have isolated the problem to our labVIEW code. We can get one one joystick to connect to the robot at a time even if two joysticks register on the dashboard only one will operate. Any sort of help will be very appreciated.

How did you update your code to handle the second joystick?
The default Arcade code comes assuming a single joystick.
If you added a second joystick, what does your code do with it?

The existing code only runs 1 motor controller. We can’t get the other controller to respond no matter where it is plugged in. We know it works because we changed the second controller to the slot where the first has been working and all is golden.

So…

We duplicated all the joystick code in teleop.vi and went in and changed it to USB2 (where the second joystick is attached), and duplicated all the linked modules, adjusting them where we could find to adjust them to try and control the other side. Now, the dashboard thinks it has 2 joysticks, but just 1 of them is making any feedback on the readouts. The Driver Station recognized we have both joysticks attached, but LabView isn’t the most intuitive at digging through pre-existing code.

What did you change in the code to run a second motor?

We duplicated all the joystick code in teleop.vi and went in and changed it to USB2 (where the second joystick is attached),

That’s exactly half of what you need to do. The other half is to give the RefNum for the second joystick a unique name like “Joystick 2”, where the first one is “Joystick 1”.

and duplicated all the linked modules, adjusting them where we could find to adjust them to try and control the other side.

What does “duplicated all the linked modules” mean?

Now, the dashboard thinks it has 2 joysticks, but just 1 of them is making any feedback on the readouts. The Driver Station recognized we have both joysticks attached, but LabView isn’t the most intuitive at digging through pre-existing code.

There’s a section in the code which sends the joystick values to the Dashboard. You should duplicate that for the second joystick, changing the obvious “1” in the string constant for the SmartDashboard name to “2”.

So you have two distinct problems.
Although your question is about the second problem, I don’t expect your recoding of the Joystick to do you much good until you’ve resolved the first issue of the unresponsive motor controller.

From your testing of the motor controller in the PWM port that works, it sounds like the motor controllers are fine and the PWM cables are plugged into them properly.

Which PWM port works?
When the non-working PWM port is connected, what is the motor controller status light doing?
Are the three green power lights on the Digital Sidecar all brightly lit?

For the addition of the Joystick you might want to post your Begin.vi and Teleop.vi, so we can see if anything’s not hooked up right. But the PWM port won’t suddenly start working because a new joystick was added.

Ok, I’m Carl’s teacher/coach/programming-overseer/whatever. Maybe I can clarify a little what we’ve tried.

When we did the whole “select all”/copy/paste in regards to the joystick/motor blocks of code, we changed all the names of one set to “Joystick 2” and “… Motor 2…” and all. The vi’s that are part of the section were opened and saved with “2” in the name.

I just found the “Tank Drive” block. (Yeah, yeah, LabView isn’t high on my list of favorite programming environments but Eclipse won’t deploy to the cRio so we are going with LV at the moment). I tried plugging it in place of the Arcade Drive block. That was an interesting change of effects – now, I get nothing when I push the one working stick forward or backward, but it pulses now when we push it in any other direction.

I’d like to get this driving for a show-and-tell tonight, but I’m about to pull what hair I have out over this.

We are plugged into PWM2 which is actually sending working signals to the motor controller. PWM1 and PWM3 …not so much. Tell me what pics you want to see and we will take them.

I’d like to see a photo of the Digital Sidecar with power on, showing the wiring and status lights.

It’s easiest to create a new default Arcade robot project, build and download that until the wiring problem gets sorted out.

If you want to zip up your current robot project and attach it to a post here, we’ll take a look and see what’s not working in there.

Are you saying that you created new VIs named “WPI_JoystickOpen2.vi” and “WPI_JoystickRefNum Registry Set 2.vi”? That would certainly keep things from working as designed.

I agree with Mark’s advice. Create a fresh Arcade project and get it to control your robot so you can verify things are properly wired. Then we can help you make changes and additions to control other robot functions.

You may also want to try using Test Mode.

With the code running, change the driver station into test mode and on the dashboard click to the Test tab. It will show you the joysticks and motors that have been opened. If you enable the robot on the DS, you can now see the values of the joysticks in the table. See if they change when moved. You can also select the Value of a motor, set the slider to a value and Enable the motor to see if it works using this code. If it doesn’t work in test mode, it is either because it wasn’t opened properly in Begin, or more likely due to an electrical issue.

Greg McKaskle

We have restarted, again, with an entirely fresh project.

The only modifications we have done to it is, in Begin.vi, change from the Jaguar controller (in the drop-down) to Victor (which is what we have). We have verified that the ports the controllers are plugged into are the ports listed there, as well.

Still, only 1 side is working. :confused:


Final Hope 2013 Robot Project.zip (3.47 MB)



Final Hope 2013 Robot Project.zip (3.47 MB)

Just a side note - The two white wires in the end of your Power Distribution Board are illegal and will not pass inspection. Wrapping each end of the wire in red electrical tape will not suffice - the entirety of the wire’s insulation must be red.

Thanks, we will take care of that in the next hour and I’ll talk to my electrician mentor to ensure no more white wire is used.

White is a legal color for positive voltage. See R50A.

That actually helps narrow the problem down a bit.
It isn’t the code if you’re using the default arcade project, so it’s the wiring.

The Sidecar looks clean and the connections proper.
Power is good.

One candidate is a bad or reversed crimp on the 37-pin ribbon cable. Especially since they had to be hand-made, those have a high potential for wiring issues.
You can use a multi-meter to test that each pin connects through to the other end.
When you take the cable and plug it into itself, does it form a simple loop (correct) or does it form a mobius strip (reversed)?

I assume that if the PWM connections at the Sidecar are swapped, that the corresponding inoperable Victor then starts operating normally?
And PWM 2 is still the port that works and PWM 1 is the port that doesn’t work?

The 37-pin cable forms a simple loop. We will run it through the multi-meter later this afternoon just to be absolutely sure all is 100% with it.

Yes, if we swap the PWM connectors, the other Victor functions.

However, it’s PWM 1, not 2, that’s working

It runs! Everything works great, it turns out the sidecar had a faulty port 2 so we just switched to another and it works awesomely. Thank you everyone for the suggestions and help. Good luck with your own projects.