Repository navigation
Stop partial resets from adding tracking error to other envs' metrics - #1310
Open
Chr0mium24 wants to merge 1 commit into
Open
Chr0mium24 wants to merge 1 commit into
Chr0mium24 wants to merge 1 commit into
Conversation
reset(env_ids=...) calls command_manager.compute(dt=0.0, env_ids=env_ids), which limits timer and command updates to the reset envs but still refreshes metrics for every env. UniformVelocityCommand accumulates error_vel_xy and error_vel_yaw as running sums, so each partial reset added one more step of tracking error to every env it did not reset. In an auto_reset=False loop that resets finished envs after each step, this counts an extra step for the other envs whenever any env finishes. Move the accumulation into _accumulate_metrics(env_ids), called from compute() next to _integrate_command, so the reset path only touches the reset envs. The base class is unchanged because the other command terms assign their metrics rather than accumulate them.
Chr0mium24
force-pushed
the
fix/twist-metrics
branch
from
November 13, 2026 14:06
d142bea to
7327603
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reset(env_ids=...)callscommand_manager.compute(dt=0.0, env_ids=env_ids). Since #1139 that call limits timers and command updates to the reset envs, butCommandTerm.computestill calls_update_metrics()for every env. Most command terms assign their metrics, so the extra refresh is harmless, butUniformVelocityCommandaccumulateserror_vel_xyanderror_vel_yawwith+=, so each partial reset adds one more step of tracking error to every env it did not reset.To reproduce: Go1 flat with
auto_reset=False, step 10 times, thenreset(env_ids=[0]). env 1'serror_vel_xygoes from 0.03560 to 0.03903 although env 1 was not reset (itstime_leftis unchanged, as fixed in #1139). In a loop that resets finished envs after each step, every step in which some env finishes counts twice for all the others.The fix moves the accumulation into a new
_accumulate_metrics(env_ids)called fromcompute()next to_integrate_command, so the reset path only touches the reset envs. I left the base class alone because the other command terms assign their metrics; if you would rather scope_update_metricsbyenv_idsinCommandTermitself, I'm happy to change it that way.test_partial_reset_does_not_accumulate_other_envs_metricsfails on main and passes with the fix; the fast suite passes and ruff, ty and pyright are clean. A changelog entry is included.