-
Notifications
You must be signed in to change notification settings - Fork 124
Fix flaky python simulated tests (no robots loading and ai running) #3626
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
Merged
nycrat
merged 16 commits into
UBC-Thunderbots:master
from
nycrat:avah/fix_simulated_tests_not_loading_robots
Mar 7, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
793298d
Fix robots not loading
nycrat 2b26779
Test run_till_end default false time save
nycrat d207cb2
Add note to proto config widget
nycrat 57f95b5
Get rid of star import
nycrat a0c8b02
Create simplified simulated test view
nycrat 5c44650
Change signature for sync_setup
nycrat ec4869f
Use best practices for tactic tests
nycrat ddd0184
Rename set_worldState to set_world_state
nycrat 9e57499
Best practices example for ball placement play test
nycrat 8bd96ed
Fix hrvo test args
nycrat 7460820
Use best practices for play tests
nycrat fdcb89d
Formatting
nycrat 6f882e8
Fix order of setup protos, world state sent first
nycrat ac81455
Add important comments that were accidentally deleted
nycrat d0b34b9
Fix order of setup in HRVO test
nycrat fea14f0
Remove default params on runner function since they are always provided
nycrat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,68 +9,64 @@ | |
|
|
||
|
|
||
| def test_crease_defense_play(simulated_test_runner): | ||
| # starting point must be Point | ||
| ball_initial_pos = tbots_cpp.Point(0.9, 2.85) | ||
| # placement point must be Vector2 to work with game controller | ||
| tbots_cpp.Point(-3, -2) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where did this go, what is this for?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the line below ball_initial_pos literally did nothing |
||
| def setup(*args): | ||
| ball_initial_pos = tbots_cpp.Point(0.9, 2.85) | ||
|
|
||
| # Setup Bots | ||
| blue_bots = [ | ||
| 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), | ||
| ] | ||
| blue_bots = [ | ||
| 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_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(), | ||
| ] | ||
| yellow_bots = [ | ||
| 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 | ||
| simulated_test_runner.gamecontroller.send_gc_command( | ||
| gc_command=Command.Type.STOP, team=Team.UNKNOWN | ||
| ) | ||
| simulated_test_runner.gamecontroller.send_gc_command( | ||
| gc_command=Command.Type.FORCE_START, team=Team.BLUE | ||
| ) | ||
| simulated_test_runner.set_world_state( | ||
| create_world_state( | ||
| yellow_robot_locations=yellow_bots, | ||
| blue_robot_locations=blue_bots, | ||
| ball_location=ball_initial_pos, | ||
| ball_velocity=tbots_cpp.Vector(0, 0), | ||
| ), | ||
| ) | ||
|
|
||
| # Force play override here | ||
| blue_play = Play() | ||
| blue_play.name = PlayName.CreaseDefensePlay | ||
| simulated_test_runner.send_gamecontroller_command( | ||
| gc_command=Command.Type.STOP, team=Team.UNKNOWN | ||
| ) | ||
| simulated_test_runner.send_gamecontroller_command( | ||
| gc_command=Command.Type.FORCE_START, team=Team.BLUE | ||
| ) | ||
|
|
||
| yellow_play = Play() | ||
| yellow_play.name = PlayName.HaltPlay | ||
| blue_play = Play() | ||
| blue_play.name = PlayName.CreaseDefensePlay | ||
|
|
||
| simulated_test_runner.blue_full_system_proto_unix_io.send_proto(Play, blue_play) | ||
| simulated_test_runner.yellow_full_system_proto_unix_io.send_proto(Play, yellow_play) | ||
| yellow_play = Play() | ||
| yellow_play.name = PlayName.HaltPlay | ||
|
|
||
| # Create world state | ||
| simulated_test_runner.simulator_proto_unix_io.send_proto( | ||
| WorldState, | ||
| create_world_state( | ||
| yellow_robot_locations=yellow_bots, | ||
| blue_robot_locations=blue_bots, | ||
| ball_location=ball_initial_pos, | ||
| ball_velocity=tbots_cpp.Vector(0, 0), | ||
| ), | ||
| ) | ||
| simulated_test_runner.set_play(blue_play, is_friendly=True) | ||
| simulated_test_runner.set_play(yellow_play, is_friendly=False) | ||
|
|
||
| # Always Validation | ||
| # TODO- #2778 Validation | ||
| # TODO (#2778): actually add validations | ||
| always_validation_sequence_set = [[]] | ||
|
|
||
| # Eventually Validation | ||
| # TODO- #2778 Validation | ||
| # TODO (#2778): actually add validations | ||
| eventually_validation_sequence_set = [[]] | ||
|
|
||
| simulated_test_runner.run_test( | ||
| setup=setup, | ||
| inv_eventually_validation_sequence_set=eventually_validation_sequence_set, | ||
| inv_always_validation_sequence_set=always_validation_sequence_set, | ||
| test_timeout_s=25, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.