Skip to content
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

updated python binding names in all pytests #3005

Closed
wants to merge 4 commits into from
Closed
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
40 changes: 22 additions & 18 deletions src/software/ai/hl/stp/play/ball_placement_play_test.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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
Expand Down Expand Up @@ -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),
),
)

Expand All @@ -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)]
),
]
],
Expand All @@ -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)]
),
]
],
Expand Down
44 changes: 22 additions & 22 deletions src/software/ai/hl/stp/play/corner_kick_play_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -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
Expand Down Expand Up @@ -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),
),
)

Expand All @@ -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),
],
}
],
Expand All @@ -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),
],
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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),
),
)

Expand Down
32 changes: 16 additions & 16 deletions src/software/ai/hl/stp/play/defense/defense_play_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,29 +15,29 @@
[
(
[
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),
],
)
],
)
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(
Expand Down Expand Up @@ -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),
),
)

Expand All @@ -78,7 +78,7 @@ def setup(*args):
ag_always_validation_sequence_set=[
[
BallNeverEntersRegion(
regions=[tbots.Field.createSSLDivisionBField().friendlyGoal()]
regions=[tbots_cpp.Field.createSSLDivisionBField().friendlyGoal()]
)
]
],
Expand Down
36 changes: 20 additions & 16 deletions src/software/ai/hl/stp/play/enemy_ball_placement_play_test.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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
Expand Down Expand Up @@ -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),
),
)

Expand Down
Loading
Loading