Skip to content

OffensePlayTest checking that there is Never Excessive Dribbling#3536

Merged
adrianchan787 merged 54 commits intoUBC-Thunderbots:masterfrom
adrianchan787:adrian/offense_play_test_dribble
Mar 4, 2026
Merged

OffensePlayTest checking that there is Never Excessive Dribbling#3536
adrianchan787 merged 54 commits intoUBC-Thunderbots:masterfrom
adrianchan787:adrian/offense_play_test_dribble

Conversation

@adrianchan787
Copy link
Contributor

@adrianchan787 adrianchan787 commented Nov 30, 2025

Description

  • Added a validation status check in offense play test that checks if the friendly team has excessively dribbled
  • Changed the validation status check (NeverExcessivelyDribbles and EventuallyStartsExcessiveDribbles) to look at the dribble_displacement field in World instead of the previous "brute force" method; this (theoretically) aligns more with the AutoRef's implementation of excessive dribbling
  • Added a testing file for the validation status check

Testing Done

- Reran all pytests that used NeverExcessivelyDribbles; some of them were flaky for unrelated reasons e.g. pass_defender_test had a robot enter region validation error first time around
- Created a testing file that tests never excessively and eventually starts dribbling, using the dribble_tactic. (since the main dribbling done in offense_play_test is in dribble_tactic). These tests typically pass but are also flaky; I'll expand more in the comments at the end.

Resolved Issues

Resolves #3452

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • [x ] Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • [ x] Remove all commented out code
  • [ x] Remove extra print statements: for example, those just used for testing
  • [ x] Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

Additional Comments

  • Not really an addition and more of a few observations and questions. Wanted to still make this PR since I feel like it's not directly related to my current ticket (and also because I've dragged this on for too long lol).

  • Was looking at how the Autoref implemented dribble distance, and from what I understood it seems to compare initial position of the robot to the final position of the ball (see the code snippet below, taken from https://github.com/TIGERs-Mannheim/AutoReferee/tree/53063578e38ac4818849df3196b32a856a5fa41d). If I'm mistaken, please tell me and I'll edit the comments in my branch lol

Screenshot from 2025-11-30 03-23-07
  • However, because they use robot to ball and not e.g. ball to ball, the dribble displacement field is extremely inconsistent. For example, in my tests, if you start the robot in the same location as the ball, you get a different dribble displacement than if you started the robot a meter way. (which I think makes sense? since the orientation with which you start dribbling will probably be different).
  • Similarly, that's why the maximum distance between the initial point location of the ball and its location after dribbling is greater than 1 m. From tests I got up to 1.03 m. However, this maximum limit was pretty flaky for me, and fluctuated between 1.03 and 1.01 m. (which is why there's a decent chance my code won't pass my own tests).
  • So I was wondering if this is an issue? On one hand, (I think?) if this mirrors the Autoref's behaviour, it doesn't matter how inconsistent it is. On the other, I know William said the 1 meter max dribbling was a pretty strict limit, so would it be worthwhile to be conservative and use like 0.98 max distance in testing and tactics?

Sorry if that was a bit unclear, please let me know if it was. Thanks!

@adrianchan787
Copy link
Contributor Author

(oops really sorry not sure if i was supposed to resolve the merge conflict)

@adrianchan787 adrianchan787 marked this pull request as draft November 30, 2025 22:10
@adrianchan787 adrianchan787 marked this pull request as ready for review November 30, 2025 23:01
Copy link
Member

@nycrat nycrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, just some refactoring changes recommended but the new implementation of excessive_dribbing validation seems good and the test are thorough

Copy link
Contributor

@Andrewyx Andrewyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work so far, I left some feedback!

),
],
)
def test_excessive_dribbling(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure what the reasoning was for this test, since the issue this PR is marked for is regarding offense play. Reading through the work here, it appears to be more akin to a DribbleTactic test. Excessive dribbling is a characteristic of Gameplay more than a particular state, so I think it is a bit odd to be testing it explicitly since it is really just testing the implementation of DribbleTactic itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ig that makes sense. I was thinking (please correct me if I'm wrong or really misguided) but the main dribbling tactic used in offense play is DribbleTactic, and if that's the case if it works in DribbleTactic then it should work everywhere else, including in offense play. As it is easier to test (especially boundary test) DribbleTactic directly rather than test offense play, I was thinking it might be the better option.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I fully understand Andrew's point, but imo the purpose of this test is clear and makes sense

Copy link
Contributor

@StarrryNight StarrryNight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, left some comments

Copy link
Member

@nycrat nycrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good 👍

@StarrryNight
Copy link
Contributor

LGTM too!

Copy link
Member

@williamckha williamckha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Comment on lines +17 to +19
self.dribbler_tolerance = 0.05
self.max_dribbling_displacement = 1.00
self.dribbling_error_margin = 0.05
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would normally make these class constants rather than instance attributes accessed via self, e.g. ExcessivelyDribbling.MAX_DRIBBLING_DISPLACEMENT. Another option (if you want to allow greater flexibility) would be to keep the instance attributes and set them based on constructor params with default arguments. You don't have to change anything for this PR, but just something to keep in mind for the future.

@williamckha williamckha dismissed Andrewyx’s stale review March 3, 2026 19:39

Comments resolved

@adrianchan787 adrianchan787 merged commit 012e685 into UBC-Thunderbots:master Mar 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OffensePlayTest should check that we don't dribble too far

5 participants