Skip to content

control ball before chipping in GoalieFSM - #3869

Open
annieisawesome2 wants to merge 4 commits into
UBC-Thunderbots:masterfrom
annieisawesome2:control-before-chip
Open

control ball before chipping in GoalieFSM#3869
annieisawesome2 wants to merge 4 commits into
UBC-Thunderbots:masterfrom
annieisawesome2:control-before-chip

Conversation

@annieisawesome2

Copy link
Copy Markdown
Contributor

Description

Previously when goalie chipped, it transitioned straight into PivotKickFSM even if the ball wasn't under control. Goalie was able to attempt chipping before securing ball. This PR adds DribbleFSM step that dribbles to control the ball and orient towards chip target before we hand off to PivotKickFSM.

Added a new guard controlBallForChip action which drives DribbleFSM to position ball at a safe chip origin and orients towards target.

Implemented new methods ballControlled and controlBallForChip. Updated goalie_fsm_test.cpp so FSM expects to land in DribbleFSM first and reaches PivotKickFSM after ball repositioned near dribbler (has possession).

Testing Done

So far only unit tests in goalie_fsm_test.cpp updated to assert new dribble state before chipping. It would be great to test on actual robot too.

Resolved Issues

#2897

Length Justification and Key Files to Review

Review Checklist

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

  • 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.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

@nycrat nycrat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These changes look good so far. I'm just a bit unsure about how the ballControlled guard works with the new FSM logic. Also as you said it would be nice to have this tested physically, but writing a simulated pytest to demonstrate that the goalie actually gains possession and moves the ball out of the no chip zone before chipping would be nice.

Comment on lines +311 to +314
bool GoalieFSM::ballControlled(const Update& event)
{
return event.common.robot.isNearDribbler(event.common.world_ptr->ball().position());
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that this guard should probably also check that the robot is in a good position to chip since the controlBallForChip action prevents chipping in the no chip rectangle, but this guard would immediately return true after the robot gets possession of the ball.

DribbleFSM_S + Update_E[shouldMoveToGoalLine_G] / moveToGoalLine_A =
MoveToGoalLine_S,
DribbleFSM_S + Update_E[ballInInflatedDefenseArea_G] / retrieveFromDeadZone_A,
DribbleFSM_S + Update_E[shouldEvacuateCrease_G] / retrieveFromDeadZone_A,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reason for this addition? It seems a bit unrelated to the rest of the PR but I might be missing some context

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same question here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh wait i think this got caught in from one of my old PR changes haha.

DribbleFSM_S + Update_E[ballInInflatedDefenseArea_G] / retrieveFromDeadZone_A,
DribbleFSM_S + Update_E[shouldEvacuateCrease_G] / retrieveFromDeadZone_A,
DribbleFSM_S + Update_E[shouldPivotChip_G] / controlBallForChip_A,
DribbleFSM_S + Update_E[ballInInflatedDefenseArea_G] / controlBallForChip_A,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here, why is this logic changed?

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.

3 participants