Skip to content

Conversation

@wowthecoder
Copy link
Contributor

Added the following tests:
single_robot_static_obstacle_test.py

  1. Go straight to the target without any obstacles
  2. One obstacle in the middle
  3. Three obstacles in a slanted line
  4. Six obstacles in a pyramid shape

single_robot_moving_obstacle_test.py
5,6,7. Multiple obstacles oscillating horizontally or vertically between start and end positions

random_movement_test.py
8. 6 robots of the same team moving around randomly in a half court

multiple_robots_test.py
9. Mirror charge head on: 6 robots on each side of the pitch in mirror positions, target is their mirror counterpart's starting position
10. Diagonal charge: 4 robots one on each corner of a square area, try to go to the opposite corner via the main diagonal

Copilot AI review requested due to automatic review settings November 26, 2025 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive motion planning tests for robot navigation and collision avoidance across various scenarios. The tests validate single-robot and multi-robot navigation with both static and dynamic obstacles using different control schemes (DWA and PID).

  • Implements test strategies for simple navigation, random movement, oscillating obstacles, and multi-robot coordination
  • Adds test cases covering scenarios from basic straight-line movement to complex multi-robot collision avoidance
  • Extends StrategyRunner to support separate control schemes for opponent robots in testing scenarios

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 32 comments.

Show a summary per file
File Description
utama_core/tests/motion_planning/strategies/simple_navigation_strategy.py Implements basic navigation behavior for moving a robot to a fixed target position
utama_core/tests/motion_planning/strategies/random_movement_strategy.py Implements random movement behavior for testing collision avoidance with multiple robots moving to random targets
utama_core/tests/motion_planning/strategies/oscillating_obstacle_strategy.py Implements oscillating obstacle behavior for testing dynamic obstacle avoidance
utama_core/tests/motion_planning/strategies/multi_robot_navigation_strategy.py Implements strategy for controlling multiple robots, each navigating to their own target
utama_core/tests/motion_planning/single_robot_static_obstacle_test.py Tests single robot navigation with static obstacles in various configurations
utama_core/tests/motion_planning/single_robot_moving_obstacle_test.py Tests single robot navigation avoiding moving/oscillating obstacles
utama_core/tests/motion_planning/random_movement_test.py Tests collision avoidance with 6 robots moving randomly within bounded area
utama_core/tests/motion_planning/multiple_robots_test.py Tests multi-robot scenarios including mirror charge and diagonal crossing
utama_core/run/strategy_runner.py Adds support for separate opponent control scheme to enable independent motion control in tests
Comments suppressed due to low confidence (10)

utama_core/tests/motion_planning/strategies/multi_robot_navigation_strategy.py:7

  • Import of 'Vector2D' is not used.
from utama_core.entities.data.vector import Vector2D

utama_core/tests/motion_planning/strategies/multi_robot_navigation_strategy.py:9

  • Import of 'move' is not used.
from utama_core.skills.src.utils.move_utils import move

utama_core/tests/motion_planning/multiple_robots_test.py:8

  • Import of 'LEFT_START_ONE' is not used.
    Import of 'RIGHT_START_ONE' is not used.
from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE

utama_core/tests/motion_planning/multiple_robots_test.py:15

  • Import of 'map_friendly_enemy_to_colors' is not used.
    Import of 'map_left_right_to_colors' is not used.
from utama_core.global_utils.mapping_utils import (
    map_friendly_enemy_to_colors,
    map_left_right_to_colors,
)

utama_core/tests/motion_planning/strategies/random_movement_strategy.py:4

  • Import of 'time' is not used.
import time

utama_core/tests/motion_planning/strategies/random_movement_strategy.py:5

  • Import of 'Dict' is not used.
from typing import Dict, Optional, Tuple

utama_core/tests/motion_planning/random_movement_test.py:8

  • Import of 'LEFT_START_ONE' is not used.
    Import of 'RIGHT_START_ONE' is not used.
from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE

utama_core/tests/motion_planning/random_movement_test.py:15

  • Import of 'map_friendly_enemy_to_colors' is not used.
    Import of 'map_left_right_to_colors' is not used.
