Our team has gone to two regionals this year. At both we have experienced large amounts of lag between our control system and robot. After our first competition, we decided to take a shotgun approach to fixing the lag. We had originally written or code in Java with the simpleRobot template, so we tried writing it in Iterative, both with and without a separate thread for the drive system. We did find that the Iterative without a thread for drive improved the lag issues, but a newer issue seemed to emerge. We would see the robot stop for a bit, drive for a bit, then stop again, repeating over and over. The drive logs did not show any lost connections. If anyone has had this issue and was able to solve it, it would be great if you could show us how to fix this.
Could you post your robot code? That would be the easiest way to identify if it is a code issue or not.
Most likely it was your camera. We had this problem at out first District event and the field crashed several times in the middle of the match from teams using too much bandwidth. Try changing your camera settings, compression, and resolution to see if that helps. You can only use 7 Mb for your bandwidth this year so u don’t have a lot.
Did it only lag on the field, or did it lag in the pits too? In addition to the code, can you post a driver station log file both from the field and from the pit?
We have had no lag in the pits or at home. we were actually able to play Unreal and transfer files across our robots router, while still having no lag issues back at home. Our camera is currently at the lowest possible resolution and at 70% compression. I have attached our code in the zip file.
UltimateAscentIterativeNoDriveThreadBaltimoreThree.zip (1.36 MB)
UltimateAscentIterativeNoDriveThreadBaltimoreThree.zip (1.36 MB)
Here are our log files. I posted a picture of a match in which we had terrible lag. In the beginning of Teleop, you can see, based on the voltage leveling off, where our robot was dropping out. This was an issue that would seemingly appear at random during some matches, and others not.
Log Files.zip (1.51 MB)
Log Files.zip (1.51 MB)
Was it just you guys or your entire alliance?
The only thing which is special about this log is that to robot battery drops to 8.5 volts at mostly the first half of teleop.
Is there a reason that it stays around 11.5 volts for most of the second half of teleop?
What I can say from just that log file(I’m without the Log-Viewer on this computer, so I’m only covering the photo you attached), is that perhaps, you should try using new batteries, fully-charged.
Starting a match with 12.8 volts was unacceptable this year for us, we used 4 CIMs for the drive-train and 2 CIMs for the shooter, obviously very battery-consuming. If we had started a match with a too low battery it just would not be able to reach the right speed for the shooter wheels.
Your communication looks fine as far as trip time and missed packets.
I noticed from your code that you are using CAN. Is it possible that you have a bad cable or terminator that is causing issues after a little while in the match (maybe after getting jostled)? It looks like you could switch to using PWM fairly easily to test.