Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Guidelines for modifications:
* Ryley McCarroll
* Shafeef Omar
* Shundo Kishi
* Stefan Van de Mosselaer
* Stephan Pleines
* Tyler Lum
* Victor Khaustov
Expand Down
2 changes: 1 addition & 1 deletion source/isaaclab/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.40.0"
version = "0.40.1"


# Description
Expand Down
15 changes: 15 additions & 0 deletions source/isaaclab/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Changelog
---------

0.40.1 (2025-06-02)
~~~~~~~~~~~~~~~~~~~

Added
^^^^^
* Added time observation functions to ~isaaclab.envs.mdp.observations module,
:func:`~isaaclab.envs.mdp.observations.current_time_s` and :func:`~isaaclab.envs.mdp.observations.remaining_time_s`.

Changed
^^^^^^^

* Moved initialization of ``episode_length_buf`` outside of :meth:`load_managers()` of :class:`~isaaclab.envs.ManagerBasedRLEnv`
to make it available for mdp functions.


0.40.0 (2025-05-16)
~~~~~~~~~~~~~~~~~~~

Expand Down
5 changes: 3 additions & 2 deletions source/isaaclab/isaaclab/envs/manager_based_rl_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ def __init__(self, cfg: ManagerBasedRLEnvCfg, render_mode: str | None = None, **
# -- counter for curriculum
self.common_step_counter = 0

# initialize the episode length buffer BEFORE loading the managers to use it in mdp functions.
self.episode_length_buf = torch.zeros(cfg.scene.num_envs, device=cfg.sim.device, dtype=torch.long)

# initialize the base class to setup the scene.
super().__init__(cfg=cfg)
# store the render mode
self.render_mode = render_mode

# initialize data and constants
# -- init buffers
self.episode_length_buf = torch.zeros(self.num_envs, device=self.device, dtype=torch.long)
# -- set the framerate of the gym video recorder wrapper so that the playback speed of the produced video matches the simulation
self.metadata["render_fps"] = 1 / self.step_dt

Expand Down
15 changes: 15 additions & 0 deletions source/isaaclab/isaaclab/envs/mdp/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,18 @@ def last_action(env: ManagerBasedEnv, action_name: str | None = None) -> torch.T
def generated_commands(env: ManagerBasedRLEnv, command_name: str) -> torch.Tensor:
"""The generated command from command term in the command manager with the given name."""
return env.command_manager.get_command(command_name)


"""
Time.
"""


def current_time_s(env: ManagerBasedRLEnv) -> torch.Tensor:
"""The current time in the episode (in seconds)."""
return env.episode_length_buf.unsqueeze(1) * env.step_dt


def remaining_time_s(env: ManagerBasedRLEnv) -> torch.Tensor:
"""The maximum time remaining in the episode (in seconds)."""
return env.max_episode_length_s - env.episode_length_buf.unsqueeze(1) * env.step_dt