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

[Feature] More VMAS tasks #88

Merged
merged 14 commits into from
Jun 10, 2024
8 changes: 8 additions & 0 deletions benchmarl/conf/task/vmas/ball_passage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defaults:
- _self_
- vmas_ball_passage_config

max_steps: 500
n_passages: 1
fixed_passage: False
random_start_angle: True
6 changes: 6 additions & 0 deletions benchmarl/conf/task/vmas/ball_trajectory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defaults:
- _self_
- vmas_ball_trajectory_config

max_steps: 100
joints: True
7 changes: 7 additions & 0 deletions benchmarl/conf/task/vmas/buzz_wire.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defaults:
- _self_
- vmas_buzz_wire_config

max_steps: 100
random_start_angle: True
collision_reward: -10
12 changes: 12 additions & 0 deletions benchmarl/conf/task/vmas/discovery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defaults:
- _self_
- vmas_discovery_config

max_steps: 100
n_agents: 5
n_targets: 7
lidar_range: 0.35
covering_range: 0.25
agents_per_target: 2
targets_respawn: True
shared_reward: True
8 changes: 8 additions & 0 deletions benchmarl/conf/task/vmas/flocking.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defaults:
- _self_
- vmas_flocking_config

max_steps: 100
n_agents: 4
n_targets: 5
collision_reward: -0.1
14 changes: 14 additions & 0 deletions benchmarl/conf/task/vmas/joint_passage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defaults:
- _self_
- vmas_joint_passage_config

max_steps: 500
n_passages: 1
fixed_passage: True
joint_length: 0.5
random_start_angle: True
random_goal_angle: True
observe_joint_angle: False
asym_package: True
mass_ratio: 5
mass_position: 0.75
10 changes: 10 additions & 0 deletions benchmarl/conf/task/vmas/joint_passage_size.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
- _self_
- vmas_joint_passage_size_config

max_steps: 500
n_passages: 3
fixed_passage: False
random_start_angle: False
random_goal_angle: False
observe_joint_angle: False
6 changes: 6 additions & 0 deletions benchmarl/conf/task/vmas/multi_give_way.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defaults:
- _self_
- vmas_multi_give_way_config

max_steps: 200
agent_collision_penalty: -0.1
7 changes: 7 additions & 0 deletions benchmarl/conf/task/vmas/passage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defaults:
- _self_
- vmas_passage_config

max_steps: 500
n_passages: 1
shared_reward: True
23 changes: 20 additions & 3 deletions benchmarl/environments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


from .pettingzoo.multiwalker import TaskConfig as MultiwalkerConfig
from .pettingzoo.simple_adverasary import TaskConfig as SimpleAdversaryConfig
from .pettingzoo.simple_adversary import TaskConfig as SimpleAdversaryConfig
from .pettingzoo.simple_crypto import TaskConfig as SimpleCryptoConfig
from .pettingzoo.simple_push import TaskConfig as SimplePushConfig
from .pettingzoo.simple_reference import TaskConfig as SimpleReferenceConfig
Expand All @@ -34,13 +34,22 @@
from .pettingzoo.waterworld import TaskConfig as WaterworldConfig

from .vmas.balance import TaskConfig as BalanceConfig
from .vmas.ball_passage import TaskConfig as BallPassageConfig
from .vmas.ball_trajectory import TaskConfig as BallTrajectoryConfig
from .vmas.buzz_wire import TaskConfig as BuzzWireConfig
from .vmas.discovery import TaskConfig as DiscoveryConfig
from .vmas.dispersion import TaskConfig as DispersionConfig
from .vmas.dropout import TaskConfig as DropoutConfig
from .vmas.flocking import TaskConfig as FlockingConfig
from .vmas.give_way import TaskConfig as GiveWayConfig
from .vmas.joint_passage import TaskConfig as JointPassageConfig
from .vmas.joint_passage_size import TaskConfig as JointPassageSizeConfig
from .vmas.multi_give_way import TaskConfig as MultiGiveWayConfig
from .vmas.navigation import TaskConfig as NavigationConfig
from .vmas.passage import TaskConfig as PassageConfig
from .vmas.reverse_transport import TaskConfig as ReverseTransportConfig
from .vmas.sampling import TaskConfig as SamplingConfig
from .vmas.simple_adverasary import TaskConfig as VmasSimpleAdversaryConfig
from .vmas.simple_adversary import TaskConfig as VmasSimpleAdversaryConfig
from .vmas.simple_crypto import TaskConfig as VmasSimpleCryptoConfig
from .vmas.simple_push import TaskConfig as VmasSimplePushConfig
from .vmas.simple_reference import TaskConfig as VmasSimpleReferenceConfig
Expand All @@ -52,7 +61,6 @@
from .vmas.wheel import TaskConfig as WheelConfig
from .vmas.wind_flocking import TaskConfig as WindFlockingConfig


