-
Couldn't load subscription status.
- Fork 2.6k
Add parameter to specify number of rerenders after environment reset #3818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0cf11d6
ae0b64a
0b09800
5228332
90f521e
1a0e725
4de3256
e865f81
fe5d986
d29049b
cb80cc1
01506bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,6 +222,22 @@ class DirectRLEnvCfg: | |
| to reflect the latest states from the reset. This comes at a cost of performance as an additional render | ||
| step will be performed after each time an environment is reset. | ||
|
|
||
| .. deprecated:: 0.47.2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. syntax: blank line after deprecated directive prevents proper rendering in documentation - should be removed |
||
| This attribute is deprecated and will be removed in the future. Please use | ||
| :attr:`num_rerenders_on_reset` instead. | ||
|
|
||
| To get the same behaviour as setting this parameter to ``True`` or ``False``, set | ||
| :attr:`num_rerenders_on_reset` to 1 or 0, respectively. | ||
| """ | ||
|
|
||
| num_rerenders_on_reset: int = 0 | ||
| """Number of render steps to perform after reset. Defaults to 0, which means no render step will be performed after reset. | ||
|
|
||
| * When this is 0, no render step will be performed after reset. Data collected from sensors after performing reset will be stale and will not reflect the | ||
| latest states in simulation caused by the reset. | ||
| * When this is greater than 0, the specified number of extra render steps will be performed to update the sensor data | ||
| to reflect the latest states from the reset. This comes at a cost of performance as additional render | ||
| steps will be performed after each time an environment is reset. | ||
| """ | ||
|
|
||
| wait_for_textures: bool = True | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
|
|
||
| import builtins | ||
| import torch | ||
| import warnings | ||
| from collections.abc import Sequence | ||
| from typing import Any | ||
|
|
||
|
|
@@ -190,6 +191,16 @@ def __init__(self, cfg: ManagerBasedEnvCfg): | |
| if self.cfg.export_io_descriptors: | ||
| self.export_IO_descriptors() | ||
|
|
||
| # show deprecation message for rerender_on_reset | ||
| if self.cfg.rerender_on_reset: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can throw the warning and then internally set the variable |
||
| warnings.warn( | ||
| "\033[93m\033[1m[DEPRECATION WARNING] ManagerBasedEnvCfg.rerender_on_reset is deprecated. Use" | ||
| " ManagerBasedEnvCfg.num_rerenders_on_reset instead.\033[0m", | ||
| FutureWarning, | ||
| stacklevel=2, | ||
| ) | ||
| self.cfg.num_rerenders_on_reset = 1 | ||
|
Comment on lines
+195
to
+202
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: deprecation warning check executes unconditionally on every init rather than only when the deprecated parameter is actually used (should check truthiness before setting to 1). Should the assignment |
||
|
|
||
| def __del__(self): | ||
| """Cleanup for the environment.""" | ||
| self.close() | ||
|
|
@@ -353,8 +364,9 @@ def reset( | |
| self.scene.write_data_to_sim() | ||
| self.sim.forward() | ||
| # if sensors are added to the scene, make sure we render to reflect changes in reset | ||
| if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset: | ||
| self.sim.render() | ||
| if self.sim.has_rtx_sensors() and self.cfg.num_rerenders_on_reset > 0: | ||
| for _ in range(self.cfg.num_rerenders_on_reset): | ||
| self.sim.render() | ||
|
Comment on lines
+367
to
+369
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: render loop could be inefficient if |
||
|
|
||
| # trigger recorder terms for post-reset calls | ||
| self.recorder_manager.record_post_reset(env_ids) | ||
|
|
@@ -413,8 +425,9 @@ def reset_to( | |
| self.sim.forward() | ||
|
|
||
| # if sensors are added to the scene, make sure we render to reflect changes in reset | ||
| if self.sim.has_rtx_sensors() and self.cfg.rerender_on_reset: | ||
| self.sim.render() | ||
| if self.sim.has_rtx_sensors() and self.cfg.num_rerenders_on_reset > 0: | ||
| for _ in range(self.cfg.num_rerenders_on_reset): | ||
| self.sim.render() | ||
|
|
||
| # trigger recorder terms for post-reset calls | ||
| self.recorder_manager.record_post_reset(env_ids) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,22 @@ class ManagerBasedEnvCfg: | |
| to reflect the latest states from the reset. This comes at a cost of performance as an additional render | ||
| step will be performed after each time an environment is reset. | ||
|
|
||
| .. deprecated:: 0.47.2 | ||
| This attribute is deprecated and will be removed in the future. Please use | ||
| :attr:`num_rerenders_on_reset` instead. | ||
|
|
||
| To get the same behaviour as setting this parameter to ``True`` or ``False``, set | ||
| :attr:`num_rerenders_on_reset` to 1 or 0, respectively. | ||
| """ | ||
|
|
||
| num_rerenders_on_reset: int = 0 | ||
| """Number of render steps to perform after reset. Defaults to 0, which means no render step will be performed after reset. | ||
|
|
||
| * When this is 0, no render step will be performed after reset. Data collected from sensors after performing reset will be stale and will not reflect the | ||
| latest states in simulation caused by the reset. | ||
| * When this is greater than 0, the specified number of extra render steps will be performed to update the sensor data | ||
| to reflect the latest states from the reset. This comes at a cost of performance as additional render | ||
| steps will be performed after each time an environment is reset. | ||
| """ | ||
|
Comment on lines
+126
to
134
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding validation to ensure |
||
|
|
||
| wait_for_textures: bool = True | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| Changelog | ||
| --------- | ||
|
|
||
| 0.11.2 (2025-10-23) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. syntax: Date is in the future (2025-10-23) - should likely be 2024-10-23 |
||
| ~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Changed | ||
| ^^^^^^^ | ||
|
|
||
| * Changed to use of ``num_rerenders_on_reset`` and ``DLAA`` in visuomotor imitation learning environments. | ||
|
|
||
|
|
||
| 0.11.1 (2025-09-24) | ||
| ~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: date format is MM-DD instead of YYYY-MM-DD - should be 2025-01-23 not 2025-10-23 based on the pattern in the file (version 0.47.1 is dated 2025-10-17, and versions progress chronologically)