Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve FreeKickPlay behaviour and convert it to use FSMs #2953

Draft
wants to merge 242 commits into
base: master
Choose a base branch
from

Conversation

raymond212
Copy link
Contributor

@raymond212 raymond212 commented Jun 30, 2023

Description

❗ This PR is dependent on the changes from #3200, as such, it's in a draft state until that is merged. Please comment any passing/receiving related suggestions in that PR and for the time being only focus on suggestions around the changes listed below in this PR.

Improved FreeKickPlay:

  1. Reimplemented it using FSMs

  2. Used KickTactic instead of AttackerTactic to ensure that we do not dribble

  3. Deleted CornerKickPlay

  4. Update KickFSM and ChipFSM to make sure that the robot is aligned to the kick/chip direction of the latest control params. Also update how far we drive into the ball.

  5. Update GetBehindBallFSM's guard to be more strict on the robot's alignment with the ball. The width of the region has been updated to have the same tolerance that the ball has to be within for it to not hit the side of the dribbler.
    Old region that the robot had to be within to be counted as "behind ball":
    image
    Updated region:
    image

  6. Update some of the constants related to the robots based on the most up to date CAD.

Todo:

  • Add validation for free kick play

Testing Done

Tried free kicks in AI vs AI.

Resolved Issues

resolves #2950, resolves #3205

Length Justification and Key Files to Review

free_kick_play_fsm.h and free_kick_play_fsm.cpp.

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

@raymond212
Copy link
Contributor Author

ChipPass

Chip pass example (0.5 speed simulation).

@raymond212 raymond212 marked this pull request as ready for review June 22, 2024 20:02
@williamckha williamckha mentioned this pull request Jun 27, 2024
4 tasks

void FreeKickPlay::updateTactics(const PlayUpdate &play_update)
{
fsm.process_event(FreeKickPlayFSM::Update(control_params, play_update));
Copy link
Contributor

Choose a reason for hiding this comment

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

FreeKickPlayFSM shouldn't be in control of all the robots and do its own defense behavior. Delegate some of the robots to DefensePlay and remove defensive behaviors from FreeKickPlayFSM

Take a look at offense_play.cpp for an example

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call! I've updated it.

Copy link
Contributor

@itsarune itsarune left a comment

Choose a reason for hiding this comment

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

left some quick feedback right now. I'll take a closer look at thinderscope later.

@nimazareian nimazareian marked this pull request as draft June 28, 2024 18:42
@nimazareian
Copy link
Contributor

I've made this PR a draft until #3200 is merged (more details in the PR description). However, the play/FSM have been updated and are good to be reviewed again.

@nimazareian
Copy link
Contributor

I've added some basic validations for the friendly freekick simulated tests. The tests show how the receivers position themselves and the best passes/shots which are selected. I'm not sure if I will have the time to add more complex validations.

Comment on lines +267 to +268
LOG(INFO) << "Pass Score: " << best_pass_and_score_so_far.rating
<< " Score threshold: " << min_score;
Copy link
Contributor

Choose a reason for hiding this comment

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

remember to remove this log, it's a bit spammy

Comment on lines +297 to +298
LOG(INFO) << "Found pass with score: " << best_pass_and_score_so_far.rating
<< ". Passing...";
Copy link
Contributor

Choose a reason for hiding this comment

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

bit spammy, remember to remove

Comment on lines +321 to +324
if (shoot_tactic->done())
{
LOG(INFO) << "Finished shot.";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove when you're done

Comment on lines +330 to +333
if (receiver_tactic->done())
{
LOG(INFO) << "Finished pass.";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove when you're done

Comment on lines +339 to +342
if (chip_tactic->done())
{
LOG(INFO) << "Finished chip.";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove when you're done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete CornerKickPlay [Gameplay] Fix FreeKickPlay and convert it into using FSMs
6 participants