# This is a registry mapping task config schemas names to their python dataclass
# It is used by hydra to validate loaded configs.
# You will see the "envname_taskname_config" strings in the hydra defaults at the top of yaml files.
Expand All @@ -66,8 +74,17 @@
"vmas_wheel_config": WheelConfig,
"vmas_dispersion_config": DispersionConfig,
"vmas_give_way_config": GiveWayConfig,
"vmas_multi_give_way_config": MultiGiveWayConfig,
"vmas_passage_config": PassageConfig,
"vmas_joint_passage_config": JointPassageConfig,
"vmas_joint_passage_size_config": JointPassageSizeConfig,
"vmas_ball_passage_config": BallPassageConfig,
"vmas_buzz_wire_config": BuzzWireConfig,
"vmas_ball_trajectory_config": BallTrajectoryConfig,
"vmas_flocking_config": FlockingConfig,
"vmas_wind_flocking_config": WindFlockingConfig,
"vmas_dropout_config": DropoutConfig,
"vmas_discovery_config": DiscoveryConfig,
"vmas_simple_adversary_config": VmasSimpleAdversaryConfig,
"vmas_simple_crypto_config": VmasSimpleCryptoConfig,
"vmas_simple_push_config": VmasSimplePushConfig,
Expand Down
1 change: 1 addition & 0 deletions benchmarl/environments/pettingzoo/simple_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
class TaskConfig:
task: str = MISSING
max_cycles: int = MISSING
local_ratio: float = MISSING
15 changes: 15 additions & 0 deletions benchmarl/environments/vmas/ball_passage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_passages: int = MISSING
fixed_passage: bool = MISSING
random_start_angle: bool = MISSING
13 changes: 13 additions & 0 deletions benchmarl/environments/vmas/ball_trajectory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
joints: bool = MISSING
14 changes: 14 additions & 0 deletions benchmarl/environments/vmas/buzz_wire.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
random_start_angle: bool = MISSING
collision_reward: float = MISSING
9 changes: 9 additions & 0 deletions benchmarl/environments/vmas/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ class VmasTask(Task):
REVERSE_TRANSPORT = None
WHEEL = None
DISPERSION = None
MULTI_GIVE_WAY = None
DROPOUT = None
GIVE_WAY = None
WIND_FLOCKING = None
PASSAGE = None
JOINT_PASSAGE = None
JOINT_PASSAGE_SIZE = None
BALL_PASSAGE = None
BALL_TRAJECTORY = None
BUZZ_WIRE = None
FLOCKING = None
DISCOVERY = None
SIMPLE_ADVERSARY = None
SIMPLE_CRYPTO = None
SIMPLE_PUSH = None
Expand Down
19 changes: 19 additions & 0 deletions benchmarl/environments/vmas/discovery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_agents: int = MISSING
n_targets: int = MISSING
lidar_range: float = MISSING
covering_range: float = MISSING
agents_per_target: int = MISSING
targets_respawn: bool = MISSING
shared_reward: bool = MISSING
15 changes: 15 additions & 0 deletions benchmarl/environments/vmas/flocking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_agents: int = MISSING
n_targets: int = MISSING
collision_reward: float = MISSING
21 changes: 21 additions & 0 deletions benchmarl/environments/vmas/joint_passage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_passages: int = MISSING
fixed_passage: bool = MISSING
joint_length: float = MISSING
random_start_angle: bool = MISSING
random_goal_angle: bool = MISSING
observe_joint_angle: bool = MISSING
asym_package: bool = MISSING
mass_ratio: float = MISSING
mass_position: float = MISSING
17 changes: 17 additions & 0 deletions benchmarl/environments/vmas/joint_passage_size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_passages: int = MISSING
fixed_passage: bool = MISSING
random_start_angle: bool = MISSING
random_goal_angle: bool = MISSING
observe_joint_angle: bool = MISSING
13 changes: 13 additions & 0 deletions benchmarl/environments/vmas/multi_give_way.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
agent_collision_penalty: float = MISSING
14 changes: 14 additions & 0 deletions benchmarl/environments/vmas/passage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#

from dataclasses import dataclass, MISSING


@dataclass
class TaskConfig:
max_steps: int = MISSING
n_passages: int = MISSING
shared_reward: bool = MISSING
Loading