diff --git a/src/software/ai/hl/stp/play/ball_placement_play_test.py b/src/software/ai/hl/stp/play/ball_placement_play_test.py index 86a00438ed..d9bf38437a 100644 --- a/src/software/ai/hl/stp/play/ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/ball_placement_play_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.simulated_test_fixture import ( @@ -17,29 +17,33 @@ def test_two_ai_ball_placement(simulated_test_runner): # placement point must be Vector2 to work with game controller - ball_final_pos = tbots.Point(-3, -2) + ball_final_pos = tbots_cpp.Point(-3, -2) def setup(run_enemy_ai): # starting point must be Point - ball_initial_pos = tbots.Point(2, 2) + ball_initial_pos = tbots_cpp.Point(2, 2) # Setup Bots blue_bots = [ - tbots.Point(-2.75, 2.5), - tbots.Point(-2.75, 1.5), - tbots.Point(-2.75, 0.5), - tbots.Point(-2.75, -0.5), - tbots.Point(-2.75, -1.5), - tbots.Point(4.5, -3.0), + tbots_cpp.Point(-2.75, 2.5), + tbots_cpp.Point(-2.75, 1.5), + tbots_cpp.Point(-2.75, 0.5), + tbots_cpp.Point(-2.75, -0.5), + tbots_cpp.Point(-2.75, -1.5), + tbots_cpp.Point(4.5, -3.0), ] yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXPosYCorner(), ] # Game Controller Setup @@ -78,7 +82,7 @@ def setup(run_enemy_ai): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) @@ -90,7 +94,7 @@ def setup(run_enemy_ai): [ # Ball should arrive within 5cm of placement point BallEventuallyEntersRegion( - regions=[tbots.Circle(ball_final_pos, 0.05)] + regions=[tbots_cpp.Circle(ball_final_pos, 0.05)] ), ] ], @@ -99,7 +103,7 @@ def setup(run_enemy_ai): [ # Ball should arrive within 5cm of placement point BallEventuallyEntersRegion( - regions=[tbots.Circle(ball_final_pos, 0.05)] + regions=[tbots_cpp.Circle(ball_final_pos, 0.05)] ), ] ], diff --git a/src/software/ai/hl/stp/play/corner_kick_play_test.py b/src/software/ai/hl/stp/play/corner_kick_play_test.py index 2257f4c2a6..f1b7df2167 100644 --- a/src/software/ai/hl/stp/play/corner_kick_play_test.py +++ b/src/software/ai/hl/stp/play/corner_kick_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.friendly_team_scored import * @@ -20,12 +20,12 @@ def corner_kick_play_test_setup(ball_initial_pos, blue_bots, simulated_test_runn """ yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), ] # Game Controller Setup @@ -56,7 +56,7 @@ def corner_kick_play_test_setup(ball_initial_pos, blue_bots, simulated_test_runn yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) @@ -71,14 +71,14 @@ def test_corner_kick_play_bottom_left(simulated_test_runner): ), params=[ { - "ball_initial_pos": tbots.Point(4.5, -3), + "ball_initial_pos": tbots_cpp.Point(4.5, -3), "blue_bots": [ - tbots.Point(-3, 2.5), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(4.6, -3.1), + tbots_cpp.Point(-3, 2.5), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(4.6, -3.1), ], } ], @@ -100,14 +100,14 @@ def test_corner_kick_play_top_right(simulated_test_runner): ), params=[ { - "ball_initial_pos": tbots.Point(4.5, 3), + "ball_initial_pos": tbots_cpp.Point(4.5, 3), "blue_bots": [ - tbots.Point(-3, 2.5), - tbots.Point(0, 1.5), - tbots.Point(0, 0.5), - tbots.Point(0, -0.5), - tbots.Point(0, -1.5), - tbots.Point(4.6, 3.1), + tbots_cpp.Point(-3, 2.5), + tbots_cpp.Point(0, 1.5), + tbots_cpp.Point(0, 0.5), + tbots_cpp.Point(0, -0.5), + tbots_cpp.Point(0, -1.5), + tbots_cpp.Point(4.6, 3.1), ], } ], diff --git a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py index 32d29955ab..1a06097e6e 100644 --- a/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py +++ b/src/software/ai/hl/stp/play/crease_defense/crease_defense_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from proto.import_all_protos import * from software.simulated_tests.simulated_test_fixture import simulated_test_runner @@ -13,27 +13,27 @@ def test_crease_defense_play(simulated_test_runner): # starting point must be Point - ball_initial_pos = tbots.Point(0.9, 2.85) + ball_initial_pos = tbots_cpp.Point(0.9, 2.85) # placement point must be Vector2 to work with game controller - tbots.Point(-3, -2) + tbots_cpp.Point(-3, -2) # Setup Bots blue_bots = [ - tbots.Point(-4.5, 0), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(-3, -3.0), + tbots_cpp.Point(-4.5, 0), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(-3, -3.0), ] yellow_bots = [ - tbots.Point(1, 3), - tbots.Point(1, -0.25), - tbots.Point(1, -1.25), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 3), + tbots_cpp.Point(1, -0.25), + tbots_cpp.Point(1, -1.25), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), ] # Game Controller Setup @@ -61,7 +61,7 @@ def test_crease_defense_play(simulated_test_runner): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) diff --git a/src/software/ai/hl/stp/play/defense/defense_play_test.py b/src/software/ai/hl/stp/play/defense/defense_play_test.py index 2f6d6aa3ac..6f5ee344af 100644 --- a/src/software/ai/hl/stp/play/defense/defense_play_test.py +++ b/src/software/ai/hl/stp/play/defense/defense_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.simulated_test_fixture import simulated_test_runner @@ -15,19 +15,19 @@ [ ( [ - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(-3, 1), - tbots.Point(-3, 0.75), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(-3, 1), + tbots_cpp.Point(-3, 0.75), ], [ - tbots.Point(1, -0.25), - tbots.Point(1, -1.25), - tbots.Point(2, -0.25), - tbots.Point(2, -1.25), - tbots.Point(2, -1), + tbots_cpp.Point(1, -0.25), + tbots_cpp.Point(1, -1.25), + tbots_cpp.Point(2, -0.25), + tbots_cpp.Point(2, -1.25), + tbots_cpp.Point(2, -1), ], ) ], @@ -35,9 +35,9 @@ def test_defense_play(simulated_test_runner, blue_bots, yellow_bots): def setup(*args): # Starting point must be Point - ball_initial_pos = tbots.Point(0.9, 2.85) + ball_initial_pos = tbots_cpp.Point(0.9, 2.85) # Placement point must be Vector2 to work with game controller - tbots.Point(-3, -2) + tbots_cpp.Point(-3, -2) # Game Controller Setup simulated_test_runner.gamecontroller.send_ci_input( @@ -66,7 +66,7 @@ def setup(*args): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) @@ -78,7 +78,7 @@ def setup(*args): ag_always_validation_sequence_set=[ [ BallNeverEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().friendlyGoal()] + regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()] ) ] ], diff --git a/src/software/ai/hl/stp/play/enemy_ball_placement_play_test.py b/src/software/ai/hl/stp/play/enemy_ball_placement_play_test.py index 8b937d1d15..e7ca1aacd7 100644 --- a/src/software/ai/hl/stp/play/enemy_ball_placement_play_test.py +++ b/src/software/ai/hl/stp/play/enemy_ball_placement_play_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.simulated_test_fixture import ( @@ -14,27 +14,31 @@ def test_two_ai_ball_placement(simulated_test_runner): def setup(*args): # Initial position is from Blue's perspective - ball_initial_pos = tbots.Point(2, 2) + ball_initial_pos = tbots_cpp.Point(2, 2) # Final point is going to be from yellow's perspective (since yellow will be the one placing) - ball_final_pos = tbots.Point(-3, -2) + ball_final_pos = tbots_cpp.Point(-3, -2) # Setup Bots blue_bots = [ - tbots.Point(-2.75, 2.5), - tbots.Point(-2.75, 1.5), - tbots.Point(-2.75, 0.5), - tbots.Point(-2.75, -0.5), - tbots.Point(-2.75, -1.5), - tbots.Point(4.6, -3.1), + tbots_cpp.Point(-2.75, 2.5), + tbots_cpp.Point(-2.75, 1.5), + tbots_cpp.Point(-2.75, 0.5), + tbots_cpp.Point(-2.75, -0.5), + tbots_cpp.Point(-2.75, -1.5), + tbots_cpp.Point(4.6, -3.1), ] yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXPosYCorner(), ] # Game Controller Setup @@ -71,7 +75,7 @@ def setup(*args): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) diff --git a/src/software/ai/hl/stp/play/free_kick_play_test.py b/src/software/ai/hl/stp/play/free_kick_play_test.py index 01bef88f85..9e22518491 100644 --- a/src/software/ai/hl/stp/play/free_kick_play_test.py +++ b/src/software/ai/hl/stp/play/free_kick_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.friendly_team_scored import * @@ -51,7 +51,7 @@ def free_kick_play_setup( yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) @@ -59,7 +59,11 @@ def free_kick_play_setup( # We want to test friendly half, enemy half, and at the border of the field @pytest.mark.parametrize( "ball_initial_pos", - [tbots.Point(1.5, -2.75), tbots.Point(-1.5, -2.75), tbots.Point(1.5, -3)], + [ + tbots_cpp.Point(1.5, -2.75), + tbots_cpp.Point(-1.5, -2.75), + tbots_cpp.Point(1.5, -3), + ], ) def test_free_kick_play_friendly(simulated_test_runner, ball_initial_pos): # TODO- #2753 Validation @@ -75,22 +79,22 @@ def test_free_kick_play_friendly(simulated_test_runner, ball_initial_pos): params=[ { "blue_bots": [ - tbots.Point(-4.5, 0), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(4, -2.5), + tbots_cpp.Point(-4.5, 0), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(4, -2.5), ], "yellow_bots": [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField() + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() .enemyDefenseArea() .negXNegYCorner(), - tbots.Field.createSSLDivisionBField() + tbots_cpp.Field.createSSLDivisionBField() .enemyDefenseArea() .negXPosYCorner(), ], @@ -111,30 +115,30 @@ def test_free_kick_play_friendly(simulated_test_runner, ball_initial_pos): [ # not close to our net ( - tbots.Point(0.9, 2.85), + tbots_cpp.Point(0.9, 2.85), [ - tbots.Point(1, 3), - tbots.Point(-2, -1.25), - tbots.Point(-1, -0.25), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField() + tbots_cpp.Point(1, 3), + tbots_cpp.Point(-2, -1.25), + tbots_cpp.Point(-1, -0.25), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() .enemyDefenseArea() .negXNegYCorner(), - tbots.Field.createSSLDivisionBField() + tbots_cpp.Field.createSSLDivisionBField() .enemyDefenseArea() .negXPosYCorner(), ], ), # close to our net ( - tbots.Point(-2.4, 1), + tbots_cpp.Point(-2.4, 1), [ - tbots.Point(-2.3, 1.05), - tbots.Point(-3.5, 2), - tbots.Point(-1.2, 0), - tbots.Point(-2.3, -1), - tbots.Point(-3.8, -2), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Point(-2.3, 1.05), + tbots_cpp.Point(-3.5, 2), + tbots_cpp.Point(-1.2, 0), + tbots_cpp.Point(-2.3, -1), + tbots_cpp.Point(-3.8, -2), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), ], ), ], @@ -142,12 +146,12 @@ def test_free_kick_play_friendly(simulated_test_runner, ball_initial_pos): def test_free_kick_play_enemy(simulated_test_runner, ball_initial_pos, yellow_bots): blue_bots = [ - tbots.Point(-4.5, 0), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(4, -2.5), + tbots_cpp.Point(-4.5, 0), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(4, -2.5), ] # TODO- #2753 Validation simulated_test_runner.run_test( @@ -161,12 +165,12 @@ def test_free_kick_play_enemy(simulated_test_runner, ball_initial_pos, yellow_bo params=[ { "blue_bots": [ - tbots.Point(-4.5, 0), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(4, -2.5), + tbots_cpp.Point(-4.5, 0), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(4, -2.5), ], "yellow_bots": yellow_bots, "ball_initial_pos": ball_initial_pos, @@ -183,7 +187,11 @@ def test_free_kick_play_enemy(simulated_test_runner, ball_initial_pos, yellow_bo @pytest.mark.parametrize( "ball_initial_pos", - [tbots.Point(1.5, -2.75), tbots.Point(-1.5, -2.75), tbots.Point(1.5, -3)], + [ + tbots_cpp.Point(1.5, -2.75), + tbots_cpp.Point(-1.5, -2.75), + tbots_cpp.Point(1.5, -3), + ], ) def test_free_kick_play_both(simulated_test_runner, ball_initial_pos): # TODO- #2753 Validation @@ -198,20 +206,20 @@ def test_free_kick_play_both(simulated_test_runner, ball_initial_pos): params=[ { "blue_bots": [ - tbots.Point(-3, 0.25), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(-3, -0.25), + tbots_cpp.Point(-3, 0.25), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(-3, -0.25), ], "yellow_bots": [ - tbots.Point(3, 0.25), - tbots.Point(3, 1.5), - tbots.Point(3, 0.5), - tbots.Point(3, -0.5), - tbots.Point(3, -1.5), - tbots.Point(3, -0.25), + tbots_cpp.Point(3, 0.25), + tbots_cpp.Point(3, 1.5), + tbots_cpp.Point(3, 0.5), + tbots_cpp.Point(3, -0.5), + tbots_cpp.Point(3, -1.5), + tbots_cpp.Point(3, -0.25), ], "ball_initial_pos": ball_initial_pos, "play_name": PlayName.EnemyFreekickPlay, diff --git a/src/software/ai/hl/stp/play/halt_play_test.py b/src/software/ai/hl/stp/play/halt_play_test.py index 77e5966ffe..3c2adc6a1c 100644 --- a/src/software/ai/hl/stp/play/halt_play_test.py +++ b/src/software/ai/hl/stp/play/halt_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.robot_speed_threshold import * from software.simulated_tests.simulated_test_fixture import simulated_test_runner @@ -15,25 +15,29 @@ def test_halt_play(simulated_test_runner): def setup(*args): # starting point must be Point - ball_initial_pos = tbots.Point(0, 0) + ball_initial_pos = tbots_cpp.Point(0, 0) # Setup Bots blue_bots = [ - tbots.Point(-3, 2.5), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(-3, -2.5), + tbots_cpp.Point(-3, 2.5), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(-3, -2.5), ] yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXPosYCorner(), ] # Game Controller Setup @@ -58,7 +62,7 @@ def setup(*args): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) diff --git a/src/software/ai/hl/stp/play/kickoff_play_test.py b/src/software/ai/hl/stp/play/kickoff_play_test.py index 3274bbe44b..242d8facbc 100644 --- a/src/software/ai/hl/stp/play/kickoff_play_test.py +++ b/src/software/ai/hl/stp/play/kickoff_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from proto.import_all_protos import * from software.simulated_tests.simulated_test_fixture import simulated_test_runner @@ -14,25 +14,29 @@ def test_kickoff_play(simulated_test_runner, is_friendly_test): def setup(*args): # starting point must be Point - ball_initial_pos = tbots.Point(0, 0) + ball_initial_pos = tbots_cpp.Point(0, 0) # Setup Bots blue_bots = [ - tbots.Point(-3, 2.5), - tbots.Point(-3, 1.5), - tbots.Point(-3, 0.5), - tbots.Point(-3, -0.5), - tbots.Point(-3, -1.5), - tbots.Point(-3, -2.5), + tbots_cpp.Point(-3, 2.5), + tbots_cpp.Point(-3, 1.5), + tbots_cpp.Point(-3, 0.5), + tbots_cpp.Point(-3, -0.5), + tbots_cpp.Point(-3, -1.5), + tbots_cpp.Point(-3, -2.5), ] yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField() + .enemyDefenseArea() + .negXPosYCorner(), ] blue_play = Play() @@ -71,7 +75,7 @@ def setup(*args): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) diff --git a/src/software/ai/hl/stp/play/offense/offense_play_test.py b/src/software/ai/hl/stp/play/offense/offense_play_test.py index 22975b226d..09268b2c12 100644 --- a/src/software/ai/hl/stp/play/offense/offense_play_test.py +++ b/src/software/ai/hl/stp/play/offense/offense_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.friendly_team_scored import * from software.simulated_tests.ball_enters_region import * @@ -14,27 +14,27 @@ def test_offense_play(simulated_test_runner): # starting point must be Point - ball_initial_pos = tbots.Point(-4.4, 2.9) + ball_initial_pos = tbots_cpp.Point(-4.4, 2.9) # placement point must be Vector2 to work with game controller - tbots.Point(-3, -2) + tbots_cpp.Point(-3, -2) # Setup Bots blue_bots = [ - tbots.Point(-4.5, 3.0), - tbots.Point(-2, 1.5), - tbots.Point(-2, 0.5), - tbots.Point(-2, -1.7), - tbots.Point(-2, -1.5), - tbots.Point(-2, -0.5), + tbots_cpp.Point(-4.5, 3.0), + tbots_cpp.Point(-2, 1.5), + tbots_cpp.Point(-2, 0.5), + tbots_cpp.Point(-2, -1.7), + tbots_cpp.Point(-2, -1.5), + tbots_cpp.Point(-2, -0.5), ] yellow_bots = [ - tbots.Point(1, 0), - tbots.Point(1, 2.5), - tbots.Point(1, -2.5), - tbots.Field.createSSLDivisionBField().enemyGoalCenter(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), - tbots.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), + tbots_cpp.Point(1, 0), + tbots_cpp.Point(1, 2.5), + tbots_cpp.Point(1, -2.5), + tbots_cpp.Field.createSSLDivisionBField().enemyGoalCenter(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXNegYCorner(), + tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea().negXPosYCorner(), ] # Game Controller Setup @@ -62,7 +62,7 @@ def test_offense_play(simulated_test_runner): yellow_robot_locations=yellow_bots, blue_robot_locations=blue_bots, ball_location=ball_initial_pos, - ball_velocity=tbots.Vector(0, 0), + ball_velocity=tbots_cpp.Vector(0, 0), ), ) diff --git a/src/software/ai/hl/stp/play/shoot_or_chip_play_test.py b/src/software/ai/hl/stp/play/shoot_or_chip_play_test.py index 7c1c66b231..4e83ed7d70 100644 --- a/src/software/ai/hl/stp/play/shoot_or_chip_play_test.py +++ b/src/software/ai/hl/stp/play/shoot_or_chip_play_test.py @@ -2,7 +2,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.play_pb2 import Play, PlayName from software.simulated_tests.ball_enters_region import * from software.simulated_tests.simulated_test_fixture import ( @@ -18,26 +18,26 @@ def test_shoot_or_chip_play(simulated_test_runner): def setup(*args): - ball_initial_pos = tbots.Point(-1.4, 2) - ball_initial_vel = tbots.Vector(0, 0) + ball_initial_pos = tbots_cpp.Point(-1.4, 2) + ball_initial_vel = tbots_cpp.Vector(0, 0) - field = tbots.Field.createSSLDivisionBField() + field = tbots_cpp.Field.createSSLDivisionBField() blue_bots = [ field.friendlyGoalCenter(), - tbots.Point(-1.5, 2), - tbots.Point(-2, 1.5), - tbots.Point(-2, 0.5), - tbots.Point(-2, -0.5), - tbots.Point(-2, -1.5), + tbots_cpp.Point(-1.5, 2), + tbots_cpp.Point(-2, 1.5), + tbots_cpp.Point(-2, 0.5), + tbots_cpp.Point(-2, -0.5), + tbots_cpp.Point(-2, -1.5), ] yellow_bots = [ field.enemyGoalCenter(), field.enemyDefenseArea().negXNegYCorner(), field.enemyDefenseArea().negXPosYCorner(), - tbots.Point(-1, 0), - tbots.Point(1, -2.5), + tbots_cpp.Point(-1, 0), + tbots_cpp.Point(1, -2.5), ] world_state = create_world_state( diff --git a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py index 9e5bf8df03..d87838859d 100644 --- a/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/goalie/goalie_tactic_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from software.simulated_tests.robot_enters_region import * from software.simulated_tests.ball_enters_region import * from software.simulated_tests.ball_moves_forward import * @@ -20,81 +20,81 @@ "ball_initial_position,ball_initial_velocity,robot_initial_position", [ # test panic ball very fast in straight line - (tbots.Point(0, 0), tbots.Vector(-5, 0), tbots.Point(-4, 0)), + (tbots_cpp.Point(0, 0), tbots_cpp.Vector(-5, 0), tbots_cpp.Point(-4, 0)), # test panic ball very_fast in diagonal line # TODO (#2609): failing tests when thunderscope is off # ( - # tbots.Point(0, 0), - # tbots.Vector(-5.5, 0.25), - # tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - # + tbots.Vector(0, -0.5), + # tbots_cpp.Point(0, 0), + # tbots_cpp.Vector(-5.5, 0.25), + # tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + # + tbots_cpp.Vector(0, -0.5), # ), # test ball very fast misses net - (tbots.Point(0, 0), tbots.Vector(-5, 1), tbots.Point(-4.5, 0)), + (tbots_cpp.Point(0, 0), tbots_cpp.Vector(-5, 1), tbots_cpp.Point(-4.5, 0)), # test slow ball at sharp angle to friendly goal # TODO (#2609): failing tests when thunderscope is off # ball slow inside friendly defense area - # (tbots.Point(-4, 0.8), tbots.Vector(-0.2, 0), tbots.Point(0, 0)), + # (tbots_cpp.Point(-4, 0.8), tbots_cpp.Vector(-0.2, 0), tbots_cpp.Point(0, 0)), # # ball slow inside friendly defense area - # (tbots.Point(-4, 0.8), tbots.Vector(-0.2, 0), tbots.Point(0, 2)), + # (tbots_cpp.Point(-4, 0.8), tbots_cpp.Vector(-0.2, 0), tbots_cpp.Point(0, 2)), # # ball slow inside friendly defense area - # (tbots.Point(-4, 0.8), tbots.Vector(-0.2, 0), tbots.Point(0, 2)), + # (tbots_cpp.Point(-4, 0.8), tbots_cpp.Vector(-0.2, 0), tbots_cpp.Point(0, 2)), # ball slow inside friendly defense area - (tbots.Point(-4, 0.8), tbots.Vector(-0.2, 0), tbots.Point(-4, 0),), + (tbots_cpp.Point(-4, 0.8), tbots_cpp.Vector(-0.2, 0), tbots_cpp.Point(-4, 0),), # ball stationary inside friendly defense area ( - tbots.Point(-4, 0.0), - tbots.Vector(0.0, 0), - tbots.Field.createSSLDivisionBField().friendlyGoalpostPos(), + tbots_cpp.Point(-4, 0.0), + tbots_cpp.Vector(0.0, 0), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalpostPos(), ), # ball stationary inside no-chip rectangle ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.1, 0.1), - tbots.Vector(-0.2, 0), - tbots.Point(-4, -1), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.1, 0.1), + tbots_cpp.Vector(-0.2, 0), + tbots_cpp.Point(-4, -1), ), # ball fast inside no-chip rectangle but no intersection with goal ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.1, 0), - tbots.Vector(0, -0.5), - tbots.Point(-3.5, 1), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.1, 0), + tbots_cpp.Vector(0, -0.5), + tbots_cpp.Point(-3.5, 1), ), # ball moving out from inside defense area ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.5, 0), - tbots.Vector(0.5, 0), - tbots.Point(-3.5, 0), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.5, 0), + tbots_cpp.Vector(0.5, 0), + tbots_cpp.Point(-3.5, 0), ), # ball slow inside no-chip rectangle ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.1, 0), - tbots.Vector(0.1, -0.1), - tbots.Point(-3.5, 1), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.1, 0), + tbots_cpp.Vector(0.1, -0.1), + tbots_cpp.Point(-3.5, 1), ), # ball moving into goal from inside defense area ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.5, 0), - tbots.Vector(-0.5, 0), - tbots.Point(-3.5, 0), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.5, 0), + tbots_cpp.Vector(-0.5, 0), + tbots_cpp.Point(-3.5, 0), ), # ball moving up and out of defense area ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.3, 0), - tbots.Vector(0, 1), - tbots.Point(-3.5, 0), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.3, 0), + tbots_cpp.Vector(0, 1), + tbots_cpp.Point(-3.5, 0), ), # ball moving down and out goal from defense area ( - tbots.Field.createSSLDivisionBField().friendlyGoalCenter() - + tbots.Vector(0.3, 0), - tbots.Vector(0, -0.7), - tbots.Point(-3.5, 0), + tbots_cpp.Field.createSSLDivisionBField().friendlyGoalCenter() + + tbots_cpp.Vector(0.3, 0), + tbots_cpp.Vector(0, -0.7), + tbots_cpp.Point(-3.5, 0), ), ], ) @@ -147,10 +147,10 @@ def test_goalie_blocks_shot( always_validation_sequence_set = [ [ RobotNeverEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().enemyDefenseArea()] + regions=[tbots_cpp.Field.createSSLDivisionBField().enemyDefenseArea()] ), BallNeverEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().friendlyGoal()] + regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()] ), NeverExcessivelyDribbles(), ] @@ -161,7 +161,9 @@ def test_goalie_blocks_shot( [ # Goalie should be in the defense area RobotEventuallyEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().friendlyDefenseArea()] + regions=[ + tbots_cpp.Field.createSSLDivisionBField().friendlyDefenseArea() + ] ), ] ] diff --git a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py index 686ad495bc..ca6dd54397 100644 --- a/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py +++ b/src/software/ai/hl/stp/tactic/pass_defender/pass_defender_tactic_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from software.simulated_tests.robot_enters_region import * from software.simulated_tests.ball_enters_region import * from software.simulated_tests.ball_moves_forward import * @@ -20,11 +20,15 @@ "ball_initial_position,ball_initial_velocity,position_to_block_from", [ # Intercept straight line pass towards defender - (tbots.Point(2, 0), tbots.Vector(-3, 0), tbots.Point(-2, 0)), + (tbots_cpp.Point(2, 0), tbots_cpp.Vector(-3, 0), tbots_cpp.Point(-2, 0)), # Intercept pass angled away from defender - (tbots.Point(2, 0), tbots.Vector(-3, 0), tbots.Point(-2, 0.5)), + (tbots_cpp.Point(2, 0), tbots_cpp.Vector(-3, 0), tbots_cpp.Point(-2, 0.5)), # Intercept diagonal pass - (tbots.Point(-1, -3), tbots.Vector(-2, 1.5), tbots.Point(-3, -0.75)), + ( + tbots_cpp.Point(-1, -3), + tbots_cpp.Vector(-2, 1.5), + tbots_cpp.Point(-3, -0.75), + ), ], ) def test_ball_chipped_on_intercept( @@ -48,7 +52,7 @@ def test_ball_chipped_on_intercept( params = AssignedTacticPlayControlParams() params.assigned_tactics[0].pass_defender.CopyFrom( PassDefenderTactic( - position_to_block_from=tbots.createPointProto(position_to_block_from) + position_to_block_from=tbots_cpp.createPointProto(position_to_block_from) ) ) simulated_test_runner.blue_full_system_proto_unix_io.send_proto( @@ -65,11 +69,13 @@ def test_ball_chipped_on_intercept( always_validation_sequence_set = [ [ RobotNeverEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().friendlyDefenseArea()] + regions=[ + tbots_cpp.Field.createSSLDivisionBField().friendlyDefenseArea() + ] ), # Defender should intercept ball and prevent it from entering the goal BallNeverEntersRegion( - regions=[tbots.Field.createSSLDivisionBField().friendlyGoal()] + regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()] ), ] ] @@ -92,18 +98,18 @@ def test_ball_chipped_on_intercept( # Defender should avoid/abort intercepting the ball in these scenarios. # <---------O X # ball defender - (tbots.Point(-1, 0), tbots.Vector(-3, 0), tbots.Point(0, 0)), + (tbots_cpp.Point(-1, 0), tbots_cpp.Vector(-3, 0), tbots_cpp.Point(0, 0)), # <---------O ball # # X defender - (tbots.Point(0, 0), tbots.Vector(-3, 0), tbots.Point(0, -1)), + (tbots_cpp.Point(0, 0), tbots_cpp.Vector(-3, 0), tbots_cpp.Point(0, -1)), # ^ # | # | # O ball # # X defender - (tbots.Point(0, 1), tbots.Vector(0, 3), tbots.Point(0, 0)), + (tbots_cpp.Point(0, 1), tbots_cpp.Vector(0, 3), tbots_cpp.Point(0, 0)), ], ) def test_avoid_intercept_scenario( @@ -127,7 +133,7 @@ def test_avoid_intercept_scenario( params = AssignedTacticPlayControlParams() params.assigned_tactics[0].pass_defender.CopyFrom( PassDefenderTactic( - position_to_block_from=tbots.createPointProto(position_to_block_from) + position_to_block_from=tbots_cpp.createPointProto(position_to_block_from) ) ) simulated_test_runner.blue_full_system_proto_unix_io.send_proto( @@ -158,12 +164,12 @@ def test_avoid_intercept_scenario( # the enemy team to set up again RobotAlwaysStaysInRegion( regions=[ - tbots.Rectangle( - tbots.Point( + tbots_cpp.Rectangle( + tbots_cpp.Point( position_to_block_from.x() - 0.5, position_to_block_from.y() - 0.5, ), - tbots.Point( + tbots_cpp.Point( position_to_block_from.x() + 0.5, position_to_block_from.y() + 0.5, ), diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py index 2e8ced3ba4..e750265b9c 100644 --- a/src/software/field_tests/field_test_fixture.py +++ b/src/software/field_tests/field_test_fixture.py @@ -4,7 +4,7 @@ import threading import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp import argparse from proto.import_all_protos import * from proto.ssl_gc_common_pb2 import Team diff --git a/src/software/field_tests/movement_robot_field_test.py b/src/software/field_tests/movement_robot_field_test.py index cd013b8910..8bd403d8fc 100644 --- a/src/software/field_tests/movement_robot_field_test.py +++ b/src/software/field_tests/movement_robot_field_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp import sys from proto.ssl_gc_common_pb2 import Team from proto.import_all_protos import * @@ -43,9 +43,9 @@ # # setup world state # initial_worldstate = create_world_state( # yellow_robot_locations=[], -# blue_robot_locations=[tbots.Point(robot_starting_x, robot_starting_y)], -# ball_location=tbots.Point(1, 1), -# ball_velocity=tbots.Point(0, 0), +# blue_robot_locations=[tbots_cpp.Point(robot_starting_x, robot_starting_y)], +# ball_location=tbots_cpp.Point(1, 1), +# ball_velocity=tbots_cpp.Point(0, 0), # ) # simulated_test_runner.set_worldState(initial_worldstate) # @@ -59,8 +59,8 @@ # [ # RobotEventuallyEntersRegion( # regions=[ -# tbots.Circle( -# tbots.Point(robot_x_destination, robot_y_destination), 0.2 +# tbots_cpp.Circle( +# tbots_cpp.Point(robot_x_destination, robot_y_destination), 0.2 # ) # ] # ), diff --git a/src/software/field_tests/pivot_kick_field_test.py b/src/software/field_tests/pivot_kick_field_test.py index 6c9b2cd7f6..c8e4110f10 100644 --- a/src/software/field_tests/pivot_kick_field_test.py +++ b/src/software/field_tests/pivot_kick_field_test.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp import sys import math from proto.ssl_gc_common_pb2 import Team diff --git a/src/software/simulated_tests/ball_enters_region.py b/src/software/simulated_tests/ball_enters_region.py index 34cf852fe8..948fabe212 100644 --- a/src/software/simulated_tests/ball_enters_region.py +++ b/src/software/simulated_tests/ball_enters_region.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -23,8 +23,8 @@ def get_validation_status(self, world) -> ValidationStatus: PASSING when a ball enters """ for region in self.regions: - if tbots.contains( - region, tbots.createPoint(world.ball.current_state.global_position) + if tbots_cpp.contains( + region, tbots_cpp.createPoint(world.ball.current_state.global_position) ): return ValidationStatus.PASSING diff --git a/src/software/simulated_tests/ball_moves_forward.py b/src/software/simulated_tests/ball_moves_forward.py index e3c7aa8f1e..3a430646dc 100644 --- a/src/software/simulated_tests/ball_moves_forward.py +++ b/src/software/simulated_tests/ball_moves_forward.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -23,7 +23,7 @@ def get_validation_status(self, world) -> ValidationStatus: PASSING if ball moves forward """ validation_status = ValidationStatus.FAILING - current_ball_position = tbots.createPoint( + current_ball_position = tbots_cpp.createPoint( world.ball.current_state.global_position ) @@ -38,14 +38,14 @@ def get_validation_geometry(self, world) -> ValidationGeometry: """ return create_validation_geometry( [ - tbots.Rectangle( - tbots.Point( + tbots_cpp.Rectangle( + tbots_cpp.Point( self.last_ball_position.x(), - tbots.Field(world.field).fieldBoundary().yMin(), + tbots_cpp.Field(world.field).fieldBoundary().yMin(), ), - tbots.Point( + tbots_cpp.Point( self.last_ball_position.x() + 0.01, - tbots.Field(world.field).fieldBoundary().yMax(), + tbots_cpp.Field(world.field).fieldBoundary().yMax(), ), ) ] diff --git a/src/software/simulated_tests/ball_speed_threshold.py b/src/software/simulated_tests/ball_speed_threshold.py index 7b622a8907..c10873f75a 100644 --- a/src/software/simulated_tests/ball_speed_threshold.py +++ b/src/software/simulated_tests/ball_speed_threshold.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.py_constants import * from software.simulated_tests.speed_threshold_helpers import * @@ -28,7 +28,7 @@ def get_validation_status(self, world) -> ValidationStatus: PASSING if the ball speed is at or above some threshold """ if ( - tbots.createVector(world.ball.current_state.global_velocity).length() + tbots_cpp.createVector(world.ball.current_state.global_velocity).length() >= self.speed_threshold ): return ValidationStatus.PASSING @@ -58,9 +58,9 @@ def get_validation_geometry(self, world) -> ValidationGeometry: return create_validation_geometry( [ - tbots.Segment( - tbots.Point(validation_start_x, validation_start_y), - tbots.Point(validation_end_x, validation_end_y), + tbots_cpp.Segment( + tbots_cpp.Point(validation_start_x, validation_start_y), + tbots_cpp.Point(validation_end_x, validation_end_y), ) ] ) diff --git a/src/software/simulated_tests/ball_stops_in_region.py b/src/software/simulated_tests/ball_stops_in_region.py index f3234a4717..b5e39602e6 100644 --- a/src/software/simulated_tests/ball_stops_in_region.py +++ b/src/software/simulated_tests/ball_stops_in_region.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -22,10 +22,12 @@ def get_validation_status(self, world) -> ValidationStatus: PASSING when a ball stops in a region """ for region in self.regions: - if tbots.contains( - region, tbots.createPoint(world.ball.current_state.global_position) + if tbots_cpp.contains( + region, tbots_cpp.createPoint(world.ball.current_state.global_position) ) and ( - tbots.createVector(world.ball.current_state.global_velocity).length() + tbots_cpp.createVector( + world.ball.current_state.global_velocity + ).length() <= 0.01 ): return ValidationStatus.PASSING diff --git a/src/software/simulated_tests/excessive_dribbling.py b/src/software/simulated_tests/excessive_dribbling.py index 741f67b3ed..1ab0d21aa9 100644 --- a/src/software/simulated_tests/excessive_dribbling.py +++ b/src/software/simulated_tests/excessive_dribbling.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -22,9 +22,9 @@ def get_validation_status(self, world) -> ValidationStatus: :returns: FAILING when the robot is excessively dribbling PASSING when the robot is not excessively dribbling """ - ball_position = tbots.createPoint(world.ball.current_state.global_position) + ball_position = tbots_cpp.createPoint(world.ball.current_state.global_position) for robot in world.friendly_team.team_robots: - if not tbots.Robot(robot).isNearDribbler(ball_position, 0.01): + if not tbots_cpp.Robot(robot).isNearDribbler(ball_position, 0.01): # if ball is not near dribbler then de-activate this validation self.continous_dribbling_start_point = None elif ( @@ -41,7 +41,7 @@ def get_validation_geometry(self, world) -> ValidationGeometry: (override) Shows the max allowed dribbling circle """ return create_validation_geometry( - [tbots.Circle(self.continous_dribbling_start_point, 1.0)] + [tbots_cpp.Circle(self.continous_dribbling_start_point, 1.0)] if self.continous_dribbling_start_point is not None else [] ) diff --git a/src/software/simulated_tests/friendly_has_ball_possession.py b/src/software/simulated_tests/friendly_has_ball_possession.py index 8db39fd37b..064a5410f4 100644 --- a/src/software/simulated_tests/friendly_has_ball_possession.py +++ b/src/software/simulated_tests/friendly_has_ball_possession.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -19,9 +19,9 @@ def get_validation_status(self, world) -> ValidationStatus: :returns: FAILING when no friendly robot has possession of the ball PASSING when any friendly robot has possession of the ball """ - ball_position = tbots.createPoint(world.ball.current_state.global_position) + ball_position = tbots_cpp.createPoint(world.ball.current_state.global_position) for robot in world.friendly_team.team_robots: - if tbots.Robot(robot).isNearDribbler(ball_position, 0.01): + if tbots_cpp.Robot(robot).isNearDribbler(ball_position, 0.01): return ValidationStatus.PASSING return ValidationStatus.FAILING @@ -31,7 +31,7 @@ def get_validation_geometry(self, world) -> ValidationGeometry: """ return create_validation_geometry( [ - tbots.Robot(robot).dribblerArea() + tbots_cpp.Robot(robot).dribblerArea() for robot in world.friendly_team.team_robots ] ) diff --git a/src/software/simulated_tests/friendly_team_scored.py b/src/software/simulated_tests/friendly_team_scored.py index 69a66fecec..8d1bc7354e 100644 --- a/src/software/simulated_tests/friendly_team_scored.py +++ b/src/software/simulated_tests/friendly_team_scored.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -13,7 +13,7 @@ class FriendlyTeamScored(Validation): """Checks if a ball enters the enemy goal.""" def __init__(self): - self.region = tbots.Field.createSSLDivisionBField().enemyGoal() + self.region = tbots_cpp.Field.createSSLDivisionBField().enemyGoal() def get_validation_status(self, world) -> ValidationStatus: """Checks if the ball enters the provided regions @@ -23,8 +23,8 @@ def get_validation_status(self, world) -> ValidationStatus: PASSING when a ball enters """ - if tbots.contains( - self.region, tbots.createPoint(world.ball.current_state.global_position) + if tbots_cpp.contains( + self.region, tbots_cpp.createPoint(world.ball.current_state.global_position) ): return ValidationStatus.PASSING diff --git a/src/software/simulated_tests/robot_enters_region.py b/src/software/simulated_tests/robot_enters_region.py index 422e05b087..def8af7c3e 100644 --- a/src/software/simulated_tests/robot_enters_region.py +++ b/src/software/simulated_tests/robot_enters_region.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.simulated_tests.validation import ( @@ -24,8 +24,8 @@ def get_validation_status(self, world) -> ValidationStatus: """ for region in self.regions: for robot in world.friendly_team.team_robots: - if tbots.contains( - region, tbots.createPoint(robot.current_state.global_position) + if tbots_cpp.contains( + region, tbots_cpp.createPoint(robot.current_state.global_position) ): return ValidationStatus.PASSING @@ -70,8 +70,8 @@ def get_validation_status(self, world) -> ValidationStatus: """ # Update the map with latest robot status for robot in world.friendly_team.team_robots: - self.robot_in_zone[robot.id] = tbots.contains( - self.region, tbots.createPoint(robot.current_state.global_position) + self.robot_in_zone[robot.id] = tbots_cpp.contains( + self.region, tbots_cpp.createPoint(robot.current_state.global_position) ) # Check if there are at least req_robot_cnt number of robots in zone curr_cnt = 0 diff --git a/src/software/simulated_tests/robot_speed_threshold.py b/src/software/simulated_tests/robot_speed_threshold.py index fefce1690d..e0682e6f31 100644 --- a/src/software/simulated_tests/robot_speed_threshold.py +++ b/src/software/simulated_tests/robot_speed_threshold.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.py_constants import * from software.simulated_tests.speed_threshold_helpers import * @@ -31,7 +31,7 @@ def get_validation_status(self, world) -> ValidationStatus: for robot in world.friendly_team.team_robots: if ( - tbots.createVector(robot.current_state.global_velocity).length() + tbots_cpp.createVector(robot.current_state.global_velocity).length() < self.speed_threshold ): return ValidationStatus.FAILING @@ -59,13 +59,13 @@ def get_validation_geometry(self, world) -> ValidationGeometry: segments.append( [ - tbots.Point(validation_start_x, validation_start_y), - tbots.Point(validation_end_x, validation_end_y), + tbots_cpp.Point(validation_start_x, validation_start_y), + tbots_cpp.Point(validation_end_x, validation_end_y), ] ) return create_validation_geometry( - [tbots.Segment(points[0], points[1]) for points in segments] + [tbots_cpp.Segment(points[0], points[1]) for points in segments] ) def __repr__(self): diff --git a/src/software/simulated_tests/simulated_test_ball_model.py b/src/software/simulated_tests/simulated_test_ball_model.py index 1764197bdb..f68d45c906 100644 --- a/src/software/simulated_tests/simulated_test_ball_model.py +++ b/src/software/simulated_tests/simulated_test_ball_model.py @@ -1,6 +1,6 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from software.simulated_tests.robot_enters_region import * from software.simulated_tests.ball_enters_region import * from software.simulated_tests.ball_moves_forward import * @@ -28,10 +28,10 @@ @pytest.mark.parametrize( "ball_initial_position,ball_initial_velocity", [ - (tbots.Point(-3.5, 0), tbots.Vector(2, 0),), - (tbots.Point(-3.5, 2), tbots.Vector(3, -2),), - (tbots.Point(-3.5, -2), tbots.Vector(3, 2),), - (tbots.Point(4.5, 3), tbots.Vector(-3.5, -2),), + (tbots_cpp.Point(-3.5, 0), tbots_cpp.Vector(2, 0),), + (tbots_cpp.Point(-3.5, 2), tbots_cpp.Vector(3, -2),), + (tbots_cpp.Point(-3.5, -2), tbots_cpp.Vector(3, 2),), + (tbots_cpp.Point(4.5, 3), tbots_cpp.Vector(-3.5, -2),), ], ) def test_simulator_move_ball( @@ -82,7 +82,7 @@ def test_simulator_move_ball( # Eventually Validation eventually_validation_sequence_set = [ - [BallEventuallyStopsInRegion([tbots.Circle(ball_expected_position, 0.1)]),] + [BallEventuallyStopsInRegion([tbots_cpp.Circle(ball_expected_position, 0.1)]),] ] simulated_test_runner.run_test( @@ -94,9 +94,9 @@ def test_simulator_move_ball( def test_ball_robot_collision(simulated_test_runner): - ball_initial_position = tbots.Field.createSSLDivisionBField().centerPoint() - ball_initial_velocity = tbots.Vector(2.5, 0) - robot_position = tbots.Point(2.5, 0) + ball_initial_position = tbots_cpp.Field.createSSLDivisionBField().centerPoint() + ball_initial_velocity = tbots_cpp.Vector(2.5, 0) + robot_position = tbots_cpp.Point(2.5, 0) # Setup Robot simulated_test_runner.simulator_proto_unix_io.send_proto( @@ -159,7 +159,7 @@ def test_ball_robot_collision(simulated_test_runner): eventually_validation_sequence_set = [ [ BallEventuallyStopsInRegion( - [tbots.Circle(robot_position, distance_from_robot)] + [tbots_cpp.Circle(robot_position, distance_from_robot)] ), ] ] diff --git a/src/software/simulated_tests/simulated_test_fixture.py b/src/software/simulated_tests/simulated_test_fixture.py index 57f1274568..beede02d90 100644 --- a/src/software/simulated_tests/simulated_test_fixture.py +++ b/src/software/simulated_tests/simulated_test_fixture.py @@ -6,7 +6,7 @@ import os import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from pyqtgraph.Qt import QtCore, QtGui diff --git a/src/software/simulated_tests/speed_threshold_helpers.py b/src/software/simulated_tests/speed_threshold_helpers.py index 5d017c8d80..b68ff16c7a 100644 --- a/src/software/simulated_tests/speed_threshold_helpers.py +++ b/src/software/simulated_tests/speed_threshold_helpers.py @@ -1,4 +1,4 @@ -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.import_all_protos import * from software.py_constants import * from software.thunderscope.constants import SPEED_SEGMENT_SCALE diff --git a/src/software/simulated_tests/validation.py b/src/software/simulated_tests/validation.py index 9a1d3dd12e..fc04a4ecb2 100644 --- a/src/software/simulated_tests/validation.py +++ b/src/software/simulated_tests/validation.py @@ -1,7 +1,7 @@ import pytest -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from proto.validation_pb2 import * @@ -243,19 +243,19 @@ def create_validation_geometry(geometry=[]) -> ValidationGeometry: validation_geometry = ValidationGeometry() CREATE_PROTO_DISPATCH = { - tbots.Vector.__name__: tbots.createVectorProto, - tbots.Polygon.__name__: tbots.createPolygonProto, - tbots.Rectangle.__name__: tbots.createPolygonProto, - tbots.Circle.__name__: tbots.createCircleProto, - tbots.Segment.__name__: tbots.createSegmentProto, + tbots_cpp.Vector.__name__: tbots_cpp.createVectorProto, + tbots_cpp.Polygon.__name__: tbots_cpp.createPolygonProto, + tbots_cpp.Rectangle.__name__: tbots_cpp.createPolygonProto, + tbots_cpp.Circle.__name__: tbots_cpp.createCircleProto, + tbots_cpp.Segment.__name__: tbots_cpp.createSegmentProto, } ADD_TO_VALIDATION_GEOMETRY_DISPATCH = { - tbots.Vector.__name__: validation_geometry.vectors.append, - tbots.Polygon.__name__: validation_geometry.polygons.append, - tbots.Rectangle.__name__: validation_geometry.polygons.append, - tbots.Circle.__name__: validation_geometry.circles.append, - tbots.Segment.__name__: validation_geometry.segments.append, + tbots_cpp.Vector.__name__: validation_geometry.vectors.append, + tbots_cpp.Polygon.__name__: validation_geometry.polygons.append, + tbots_cpp.Rectangle.__name__: validation_geometry.polygons.append, + tbots_cpp.Circle.__name__: validation_geometry.circles.append, + tbots_cpp.Segment.__name__: validation_geometry.segments.append, } for geom in geometry: diff --git a/src/software/thunderscope/field/simulator_layer.py b/src/software/thunderscope/field/simulator_layer.py index 01238a77fc..213c049f87 100644 --- a/src/software/thunderscope/field/simulator_layer.py +++ b/src/software/thunderscope/field/simulator_layer.py @@ -1,4 +1,4 @@ -import software.python_bindings as geom +import software.python_bindings as geom_cpp import pyqtgraph as pg from proto.import_all_protos import * from pyqtgraph.Qt import QtCore, QtGui diff --git a/src/software/thunderscope/field/world_layer.py b/src/software/thunderscope/field/world_layer.py index 407cd94f54..cac058ab39 100644 --- a/src/software/thunderscope/field/world_layer.py +++ b/src/software/thunderscope/field/world_layer.py @@ -1,6 +1,6 @@ import math -import software.python_bindings as geom +import software.python_bindings as geom_cpp import pyqtgraph as pg from proto.import_all_protos import * from pyqtgraph.Qt import QtCore, QtGui @@ -138,7 +138,7 @@ def mouseMoveEvent(self, event): """ mouse_move_pos = [event.pos().x(), event.pos().y()] - ball_position = geom.Vector( + ball_position = geom_cpp.Vector( self.cached_world.ball.current_state.global_position.x_meters * MILLIMETERS_PER_METER, self.cached_world.ball.current_state.global_position.y_meters @@ -151,7 +151,7 @@ def mouseMoveEvent(self, event): # velocity vector that is proportional to the distance the # mouse has moved away from the ball. if self.key_pressed[Qt.Key.Key_Control] and self.mouse_clicked: - self.ball_velocity_vector = ball_position - geom.Vector( + self.ball_velocity_vector = ball_position - geom_cpp.Vector( mouse_move_pos[0], mouse_move_pos[1] ) diff --git a/src/software/thunderscope/robot_diagnostics/drive_and_dribbler_widget.py b/src/software/thunderscope/robot_diagnostics/drive_and_dribbler_widget.py index 9e8c8a4c6b..07ffb73936 100644 --- a/src/software/thunderscope/robot_diagnostics/drive_and_dribbler_widget.py +++ b/src/software/thunderscope/robot_diagnostics/drive_and_dribbler_widget.py @@ -1,7 +1,7 @@ from pyqtgraph.Qt.QtCore import Qt from pyqtgraph.Qt.QtWidgets import * import time -import software.python_bindings as tbots +import software.python_bindings as tbots_cpp from software.thunderscope.thread_safe_buffer import ThreadSafeBuffer from software.thunderscope.common import common_widgets from proto.import_all_protos import * @@ -15,7 +15,7 @@ def __init__(self, proto_unix_io): """ self.input_a = time.time() - self.constants = tbots.create2021RobotConstants() + self.constants = tbots_cpp.create2021RobotConstants() QWidget.__init__(self) layout = QVBoxLayout()