UBC-Thunderbots / Software

Robot Soccer Playing AI
http://www.ubcthunderbots.ca
GNU Lesser General Public License v3.0
47 stars 98 forks source link

New passing and receiving architecture and tuned offense strategy #3200

Open nimazareian opened 1 month ago

nimazareian commented 1 month ago

Description

https://github.com/UBC-Thunderbots/Software/assets/28585597/4afa9dd8-359e-414e-b7a7-e8e3328b6dcb

This PR includes many changes across our offensive gameplay. To name a few:

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

:exclamation: 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:

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

sauravbanna commented 1 month ago

some of aruns comments were from my in progress branch so i fixed them

nimazareian commented 1 month ago

To add to what Saurav mentioned, note that this PR is just for showcase of the current progress and is nowhere near complete. It is also an accumulation of multiple PRs (some of which are open separately). So not all changes here are new.

nimazareian commented 3 weeks ago

It definitely seems like we're passing significantly better!

Glad to hear that :smile: There was a lot of tuning involved with the pass generator, cost functions, and the AI logic. I would imagine that we would have to do some of this with the new gameplay as well. Though I've tried to incorporate more visualizations and have more values in dynamic parameters to hopefully make it simpler.

Mr-Anyone commented 3 weeks ago

This may be a dumb question.

Are we using .h or .hpp for header files?

Would continue reading this entire PR tmr.

itsarune commented 3 weeks ago

@Mr-Anyone our convention is to usually use .hpp for tempaltes and .h for classes

nimazareian commented 2 weeks ago

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 PASSING) while we're iterating over it. Here's the original code: https://github.com/UBC-Thunderbots/Software/blob/6dcfd29c234fa28a2bb387d57f3b51e4ab574f2b/src/software/simulated_tests/validation.py#L194-L209

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).

itsarune commented 1 week ago

nice catch with the bug!

nimazareian commented 3 days ago

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?

Andrewyx commented 3 days ago

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 updatePrimitive function for it to work effectively, otherwise, I had a bug where the Crease would endlessly chase the ball.

nimazareian commented 3 days ago

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 updatePrimitive function for it to work effectively, otherwise, I had a bug where the Crease would endlessly chase the ball.

That's interesting. So are you saying that you added DribbleFSM as a sub-FSM to the CreaseDefenderFSM, and as part of CreaseDefenderTactic::updatePrimitive you had to call process_event with the DribbleFSM::update as well for it to work?