from utama_core.global_utils.mapping_utils import (
    map_friendly_enemy_to_colors,
    map_left_right_to_colors,
)

utama_core/tests/motion_planning/strategies/simple_navigation_strategy.py:5

  • Import of 'np' is not used.
import numpy as np

utama_core/tests/motion_planning/strategies/simple_navigation_strategy.py:7

  • Import of 'Sequence' is not used.
from py_trees.composites import Sequence

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""Strategy for random movement within bounded area."""

import random
import time
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import. time is imported but never used in this file.

Suggested change
import time

Copilot uses AI. Check for mistakes.
field_bounds: FieldBounds = Field.full_field_bounds,
opp_strategy: Optional[AbstractStrategy] = None,
control_scheme: str = "pid",
opp_control_scheme: Optional[str] = None, # For testing
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Unclear inline comment. The comment "For testing" is too vague. Consider making it more descriptive, e.g., "Optional separate control scheme for opponent (used in testing to avoid obstacle avoidance interference)".

Suggested change
opp_control_scheme: Optional[str] = None, # For testing
opp_control_scheme: Optional[str] = None, # Optional separate control scheme for opponent (used in testing to avoid obstacle avoidance interference)

Copilot uses AI. Check for mistakes.

import pytest

from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports. LEFT_START_ONE and RIGHT_START_ONE are imported but never used in this file.

Suggested change
from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE
# from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +15
from utama_core.global_utils.mapping_utils import (
map_friendly_enemy_to_colors,
map_left_right_to_colors,
)
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused imports. map_friendly_enemy_to_colors and map_left_right_to_colors are imported but never used in this file.

Suggested change
from utama_core.global_utils.mapping_utils import (
map_friendly_enemy_to_colors,
map_left_right_to_colors,
)
# from utama_core.global_utils.mapping_utils import (
# map_friendly_enemy_to_colors,
# map_left_right_to_colors,
# )

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +39
class MirrorChargeConfig:
"""Configuration for mirror positions where teams charge at each other."""

positions: list[tuple[float, float]] # Positions for one team (left side)
collision_threshold: float = ROBOT_RADIUS * 2.0
endpoint_tolerance: float = 0.2


@dataclass
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused class. MirrorChargeConfig is defined but never used in this file. Consider removing it or using it in the test_mirror_charge_head_on test instead of MultiRobotScenario.

Suggested change
class MirrorChargeConfig:
"""Configuration for mirror positions where teams charge at each other."""
positions: list[tuple[float, float]] # Positions for one team (left side)
collision_threshold: float = ROBOT_RADIUS * 2.0
endpoint_tolerance: float = 0.2
@dataclass

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +58
y_robots, b_robots = map_friendly_enemy_to_colors(
game.my_team_is_yellow, game.friendly_robots, game.enemy_robots
)
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable b_robots is not used.

Suggested change
y_robots, b_robots = map_friendly_enemy_to_colors(
game.my_team_is_yellow, game.friendly_robots, game.enemy_robots
)

Copilot uses AI. Check for mistakes.
from utama_core.entities.data.vector import Vector2D
from utama_core.entities.game.field import FieldBounds
from utama_core.skills.src.utils.move_utils import move
from utama_core.strategy.common.abstract_behaviour import AbstractBehaviour
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'AbstractBehaviour' is not used.

Suggested change
from utama_core.strategy.common.abstract_behaviour import AbstractBehaviour

Copilot uses AI. Check for mistakes.
"""Tests for multiple robots collision avoidance scenarios."""

import os
from dataclasses import dataclass, field
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'field' is not used.

Suggested change
from dataclasses import dataclass, field
from dataclasses import dataclass

Copilot uses AI. Check for mistakes.
import os
from dataclasses import dataclass, field

import pytest
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'pytest' is not used.

Suggested change
import pytest

Copilot uses AI. Check for mistakes.
import os
from dataclasses import dataclass

import pytest
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'pytest' is not used.

Suggested change
import pytest

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 2, 2025 20:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants