Skip to content
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
8 changes: 4 additions & 4 deletions utama_core/config/formations.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def _validate_team_separation(left, right):

def get_formations(
bounds: FieldBounds,
n_left: int,
n_right: int,
n_left: int,
formation_type: FormationType,
Comment thread
energy-in-joles marked this conversation as resolved.
) -> tuple[list[FormationEntry], list[FormationEntry]]:
"""
Expand All @@ -146,13 +146,13 @@ def get_formations(

Args:
bounds: FieldBounds object defining the top-left and bottom-right corners of the field.
n_left: Number of robots on the left team.
n_right: Number of robots on the right team.
n_left: Number of robots on the left team.
formation_type: The type of formation to generate (e.g., START_ONE).

Returns:
tuple[list[FormationEntry], list[FormationEntry]]: A tuple containing two lists of FormationEntry objects.
left and right team formations respectively.
(right, left) team formations respectively.
"""
if n_left > MAX_ROBOTS or n_right > MAX_ROBOTS:
raise ValueError(
Expand All @@ -174,4 +174,4 @@ def get_formations(
_validate_bounds_and_intra_team_collision(right, bounds)
_validate_team_separation(left, right)

return left, right
return right, left
4 changes: 2 additions & 2 deletions utama_core/rsoccer_simulator/src/ssl/envs/standard_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def __init__(
# Makes the implicit assumption of blue on left and yellow on right if formation not given
# This assumption is faulty for normal strats, but it is necessary if rsim is spawned in isolation with no strat context
if blue_starting_formation is None or yellow_starting_formation is None:
self.blue_formation, self.yellow_formation = get_formations(
self.yellow_formation, self.blue_formation = get_formations(
STANDARD_FIELD_DIMS.full_field_bounds,
n_left=n_robots_blue,
n_right=n_robots_yellow,
n_left=n_robots_blue,
formation_type=FormationType.START_ONE,
)

Expand Down
4 changes: 2 additions & 2 deletions utama_core/run/strategy_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ def _load_sim(
if self.mode == Mode.REAL:
return None, None

left_start, right_start = get_formations(
right_start, left_start = get_formations(
bounds=self.field_bounds,
n_left=self.exp_enemy if self.my_team_is_right else self.exp_friendly,
n_right=self.exp_friendly if self.my_team_is_right else self.exp_enemy,
n_left=self.exp_enemy if self.my_team_is_right else self.exp_friendly,
formation_type=FormationType.START_ONE,
)

Expand Down
2 changes: 1 addition & 1 deletion utama_core/strategy/examples/startup_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def generate_starting_positions(is_right_team: bool):
"""
Generate starting and target formations based on team side.
"""
left_formation, right_formation = get_formations(
right_formation, left_formation = get_formations(
STANDARD_FIELD_DIMS.full_field_bounds,
MAX_ROBOTS,
MAX_ROBOTS,
Expand Down
4 changes: 2 additions & 2 deletions utama_core/tests/strategy_runner/test_grsim_sim_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def test_grsim_spawn_positions_and_ball_use_field_bounds_center():

assert isinstance(runner.sim_controller, _FakeGRSimController)

left_start, right_start = get_formations(
right_start, left_start = get_formations(
bounds=bounds,
n_left=exp_friendly,
n_right=exp_enemy,
n_left=exp_friendly,
formation_type=FormationType.START_ONE,
)
expected_yellow, expected_blue = map_left_right_to_colors(
Expand Down
4 changes: 2 additions & 2 deletions utama_core/tests/strategy_runner/test_rsim_formations.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def test_rsim_formation_allocation_and_spawn_positions(
exp_enemy=n_enemy,
)

left_start, right_start = get_formations(
right_start, left_start = get_formations(
bounds=runner.field_bounds,
n_left=n_enemy if team_on_right else n_friendly,
n_right=n_friendly if team_on_right else n_enemy,
n_left=n_enemy if team_on_right else n_friendly,
formation_type=FormationType.START_ONE,
)
expected_yellow, expected_blue = map_left_right_to_colors(
Expand Down
Loading