update crease defender to perimeter step instead of using shotcones
Description
The existing crease defense FSM positioned up to three defenders along the goal crease by dividing the enemy’s shot cone into fixed 1/6, 3/6, and 5/6 intervals of the goal width. When the shot cone was narrow, these fixed positions were too close together relative to robot size, causing defenders to cluster and sometimes collide.
The solution was for the crease defenders to step along the goal area perimeter rather than relying on fixed divisions of the shot cone. Once the box is represented as a polygon, stepAlongPerimeter() can be called to move a defender along the perimeter according to their alignment relative to the opposing threat.
Edge case: Defenders occasionally stepped onto the goal line when the cone was positioned near the boundary. The solution for this was to reassign the robot that would step over the goal line as a pass defender instead when the enemy was close to the net and the shot angle is too small for 3 robots to all be crease defenders. This reassignment was done in defense_play_fsm.cpp where we also validate the crease defender’s position.
Testing Done
Updated google tests for crease_defender_fsm_test.cpp to accommodate for perimeter stepping.
Resolved Issues
#2995 #3374 (the robot reassignment was similar to this ticket. We should also remove this issue since it is no longer valid. )
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
.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. - [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
Resolved issues with previous tests with shot cones. Will work on more advanced tests for edge case angles.