-
Notifications
You must be signed in to change notification settings - Fork 0
Motion planning tests #76
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
base: main
Are you sure you want to change the base?
Conversation
it runs in sim but the robots are undergoing brownian motion
…oller for opponents for testing
There was a problem hiding this 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
StrategyRunnerto 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 |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| import time |
| field_bounds: FieldBounds = Field.full_field_bounds, | ||
| opp_strategy: Optional[AbstractStrategy] = None, | ||
| control_scheme: str = "pid", | ||
| opp_control_scheme: Optional[str] = None, # For testing |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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)".
| 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) |
|
|
||
| import pytest | ||
|
|
||
| from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE | |
| # from utama_core.config.formations import LEFT_START_ONE, RIGHT_START_ONE |
| from utama_core.global_utils.mapping_utils import ( | ||
| map_friendly_enemy_to_colors, | ||
| map_left_right_to_colors, | ||
| ) |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| 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, | |
| # ) |
| 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
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| 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 |
| y_robots, b_robots = map_friendly_enemy_to_colors( | ||
| game.my_team_is_yellow, game.friendly_robots, game.enemy_robots | ||
| ) |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| y_robots, b_robots = map_friendly_enemy_to_colors( | |
| game.my_team_is_yellow, game.friendly_robots, game.enemy_robots | |
| ) |
| 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 |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| from utama_core.strategy.common.abstract_behaviour import AbstractBehaviour |
| """Tests for multiple robots collision avoidance scenarios.""" | ||
|
|
||
| import os | ||
| from dataclasses import dataclass, field |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| from dataclasses import dataclass, field | |
| from dataclasses import dataclass |
| import os | ||
| from dataclasses import dataclass, field | ||
|
|
||
| import pytest |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| import pytest |
| import os | ||
| from dataclasses import dataclass | ||
|
|
||
| import pytest |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
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.
| import pytest |
There was a problem hiding this 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.
Added the following tests:
single_robot_static_obstacle_test.pysingle_robot_moving_obstacle_test.py5,6,7. Multiple obstacles oscillating horizontally or vertically between start and end positions
random_movement_test.py8. 6 robots of the same team moving around randomly in a half court
multiple_robots_test.py9. 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