-
Notifications
You must be signed in to change notification settings - Fork 98
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
base: master
Are you sure you want to change the base?
Improve FreeKickPlay behaviour and convert it to use FSMs #2953
Conversation
…mond/fix_free_kick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet
/** | ||
* This play is basically: | ||
* - One robot attempts to shoot first. If there is no good shot, it will attempt to | ||
* pass, and finally chips towards the enemy goal if it can't find a pass in time | ||
* - Two robots try to get in good positions near the enemy net to receive a pass | ||
* - Two robots crease defend | ||
* - One robot is goalie | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include this comment at the top of free_kick_play.h
since this function might be removed later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
MAX_TIME_TO_COMMIT_TO_PASS(Duration::fromSeconds( | ||
5)), // Spend at most 5 seconds looking for a pass. The rule for division B | ||
// teams is at most 10 seconds spent on the entire free kick |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might want to make this a configurable param in parameters.proto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this parameter is quite specific to free kick, so it might be fine to just declare it in FreeKickPlayFSM.h as a static const.
MAX_TIME_TO_COMMIT_TO_PASS(Duration::fromSeconds( | ||
5)), // Spend at most 5 seconds looking for a pass. The rule for division B | ||
// teams is at most 10 seconds spent on the entire free kick | ||
MIN_ACCEPTABLE_PASS_SCORE(0.1), | ||
MIN_OPEN_ANGLE_FOR_SHOT( | ||
5) // Only attempt shots with an opening angle greater than 5 degrees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for these constants, i'd prefer them to be declared as static const
and declared directly in the header file. I believe there are some compiler optimizations to doing constants in that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@raymond212 is this PR still good to be merged (not sure if we changed this on the robocup branch)? Is it implemented the way we want it? (cc: @itsarune @williamckha) |
@nimazareian This PR will probably get somewhat overhauled when we rewrite our gameplay architecture but it definitely improves upon the current implementation and I think it can be merged for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed through the changes and it looks good. Just pending Arun's comment and the failing CI (fixed once you pull upstream master)
chip_tactic(std::make_shared<ChipTactic>()), | ||
passer_tactic(std::make_shared<KickTactic>()), | ||
receiver_tactic(std::make_shared<ReceiverTactic>()), | ||
offensive_positioning_tactics(std::vector<std::shared_ptr<MoveTactic>>(2)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking this merge but I think free kick play FSM is only handling two robot behaviour atm (can be fixed later) Or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on my computer and it seems that during the free kick process, several robots are being assigned a StopTactic. I don't think that is ideal.
@raymond212 What's the status of this PR? Do you think you could update it? I think it could be nice to get it in and not wait on the gameplay overhaul since we don't have an exact timeline on that. What do you think @itsarune? |
…into raymond/fix_free_kick
@raymond212 Once this PR is ready, similar to to #3146, could you also include some videos of what the new gameplay looks like? |
Yes, I'll be sure to do that. |
…into raymond/fix_free_kick
DribblingParcourPlay = 21; | ||
ScoringFromContestedPossessionPlay = 22; | ||
PassEndurancePlay = 23; | ||
ShootOrPassPlay = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should reserve 5
and keep the existing proto numbers so that we don't break previous replays
class FreeKickPlay : public Play | ||
{ | ||
public: | ||
FreeKickPlay(TbotsProto::AiConfig config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the constructor should have docs
|
||
shoot_tactic->updateControlParams( | ||
ball_pos, (shot->getPointToShootAt() - ball_pos).orientation(), | ||
BALL_MAX_SPEED_METERS_PER_SECOND - 0.5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should refactor attacker_tactic instead to add the padding within attacker tactic.
my concern: sometime in the future, we decide we want to lower/increase the shot speed and we have to find all instances of attacker tactic performing a shot and change it which isn't maintainable.
LOG(DEBUG) << "Time to look for pass expired. Chipping ball..."; | ||
PriorityTacticVector tactics_to_run = {{}}; | ||
|
||
double fallback_chip_target_x_offset = 1.5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be a static constexpr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you supplement the these tests to demonstrate free kicks shooting & chipping as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good 🔥!
It still seems some defenders seem to be assigned StopTactic
s unintentionally. Let's try to explicitly assign robots to all tactics
Please fill out the following before requesting review on this PR
Description
Improved FreeKickPlay:
CornerKickPlay
Todo:
Testing Done
Resolved Issues
resolves #2950, resolves #3205
Length Justification and Key Files to Review
free_kick_play_fsm.h
andfree_kick_play_fsm.cpp
.Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.h
file) 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