Open rakrakon opened 2 months ago
First, great issue! Well written.
To your question, this might be a problem, although I believe some optimizations are in place: IIRC, AdvantageKit won't log again values which haven't changed, and Talon FX code won't send an additional command if the command didn't change. A few years back it was problematic to not send a command in every loop (the watchdog would kick in and disable the motor for safety reasons) but I believe this is not a problem nowadays.
You can always open VisualVM and compare the performance.
Note also that instead of using until
we'll need to run a waitUntil
after the command because it'll end immediately.
Do some testing and report back! 😃
Issue Description
In many places in our codebase, the
setAngle
function or similiar set functions are implemented like this:Use of
run { ... }
in CommandsThe
run { ... }
construct creates aRunCommand
, which repeatedly executes the specified action in every cycle until the command ends. This continuous execution may lead to our Command Scheduler overruns.Fix:
runOnce { ... }
By doing so i believe we will no longer have overruns.@katzuv Please correct me if I misread documentation or am missing something here.