Skip to content
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

Adds gym.Env to DirectMARLEnv for Gymnasium v1.0.0 #1446

Merged
merged 4 commits into from
Dec 2, 2024
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
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.lab/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.27.15"
version = "0.27.16"

# Description
title = "Isaac Lab framework for Robot Learning"
Expand Down
9 changes: 9 additions & 0 deletions source/extensions/omni.isaac.lab/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
---------

0.27.16 (2024-11-21)
~~~~~~~~~~~~~~~~~~~~

Changed
^^^^^^^

* Changed :class:`omni.isaac.lab.envs.DirectMARLEnv` to inherit from ``Gymnasium.Env`` due to requirement from Gymnasium v1.0.0 requiring all environments to be a subclass of ``Gymnasium.Env`` when using the ``make`` interface.


0.27.15 (2024-11-09)
~~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from .utils.spaces import sample_space, spec_to_gym_space


class DirectMARLEnv:
class DirectMARLEnv(gym.Env):
"""The superclass for the direct workflow to design multi-agent environments.

This class implements the core functionality for multi-agent reinforcement learning (MARL)
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.lab/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# devices
"hidapi",
# reinforcement learning
"gymnasium==0.29.0",
"gymnasium",
# procedural-generation
"trimesh",
"pyglet<2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def _check_random_actions(self, task_name: str, device: str, num_envs: int, num_
with torch.inference_mode():
for _ in range(num_steps):
# sample actions according to the defined space
actions = sample_space(env.single_action_space, device=env.unwrapped.device, batch_size=num_envs)
actions = sample_space(
env.unwrapped.single_action_space, device=env.unwrapped.device, batch_size=num_envs
)
# apply actions
transition = env.step(actions)
# check signals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _check_random_actions(self, task_name: str, device: str, num_envs: int, num_

# this flag is necessary to prevent a bug where the simulation gets stuck randomly when running the
# test on many environments.
env.sim.set_setting("/physics/cooking/ujitsoCollisionCooking", False)
env.unwrapped.sim.set_setting("/physics/cooking/ujitsoCollisionCooking", False)

# reset environment
obs, _ = env.reset()
Expand All @@ -116,7 +116,9 @@ def _check_random_actions(self, task_name: str, device: str, num_envs: int, num_
for _ in range(num_steps):
# sample actions according to the defined space
actions = {
agent: sample_space(env.action_spaces[agent], device=env.unwrapped.device, batch_size=num_envs)
agent: sample_space(
env.unwrapped.action_spaces[agent], device=env.unwrapped.device, batch_size=num_envs
)
for agent in env.unwrapped.possible_agents
}
# apply actions
Expand Down