Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
070e2f8
Move pytest validations to its own directory
nycrat Mar 8, 2026
410f006
Add BUILD
nycrat Mar 8, 2026
8c304fe
Import math
nycrat Mar 8, 2026
d236664
Fix
nycrat Mar 8, 2026
c36740b
Fix
nycrat Mar 8, 2026
d6acb29
Move validation/ to cpp_validation/
nycrat Mar 11, 2026
ab29ff5
Move pytest_validation/ to validation/
nycrat Mar 11, 2026
7bc9b77
Formatting
nycrat Mar 11, 2026
00554dc
Add BUILD
nycrat Mar 11, 2026
1bae6e2
Formatting
nycrat Mar 11, 2026
ced6821
Refactor friendly receives ball slow to be subclass of other validation
nycrat Mar 14, 2026
48d7b1e
Resolve TODO related to delay validation
nycrat Mar 14, 2026
e043d7c
Resolve comment
nycrat Mar 14, 2026
4daf7af
Merge branch 'master' into avah/move_pytests_to_own_directory
nycrat Mar 15, 2026
d6e6747
Fix merge issue
nycrat Mar 15, 2026
35c2011
Remove newly added validations
nycrat Mar 16, 2026
cef0905
Revert changes that aren't related to moving pytest validations
nycrat Mar 16, 2026
b976287
Revert validation.py formatting
nycrat Mar 16, 2026
2f5f892
Tag TODO for incorrect validations
nycrat Mar 16, 2026
875258a
Add implementation for new set_tactics
nycrat Mar 16, 2026
9851c98
Update set_tactics calls for tactic tests
nycrat Mar 16, 2026
bf52bc3
Allow passing None for set_tactics to not override
nycrat Mar 16, 2026
5a99bc2
Update passing field test
nycrat Mar 16, 2026
d3b2fc2
Update set_tactics calls for other field tests
nycrat Mar 16, 2026
43ace62
Update set_tactic calls for rest of tests
nycrat Mar 16, 2026
a7d93c8
Update doc comment
nycrat Mar 16, 2026
1caa2e2
Implement new set_plays function
nycrat Mar 16, 2026
9a12fd6
Update set_plays calls
nycrat Mar 16, 2026
94551b2
Formatting
nycrat Mar 16, 2026
21e08a1
Fix typo
nycrat Mar 16, 2026
b87e333
Tag TODO
nycrat Mar 16, 2026
8cbec6f
Merge branch 'master' into avah/change_set_tactic_syntax
nycrat Mar 21, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,9 @@ def ball_placement_play_setup(
)

# Force play override here
blue_play = Play()
blue_play.name = PlayName.BallPlacementPlay

yellow_play = Play()
yellow_play.name = PlayName.HaltPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
if not blue_only:
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.BallPlacementPlay, yellow_play=PlayName.HaltPlay
)


def run_ball_placement_scenario(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from proto.import_all_protos import *
from proto.message_translation.tbots_protobuf import create_world_state
from proto.ssl_gc_common_pb2 import Team
Expand Down Expand Up @@ -50,14 +50,9 @@ def setup(*args):
gc_command=Command.Type.FORCE_START, team=Team.BLUE
)

blue_play = Play()
blue_play.name = PlayName.CreaseDefensePlay

yellow_play = Play()
yellow_play.name = PlayName.HaltPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.CreaseDefensePlay, yellow_play=PlayName.HaltPlay
)

# TODO (#2778): actually add validations
always_validation_sequence_set = [[]]
Expand Down
23 changes: 7 additions & 16 deletions src/software/ai/hl/stp/play/defense/defense_play_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.validation.ball_enters_region import *
from software.simulated_tests.validation.friendly_has_ball_possession import (
FriendlyEventuallyHasBallPossession,
Expand Down Expand Up @@ -55,13 +55,9 @@ def setup(*args):
gc_command=Command.Type.FORCE_START, team=Team.BLUE
)

blue_play = Play()
blue_play.name = PlayName.DefensePlay

params = AssignedTacticPlayControlParams()

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_tactics(params, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.DefensePlay, yellow_play=PlayName.HaltPlay
)

