Unverified Commit ecf551f8 authored by James Tigue's avatar James Tigue Committed by GitHub

Adds scene update to MARL envs (#1865)

# Description

This adds scene update to MARL Direct Envs mirroring the changes in [PR
1809](https://github.com/isaac-sim/IsaacLab/pull/1809) for
ManagerBasedEnv and DirectRLEnv.

## 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
parent 4c4377db
......@@ -17,7 +17,8 @@ Fixed
Fixed
^^^^^
* Fixed Imu sensor based observations at first step by updating scene during :meth:`~isaaclab.envs.ManagerBasedEnv.init`
* Fixed Imu sensor based observations at first step by updating scene during initialization for
:class:`~isaaclab.envs.ManagerBasedEnv`, :class:`~isaaclab.envs.DirectRLEnv`, and :class:`~isaaclab.envs.DirectMARLEnv`
0.33.16 (2025-02-09)
......
......@@ -133,6 +133,10 @@ class DirectMARLEnv(gym.Env):
print("[INFO]: Starting the simulation. This may take a few seconds. Please wait...")
with Timer("[INFO]: Time taken for simulation start", "simulation_start"):
self.sim.reset()
# update scene to pre populate data buffers for assets and sensors.
# this is needed for the observation manager to get valid tensors for initialization.
# this shouldn't cause an issue since later on, users do a reset over all the environments so the lazy buffers would be reset.
self.scene.update(dt=self.physics_dt)
# -- event manager used for randomization
if self.cfg.events:
......
......@@ -139,6 +139,9 @@ class DirectRLEnv(gym.Env):
print("[INFO]: Starting the simulation. This may take a few seconds. Please wait...")
with Timer("[INFO]: Time taken for simulation start", "simulation_start"):
self.sim.reset()
# update scene to pre populate data buffers for assets and sensors.
# this is needed for the observation manager to get valid tensors for initialization.
# this shouldn't cause an issue since later on, users do a reset over all the environments so the lazy buffers would be reset.
self.scene.update(dt=self.physics_dt)
# -- event manager used for randomization
......
......@@ -139,8 +139,11 @@ class ManagerBasedEnv:
print("[INFO]: Starting the simulation. This may take a few seconds. Please wait...")
with Timer("[INFO]: Time taken for simulation start", "simulation_start"):
self.sim.reset()
# add timeline event to load managers
# update scene to pre populate data buffers for assets and sensors.
# this is needed for the observation manager to get valid tensors for initialization.
# this shouldn't cause an issue since later on, users do a reset over all the environments so the lazy buffers would be reset.
self.scene.update(dt=self.physics_dt)
# add timeline event to load managers
self.load_managers()
# make sure torch is running on the correct device
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment