use perimeter stepping for crease defenders instead of shotcones - #3901
Draft
annieisawesome2 wants to merge 4 commits into
Draft
annieisawesome2 wants to merge 4 commits into
annieisawesome2 wants to merge 4 commits into
Conversation
annieisawesome2
requested review from
Andrewyx,
StarrryNight,
nycrat,
sauravbanna and
williamckha
as code owners
August 24, 2026 16:46
StarrryNight
left a comment
Contributor
There was a problem hiding this comment.
Nice work! Added a few comments
mkhlb
self-requested a review
August 29, 2026 20:02
Contributor
Author
|
**perimeter^^ LMAO |
Contributor
Author
|
@mkhlb Please let me know your concerns about this brought up at the sprint presentation. |
StarrryNight
approved these changes
Sep 11, 2026
annieisawesome2
marked this pull request as draft
September 12, 2026 19:55
Contributor
Author
|
Not sure if this improves play. Will come back after ai vs ai data collection and analysis done. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Currently, CreaseDefensePlayFSM handles only 3 crease defenders to occupy 3 positions. We used shot cones to find where the robots should be positioned. However, when the shot cone angle is small there would be one robot clustered in the middle and not really doing much so want fewer sometimes. To do this, perimeter stepping along the defence area was implemented.
There was a bug in stepAlongPerimeter where the mid-segment starts to interpolate from the segment start not the closest_start so the steps were wrong. Fix: first segment starts at closest point on perimeter.
Tests were added for crease defender so LEFT and RIGHT matches +/- step from the centre. Also added perimeter stepping tests for bug.
So far this seems to look like it fixed the issue of the shot cones always using up 3 robots.
Testing Done
Updated C++ tests and made sure they all passed.
To visually see the change working i ran
./tbots.py run thunderscope_main --keyboard_estopand tested placing the ball in a couple places like centre and the side where the shot cone caused different spacing of robots. Here I had 2 robots to demonstrate how the spacing was super close when the angle was smaller and the 2 crease defenders were further when enemy was in the centre causing a larger shotcone.This is before the fix. Notice crease defenders 1 and 2 are spaced further.

And when angle is close they are spaced super close. Since we can have up to 3, when there are 3 crease defenders, in this situation they cluster causing one to be very useless. (robots 1 and 5 are the crease defenders here)

Here is the fix where the 2 crease defenders are always evenly spaced based on robot radius.
Screen.Recording.2026-08-22.at.12.30.26.PM.mov
Resolved Issues
In my opinion doing the perimeter stepping solves the dynamic number of robots as crease defender?
#3374
#2995
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 issue