-
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
New passing and receiving architecture and tuned offense strategy #3200
base: master
Are you sure you want to change the base?
New passing and receiving architecture and tuned offense strategy #3200
Conversation
…rav_banna/pass_speed_cost � Conflicts: � src/software/thunderscope/thunderscope.py
…rav_banna/pass_speed_cost
…rav_banna/pass_speed_cost
// Linearly scale score to [min_pass_shoot_score, 1.0] to stop this cost function | ||
// from returning a very low score, causing the other cost functions to be ignored. | ||
return open_angle_to_goal_score; |
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.
shouldn't this return a minimum of min_pass_shoot_score
(according to the comment)?
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.
oh you've done it in a different function. you should delete that comment
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.
good call! Updated.
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 also update passing_sim_test.py
? It seems like it ends very early and probably requires fiddling around with some of the validations. (mayhaps use an OrValidation
to do an if-then type of thing)
@itsarune I digged further into this, and interestingly enough I found a bug which results in us ignoring the second validation, when we have a sequence of eventual validations. This bug is caused by us removing the first validation from the list of validations (after it is Software/src/software/simulated_tests/validation.py Lines 194 to 209 in 6dcfd29
Most of the tests run longer now since we actually wait for the receiver to receive the pass, however, some still end really fast. In those cases, your best off watching the replay since the test was likely very short (e.g. the robot taking a very short pass). |
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.
⚽
src/proto/parameters.proto
Outdated
|
||
// TODO (#2570): try to make it as big as possible when tuning | ||
// The maximum deflection angle that we will attempt a one-touch kick towards the | ||
// enemy goal with |
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.
// enemy goal with | |
// enemy goal |
src/proto/parameters.proto
Outdated
// of a soft limit. | ||
required double ideal_max_rotation_to_shoot_degrees = 5 [ | ||
default = 60.0, | ||
// A value multiplied by the duration that our enemy robot model predicts it will |
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.
// A value multiplied by the duration that our enemy robot model predicts it will | |
// A value multiplied by the duration that our enemy robot model predicts will |
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.
out of curiosity, why'd you need to change some of these parametrized tests?
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.
A limitation of the simulated pytests is that the plays/tactics can only be set at the start of the test. But for passing/receiving to work properly, we need to run the pass generator at each tick if the test. So what was happening with some of these tests was that the passer couldn't find a pass given the starting conditions of the test.
I also tried dividing the test into two parts (i.e. 2 run_test calls), first moving the receivers to the best receiving positions, then finding the best pass. But I ran into an issue which was that there's no easy way of getting the state of the World after the test starts. This was by part caused by the issue I was talking about last week about Python queues not overwriting old values. since I was trying to have a buffer of size one registered to receive the latest World, but that wasn't working.
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.
no major concerns from me, pending minor nits
nice catch with the bug! |
…2' into nima/receiver_position_generator2
@@ -45,8 +44,7 @@ void AttackerTactic::updatePrimitive(const TacticUpdate& tactic_update, bool res | |||
if (reset_fsm) | |||
{ | |||
fsm_map[tactic_update.robot.id()] = std::make_unique<FSM<AttackerFSM>>( | |||
DribbleFSM(ai_config.dribble_tactic_config()), | |||
AttackerFSM(ai_config.attacker_tactic_config())); | |||
DribbleFSM(ai_config.dribble_tactic_config()), AttackerFSM(ai_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.
This is the original code writers section below, but why don't you also need to update the DribbleFSM control params 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.
The code here is actually not the ControlParams, rather, it's just creating the FSM objects. In this case we're creating an AttackerFSM and from my understanding of how we've setup boost SML (the FSM library we use), we need to pass in the sub FSMs that the FSM uses + the FSM itself as arguments to the constructor of the FSM<XXXXFSM>
.
So in this case, AttackerFSM
has DribbleFSM
as a sub-FSM, so to generate FSM<AttackerFSM>
, we need to pass in both the DribbleFSM
and AttackerFSM
objects.
Regarding the change I made, in this PR I've update AttackerFSM
to take in TbotsProto::AiConfig
(part of our dynamic parameters), rather than just taking the TbotsProto::AttackerTacticConfig
. You can have a look at attacker FSM and see that I needed some of the other constants from AI config, so I had to make this change.
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.
Took me two days to even go through all the code. Looks like most comments are addressed. The only part that stands out to me is the free_kick_play
changes, but you have already noted that it will be overhauled in #2953 . Additionally, I have made a comment regarding the attacker_tactic
update function. I personally had some bugs with FSM update functions, but if this is not the case for you, then LGTM!
@Andrewyx Did you have bugs running code from this branch, or are you referring to running into FSM problems elsewhere? |
FSM problems elsewhere, I have not tested it with your branch directly since I am not fully familiar with the intended behaviour of the new strategy. But for my ticket where I was adding DribbleFSM to the Creases, I realized that I needed to update the DribbleFSM control params within the |
That's interesting. So are you saying that you added DribbleFSM as a sub-FSM to the CreaseDefenderFSM, and as part of |
Description
updated_passing2_cut.mp4
This PR includes many changes across our offensive gameplay. To name a few:
PassGenerator
to sample pass receiver positions more intelligently around where the robots are most likely going to be able to receive passes from as opposed to sampling the entire field. As a result, the pass generator does not use zones or pass evaluations anymore, however, it still does use theGradientDescentOptimizer
to optimize the sampled passes.ReceiverPositionGenerator
used for finding the best receiving positions. This allows the offensive robots that do not have the ball to constantly look for better receiving positions, independent of the pass generator. Previously the receiving robots were tied to the best passes found by the pass generator which limited the receiving robots ability to go around the field. This was fundamentally as a result ofratePassFriendlyCapability
only giving high scores to receiving positions around the robot's current position.PassGenerator
andReceiverPositionGenerator
that could be enabled through the dynamic parameters. For simplicity, these visualizations are shown in the debug shapes layer.Testing Done
Added new unit tests for pass generator, cost functions, and receiver position generator. Ran AI vs AI and tuned many of the constants manually.
Resolved Issues
Resolves #3191
Resolves #3192
Resolves #2577
Resolves #2538
Resolves #2136
Resolves #1988
Could affect #2930
Length Justification and Key Files to Review
❗ This PR includes the changes from #3198, so please ignore those files, or comment on that PR for specific Thunderscope changes that are unrelated to this PR. Some of the changes are also taken from #2953 (e.g. removing corner kick play. This was done to make the integration of the pass generator simpler.)
Core files to review:
receiver_position_generator.hpp
pass_generator.h/cpp
cost_functions.h/cpp
shoot_or_pass_play_fsm.cpp
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