Labview Help! Going to comp tomorrow and still having this problem.
I am a programmer on team 4810 posting under the account of one of my mentors.
We are using two xbox one joysticks to control our robot. We have been having the problem where every once in a while the first controller does what a corresponding button or axis on the secondary controller is supposed to do. The secondary controller now does nothing; its function has been taken by the first. It is like the functions of the second controller have been stripped and overlaid onto the first. Then, after a while, they will revert to normal.
The driver station still reads the controllers correctly, as does the dashboard which we write to in teleop by “get joystick values”. When we receive the joystick values, we write them to global variables which we receive in periodic tasks, where we do the actual driving of the motors.
The overlaying does not seem to be triggered by anything. We have gotten new controllers, and are using the array to cluster and then unbundle by name instead of index array to get the joystick values outside of the array they come in.
Please respond with any suggestions, and if you would like to see specific parts of out code it is on github at
Thank you so much in advance
I didn’t spot a cause in your VIs. I’d focus attention toward the USB host and if the issue is there, making sure they don’t sleep (power options) or are otherwise faulty (try other USB ports). Or swap the drive station computer.
We have been noticing this too. The issue seems to be with either the usb host, the driver station, or most likely, both. For is, it seems to change when a stick is plugged into the computer while the driver station is still running. The solution is to switch the sticks in the driver station by clicking on the usb tab of the driver station and dragging the lower stick to the top. Then, do not unplug any usb perifferals from your computer.
Good luck at the event.
One thing I forgot to mention: the problem happened while connected to four different student laptops, as well as a dedicated driver station laptop that is clean of crapware and should have the USBs set to never sleep. We had heard that the Afterglow controllers we were using were buggy, so we bought two of the newest Xbox for windows controllers and the problem remained.
Thinking through some troubleshooting:
The problem is not in the controllers as we got new ones,
It is not in the physical driver’s station, unless it is a default windows setting, as it happened on multiple controllers,
It is unlikely that it is the program “drivers station”'s issue because of the multiple laptops and I have heard of almost no other teams with this problem,
Re-imaging the Rio fixed the problem for almost two hours of drive time but it then reverted, and again I haven’t heard complaints in the FRC community,
It is unlikely that it is the physical Rio because the same problem happened on our practice bot’s electronics board,
The problem happens while using different radios.
This leads me to sadly think that the problem is in the code as it is a commonality.
Am I missing something above?
Possible issues with code:
Last night I noticed that we did not have shift registers on the motor refnums in periodic tasks. I added them, but would this change anything?
Could a problem be that we have a fair amount (~20) global variables? Sitting here thinking, I think that we could decrease the amount to about 15 without too many changes if it mattered.
Could it be that if our periodic tasks loops are running too fast the Rio could get confused? If 20 or 40 ms wait is too fast, what would you suggest?
I don’t see a reason that to many global variables would make an issue, we have upwards of 100 with no issue. As well as with the loop timers being too fast shouldn’t be an issue with flipping the controllers. We are using a similar architecture of reading the controllers in Teleop and putting those values into globals specific to each controller (One global for Driver Controller, one global for Manipulator Controller, one global as the standard Global data with robot specific info) and haven’t had an issue.
I would double check that the refnums for your controllers are named the correct things as I recall at one point the get joystick values defaulting to USB 0 if lost.
I would also suggest probing the refnum going into each Get Joystick Values vi while it is running to see if they are flipping in code.
I don’t have LabView on my computer right now so I can’t look through your code, but those are some of the things I would check.
There is a 20 ms wait hardcoded at the top of Teleop.vi that could potentially conflict with the robot main.vi scheduling loop.
The shift registers issue doesn’t seem to fit your problem. I’ve seen teams with many more global variable, so that doesn’t seem suspect.
And for drive station/usb problems that you’d see the change on the driver station, as joysticks are disconnected/flipped in order. I’m not sure if sleeping USBs is a default, but common enough to double-check.