Skip to content

Commit fc6042f

Browse files
Fixes order of logging metrics and sampling commands in command manager (#1352)
# Description In the command manager, we were logging the metrics after resampling the commands. This leads to incorrect logging of metrics when inside the `resample` call, the metrics tensors get reset. This MR fixes the order to make sure the bug doesn't happen. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyg@nvidia.com> Co-authored-by: Kelly Guo <kellyguo123@hotmail.com>
1 parent fe976d7 commit fc6042f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

source/extensions/omni.isaac.lab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.29.2"
4+
version = "0.29.3"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/extensions/omni.isaac.lab/docs/CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
---------
33

4+
0.29.3 (2024-12-16)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Fixed
8+
^^^^^
9+
10+
* Fixed ordering of logging and resamping in the command manager, where we were logging the metrics after resampling the commands. This leads to incorrect logging of metrics when inside the resample call, the metrics tensors get reset.
11+
12+
413
0.29.2 (2024-12-16)
514
~~~~~~~~~~~~~~~~~~~
615

source/extensions/omni.isaac.lab/omni/isaac/lab/managers/command_manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,20 @@ def reset(self, env_ids: Sequence[int] | None = None) -> dict[str, float]:
132132
# resolve the environment IDs
133133
if env_ids is None:
134134
env_ids = slice(None)
135-
# set the command counter to zero
136-
self.command_counter[env_ids] = 0
137-
# resample the command
138-
self._resample(env_ids)
135+
139136
# add logging metrics
140137
extras = {}
141138
for metric_name, metric_value in self.metrics.items():
142139
# compute the mean metric value
143140
extras[metric_name] = torch.mean(metric_value[env_ids]).item()
144141
# reset the metric value
145142
metric_value[env_ids] = 0.0
143+
144+
# set the command counter to zero
145+
self.command_counter[env_ids] = 0
146+
# resample the command
147+
self._resample(env_ids)
148+
146149
return extras
147150

148151
def compute(self, dt: float):
@@ -175,8 +178,8 @@ def _resample(self, env_ids: Sequence[int]):
175178
Args:
176179
env_ids: The list of environment IDs to resample.
177180
"""
178-
# resample the time left before resampling
179181
if len(env_ids) != 0:
182+
# resample the time left before resampling
180183
self.time_left[env_ids] = self.time_left[env_ids].uniform_(*self.cfg.resampling_time_range)
181184
# increment the command counter
182185
self.command_counter[env_ids] += 1

0 commit comments

Comments
 (0)