I’m looking for general tips on how to improve control loop speed.
We were having overrun issues, I’ve mostly tuned that down by changing the rate we poll can devices. Now it looks pretty good but occasionally spikes up above 20ms.
Is this an example of improvements of the Command Based Styler vs say Time Based?
each of our subsystems (intake, shooter, climber) has a periodic function that runs every single time. often time that means nothing other than looking at an enum, and calling a .set( on the TalonSRX, or a phoenix 6 control request
It seems like some of the command based stuff is a little faster. I’m at a loss for how more people don’t have issues with this.
Frustrating this is on windows it completes each periodic loop so fast!
One thing to double-check is if you are creating unnecessary objects. The more objects you have floating, the more work the GC does, halting robot code temporarily and potentially causing overruns. I saw my loop times go down after removing many single-use object instances in periodic loops.
I’ve used VisualVM on non-roboRIO projects and it was extremely helpful to find my inadvertent hot spots. Looks like easy setup for the roboRIO. VisualVM
Not directly, but using the Command framework can help write code that doesn’t waste compute cycles by ensuring that each robot subsystem is only trying to do one thing at any one time.
It can also not help you with this if you don’t use it right, though. It’s not a magic bullet.