simulated_test_runner.run_test(
setup=setup,
Expand Down Expand Up @@ -124,14 +120,9 @@ def setup(*args):
gc_command=Command.Type.FORCE_START, team=Team.BLUE
)

blue_play = Play()
blue_play.name = PlayName.DefensePlay

yellow_play = Play()
yellow_play.name = PlayName.ShootOrPassPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.DefensePlay, yellow_play=PlayName.ShootOrPassPlay
)

simulated_test_runner.run_test(
setup=setup,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.validation.robot_enters_placement_region import *
from software.simulated_tests.simulated_test_fixture import (
pytest_main,
Expand Down Expand Up @@ -63,15 +63,10 @@ def setup(*args):
final_ball_placement_point=ball_placement_point,
)

blue_play = Play()
blue_play.name = PlayName.EnemyBallPlacementPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)

yellow_play = Play()
yellow_play.name = PlayName.BallPlacementPlay

simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.EnemyBallPlacementPlay,
yellow_play=PlayName.BallPlacementPlay,
)

always_validation_sequence_set = [
[RobotNeverEntersPlacementRegion(ball_placement_point)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName

from software.simulated_tests.validation.or_validation import OrValidation

Expand Down Expand Up @@ -116,14 +116,9 @@ def setup(*args):
gc_command=Command.Type.DIRECT, team=Team.YELLOW
)

blue_play = Play()
blue_play.name = PlayName.EnemyFreeKickPlay

yellow_play = Play()
yellow_play.name = PlayName.FreeKickPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.EnemyFreeKickPlay, yellow_play=PlayName.FreeKickPlay
)

# Always Validation
always_validation_sequence_set = [
Expand Down
13 changes: 4 additions & 9 deletions src/software/ai/hl/stp/play/example/example_play_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from software.simulated_tests.validation.robot_speed_threshold import *
from proto.message_translation.tbots_protobuf import create_world_state
from proto.ssl_gc_common_pb2 import Team
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.simulated_test_fixture import (
pytest_main,
)
Expand Down Expand Up @@ -47,14 +47,9 @@ def setup(*args):
),
)

blue_play = Play()
blue_play.name = PlayName.ExamplePlay

yellow_play = Play()
yellow_play.name = PlayName.HaltPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.ExamplePlay, yellow_play=PlayName.HaltPlay
)

simulated_test_runner.send_gamecontroller_command(
gc_command=Command.Type.STOP, team=Team.UNKNOWN
Expand Down
11 changes: 2 additions & 9 deletions src/software/ai/hl/stp/play/free_kick/free_kick_play_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from proto.import_all_protos import *

from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from proto.ssl_gc_common_pb2 import Team

from proto.message_translation.tbots_protobuf import create_world_state
Expand Down Expand Up @@ -34,14 +34,7 @@ def free_kick_play_setup(
gc_command=Command.Type.DIRECT, team=Team.BLUE
)

blue_play = Play()
blue_play.name = play_name

yellow_play = Play()
yellow_play.name = PlayName.HaltPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(blue_play=play_name, yellow_play=PlayName.HaltPlay)


# We want to test friendly half, enemy half, and at the border of the field
Expand Down
18 changes: 8 additions & 10 deletions src/software/ai/hl/stp/play/kickoff_play_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.validation.robot_enters_region import *
from software.simulated_tests.validation.ball_enters_region import *
from proto.import_all_protos import *
Expand Down Expand Up @@ -49,9 +49,6 @@ def setup(*args):
),
)

blue_play = Play()
yellow_play = Play()

simulated_test_runner.send_gamecontroller_command(
gc_command=Command.Type.STOP, team=Team.UNKNOWN
)
Expand All @@ -60,21 +57,22 @@ def setup(*args):
simulated_test_runner.send_gamecontroller_command(
gc_command=Command.Type.KICKOFF, team=Team.BLUE
)
blue_play.name = PlayName.KickoffFriendlyPlay
yellow_play.name = PlayName.KickoffEnemyPlay
blue_play = PlayName.KickoffFriendlyPlay
yellow_play = PlayName.KickoffEnemyPlay
else:
simulated_test_runner.send_gamecontroller_command(
gc_command=Command.Type.KICKOFF, team=Team.YELLOW
)
blue_play.name = PlayName.KickoffEnemyPlay
yellow_play.name = PlayName.KickoffFriendlyPlay
blue_play = PlayName.KickoffEnemyPlay
yellow_play = PlayName.KickoffFriendlyPlay

