Multiple Loop Overruns

Hi, a bit late but we’re having a bit of trouble with the performance of our robot. Basically we’ve been getting multiple loop overruns with a minimun usage of SmartDashboard processes or things that may affect the CommandScheduler, we even changed our Vision System to a different Cpu thread to combat this, but still no luck.
What it’s affecting the most it’s the autonomous routines, we suspect that these overruns are causing a big voltage usage making our robot Jittery (Even with batteries with good charge) ruining the routine
image

On TeleOp there doesnt seem to be any type of consequence because of this overruns, but it’s still concerning.

Here’s the github repository of our code:

And some of the errors returned by the DriverStation:

Auton:
Warning at edu.wpi.first.wpilibj.IterativeRobotBase.printLoopOverrunMessage(IterativeRobotBase.java:387): Loop time of 0.02s overrun 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): DriveTrain.periodic(): 0.000377s 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): SmartDashboard.updateValues(): 0.000277s 
Warning at edu.wpi.first.wpilibj.IterativeRobotBase.printLoopOverrunMessage(IterativeRobotBase.java:387): Loop time of 0.02s overrun 
ERROR  1  DifferentialDrive… Output not updated often enough. See Using the WPILib Classes to Drive your Robot — FIRST Robotics Competition documentation for more information.  edu.wpi.first.wpilibj.MotorSafety.check(MotorSafety.java:139) 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): InstantCommand.initialize(): 0.000197s 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): teleopPeriodic(): 0.000833s

TeleOp:
Warning at edu.wpi.first.wpilibj.IterativeRobotBase.printLoopOverrunMessage(IterativeRobotBase.java:387): Loop time of 0.02s overrun 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): InstantCommand.initialize(): 0.000322s 
Warning at edu.wpi.first.wpilibj.Tracer.lambda$printEpochs$0(Tracer.java:62): teleopPeriodic(): 0.000220s

PD: About the motorSafety, were aware of this watchdog feature for differentrialDrive class and we actually use the feed method for our TeleOp and auton Path following command

Can you share the full log files? If you used advantagekit or whatever, the *.wpilog file would do. If not, please share both the *.dslog and *.dsevents files for a specific log entry

1 Like

Yeah, I also can’t offer too much help without the full log files.

Can you give more information about how it is affecting your autonomous? Most errors due to timing can be fixed by making the PID more aggressive or adding a larger lookahead time to any pursuit controllers

Not sure if this will be helpful but we got the “printLoopOverrunMessage” if we used a System.out.print() without adding a new line character in any code that is run in periodic. Basically it was creating a single massively long string instead of one line repeated over and over.
I looked through your code to see if i could find such a line but did not see anything like that as you seem to use only println which removes the need for a new line character…
I might have missed one but would be worth looking into.

Additionaly, printing to the console is a very slow operation. If you have a lot of those, it will slow your code a lot
That may cause your loop overruns

2 Likes

Just don’t print during periodic.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.