Skip to content

Commit 73bb583

Browse files
Introduce x_semidim and y_semidim kwargs to selected scenarios (#133)
* Introduce x_semidim and y_semidim parameters for managing environment dimensions * [discovery]introduce x_semidim and y_semidim parameters for managing environment dimensions * [navigation]introduce x_semidim and y_semidim parameters for managing environment dimensions
1 parent ee892d8 commit 73bb583

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

vmas/scenarios/discovery.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Scenario(BaseScenario):
2323
def make_world(self, batch_dim: int, device: torch.device, **kwargs):
2424
self.n_agents = kwargs.pop("n_agents", 5)
2525
self.n_targets = kwargs.pop("n_targets", 7)
26+
self.x_semidim = kwargs.pop("x_semidim", 1)
27+
self.y_semidim = kwargs.pop("y_semidim", 1)
2628
self._min_dist_between_entities = kwargs.pop("min_dist_between_entities", 0.2)
2729
self._lidar_range = kwargs.pop("lidar_range", 0.35)
2830
self._covering_range = kwargs.pop("covering_range", 0.25)
@@ -47,8 +49,8 @@ def make_world(self, batch_dim: int, device: torch.device, **kwargs):
4749
world = World(
4850
batch_dim,
4951
device,
50-
x_semidim=1,
51-
y_semidim=1,
52+
x_semidim=self.x_semidim,
53+
y_semidim=self.y_semidim,
5254
collision_force=500,
5355
substeps=2,
5456
drag=0.25,

vmas/scenarios/navigation.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def make_world(self, batch_dim: int, device: torch.device, **kwargs):
2424
self.n_agents = kwargs.pop("n_agents", 4)
2525
self.collisions = kwargs.pop("collisions", True)
2626

27+
self.x_semidim = kwargs.pop("x_semidim", None)
28+
self.y_semidim = kwargs.pop("y_semidim", None)
29+
2730
self.agents_with_same_goal = kwargs.pop("agents_with_same_goal", 1)
2831
self.split_goals = kwargs.pop("split_goals", False)
2932
self.observe_all_goals = kwargs.pop("observe_all_goals", False)
@@ -58,7 +61,13 @@ def make_world(self, batch_dim: int, device: torch.device, **kwargs):
5861
), "Splitting the goals is allowed when the agents are even and half the team has the same goal"
5962

6063
# Make world
61-
world = World(batch_dim, device, substeps=2)
64+
world = World(
65+
batch_dim,
66+
device,
67+
substeps=2,
68+
x_semidim=self.x_semidim,
69+
y_semidim=self.y_semidim,
70+
)
6271

6372
known_colors = [
6473
(0.22, 0.49, 0.72),

0 commit comments

Comments
 (0)