simulated_test_runner.send_gamecontroller_command(
gc_command=Command.Type.NORMAL_START, team=Team.BLUE
)

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(blue_play=blue_play, yellow_play=yellow_play)

# TODO (#3650): fix validation logic

# TODO (#3650): fix validation logic

Expand Down
13 changes: 4 additions & 9 deletions src/software/ai/hl/stp/play/offense/offense_play_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.validation.friendly_team_scored import *
from software.simulated_tests.validation.ball_enters_region import *
from software.simulated_tests.validation.friendly_has_ball_possession import *
Expand Down Expand Up @@ -53,14 +53,9 @@ def setup(start_point):
gc_command=Command.Type.FORCE_START, team=Team.BLUE
)

blue_play = Play()
blue_play.name = PlayName.OffensePlay

yellow_play = Play()
yellow_play.name = PlayName.HaltPlay

simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_play(yellow_play, is_friendly=False)
simulated_test_runner.set_plays(
blue_play=PlayName.OffensePlay, yellow_play=PlayName.HaltPlay
)

field = tbots_cpp.Field.createSSLDivisionBField()

Expand Down
25 changes: 10 additions & 15 deletions src/software/ai/hl/stp/play/passing_sim_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,14 @@ def setup_pass_and_robots(
# Setup the passer's tactic
# We use KickTactic since AttackerTactic shoots towards the goal instead if open
# KickTactic just does the kick we want
params = AssignedTacticPlayControlParams()
params.assigned_tactics[0].kick.CopyFrom(
KickTactic(
kick_origin=Point(
x_meters=best_pass.passerPoint().x(),
y_meters=best_pass.passerPoint().y(),
),
kick_direction=Angle(radians=kick_vec.orientation().toRadians()),
kick_speed_meters_per_second=best_pass.speed(),
)
blue_tactics = {}
blue_tactics[0] = KickTactic(
kick_origin=Point(
x_meters=best_pass.passerPoint().x(),
y_meters=best_pass.passerPoint().y(),
),
kick_direction=Angle(radians=kick_vec.orientation().toRadians()),
kick_speed_meters_per_second=best_pass.speed(),
)

# if we want a friendly robot to receive the pass
Expand All @@ -140,12 +138,9 @@ def setup_pass_and_robots(
"disable_one_touch_shot": True,
}

params.assigned_tactics[1].receiver.CopyFrom(ReceiverTactic(**receiver_args))
simulated_test_runner.set_tactics(params, True)
blue_tactics[1] = ReceiverTactic(**receiver_args)

# Setup no tactics on the enemy side
params = AssignedTacticPlayControlParams()
simulated_test_runner.set_tactics(params, False)
simulated_test_runner.set_tactics(blue_tactics=blue_tactics, yellow_tactics=None)

return best_pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import software.python_bindings as tbots_cpp
from proto.play_pb2 import Play, PlayName
from proto.play_pb2 import PlayName
from software.simulated_tests.validation.ball_enters_region import *
from software.simulated_tests.simulated_test_fixture import (
pytest_main,
Expand Down Expand Up @@ -61,10 +61,11 @@ def setup(*args):
gc_command=Command.Type.FORCE_START, team=Team.BLUE
)

blue_play = Play()
blue_play.name = PlayName.ShootOrChipPlay
simulated_test_runner.set_play(blue_play, is_friendly=True)
simulated_test_runner.set_plays(
blue_play=PlayName.ShootOrChipPlay, yellow_play=PlayName.UseAiSelection
)

# TODO (#3651): create validations
simulated_test_runner.run_test(
setup=setup,
# this array is just so that the test runs 5 times
Expand Down
Loading
Loading