OffensePlayTest checking that there is Never Excessive Dribbling#3536
OffensePlayTest checking that there is Never Excessive Dribbling#3536adrianchan787 wants to merge 54 commits intoUBC-Thunderbots:masterfrom
Conversation
|
(oops really sorry not sure if i was supposed to resolve the merge conflict) |
…/adrianchan787/Software into adrian/offense_play_test_dribble
nycrat
left a comment
There was a problem hiding this comment.
Added some comments, just some refactoring changes recommended but the new implementation of excessive_dribbing validation seems good and the test are thorough
src/software/ai/hl/stp/tactic/dribble/excessive_dribble_test.py
Outdated
Show resolved
Hide resolved
src/software/ai/hl/stp/tactic/dribble/excessive_dribble_test.py
Outdated
Show resolved
Hide resolved
Wow I have messed this up horribly one sec (ok i am so incredibly sorry for this cursed git log) |
This reverts commit 6d9a363.
Andrewyx
left a comment
There was a problem hiding this comment.
Nice work so far, I left some feedback!
src/software/ai/hl/stp/tactic/dribble/excessive_dribble_test.py
Outdated
Show resolved
Hide resolved
src/software/ai/hl/stp/tactic/dribble/excessive_dribble_test.py
Outdated
Show resolved
Hide resolved
| ), | ||
| ], | ||
| ) | ||
| def test_excessive_dribbling( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I'm not sure if I fully understand Andrew's point, but imo the purpose of this test is clear and makes sense
StarrryNight
left a comment
There was a problem hiding this comment.
lgtm, left some comments
| ball_position = tbots_cpp.createPoint(world.ball.current_state.global_position) | ||
| for robot in world.friendly_team.team_robots: | ||
| if not tbots_cpp.Robot(robot).isNearDribbler(ball_position, 0.01): | ||
| if not tbots_cpp.Robot(robot).isNearDribbler(ball_position, self.tolerance): |
There was a problem hiding this comment.
Do we have to set a tolerance here? Or could we just pass in the ball position and have the tolerance default to BALL_TO_FRONT_OF_ROBOT_DISTANCE_WHEN_DRIBBLING?
There was a problem hiding this comment.
Yeah unfortunately the default doesn't work and am almost certain it is far too small. i tested it a bit and for some reason the robot position and ball position are weirdly offsetted by some variable amount, so a smaller tolerance is a lot flakier than usual (and the default just doesn't pass tests)
| @override | ||
| def get_validation_status(self, world) -> ValidationStatus: |
There was a problem hiding this comment.
I think the implementation of this function needs to change a bit. The docstring says it should check if any robot is excessively dribbling, but this is only true if we have one robot (notice that, currently, the dribble starting point is reset if any robot is not near the ball, so if there is more than one robot, the dribble start point will never be set).
I would suggest splitting the implementation into two parts. First part would determine whether we should set or reset the dribble starting point. The dribble starting point should only be reset if no robots are near the ball. It should be set if it is currently None and there is a robot near the ball. Second part would only be run if the dribble starting point is set, and it would check whether the ball has been excessively dribbled.
| """(override) Shows the max allowed dribbling circle""" | ||
| return create_validation_geometry( | ||
| [tbots_cpp.Circle(self.continous_dribbling_start_point, 1.0)] | ||
| if self.continous_dribbling_start_point is not None | ||
| [ | ||
| tbots_cpp.Circle( | ||
| self.continuous_dribbling_start_point, | ||
| self.max_dribbling_displacement, |
There was a problem hiding this comment.
We should probably visualize the max dribble displacement minus the allowed error margin
…to be tested with tscope visualizer
Description
Testing Done
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
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO(or similar) statements should either be completed or associated with a github issueAdditional 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
Sorry if that was a bit unclear, please let me know if it was. Thanks!