-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Split Direct MARL space and lifecycle tests #6574
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
Open
nvsekkin
wants to merge
11
commits into
isaac-sim:develop
Choose a base branch
from
nvsekkin:esekkin/direct-marl-test-split
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+73
−52
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
926a753
test: Split Direct MARL space coverage
nvsekkin 181dbf0
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin e980721
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin 812401d
test: Clarify Direct MARL space stub
nvsekkin cd2b595
chore: Describe Direct MARL test-only change
nvsekkin 207c272
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin cf04412
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin f88c539
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin 100c5e2
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin 9ccd145
test: Rename Direct MARL unit test module
nvsekkin 1a46b99
Merge branch 'develop' into esekkin/direct-marl-test-split
nvsekkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Test-only change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| # ignore private usage of variables warning | ||
| # pyright: reportPrivateUsage=none | ||
|
|
||
| """Unit tests for direct multi-agent environment space construction.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from types import SimpleNamespace | ||
|
|
||
| import gymnasium as gym | ||
| import pytest | ||
|
|
||
| from isaaclab.envs import DirectMARLEnv | ||
| from isaaclab.test.env_cfgs import make_empty_direct_marl_env_cfg | ||
|
|
||
| pytestmark = pytest.mark.unit | ||
|
|
||
|
|
||
| def test_agent_and_space_configuration(): | ||
| """Agent counts and spaces are configured without initializing the simulator.""" | ||
| env = object.__new__(DirectMARLEnv) | ||
| env._is_closed = True | ||
| env.cfg = make_empty_direct_marl_env_cfg(device="cpu") | ||
| env.scene = SimpleNamespace(num_envs=env.cfg.scene.num_envs) | ||
| env.sim = SimpleNamespace(device=env.cfg.sim.device) | ||
|
|
||
| env._configure_env_spaces() | ||
|
nvsekkin marked this conversation as resolved.
Outdated
|
||
|
|
||
| assert env.agents == ["agent_0", "agent_1"] | ||
| assert env.possible_agents == ["agent_0", "agent_1"] | ||
| assert env.num_agents == 2 | ||
| assert env.max_num_agents == 2 | ||
| assert len(env.observation_spaces) == 2 | ||
| assert len(env.action_spaces) == 2 | ||
| assert all(isinstance(space, gym.spaces.Box) for space in env.observation_spaces.values()) | ||
| assert all(isinstance(space, gym.spaces.Box) for space in env.action_spaces.values()) | ||
| assert env.observation_spaces["agent_0"].shape == (3,) | ||
| assert env.observation_spaces["agent_1"].shape == (4,) | ||
| assert env.action_spaces["agent_0"].shape == (1,) | ||
| assert env.action_spaces["agent_1"].shape == (2,) | ||
| assert isinstance(env.state_space, gym.spaces.Box) | ||
| assert env.state_space.shape == (7,) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.