-
Notifications
You must be signed in to change notification settings - Fork 0
BallLock
Zichong Li edited this page Feb 15, 2023
·
1 revision
Many helping functions are present in the LibCodeRelease.h
. These are used to provide general variables needed by all the roles to accomplish their behavior. One of the most important is hasBallLock(bool wantsBall, float extraScore = 0)
.
This function is call by every robot and would fill thePersonalData
structure with .wantsBall
and .ballScore
fields, plus returning a boolean answer. Only one robot will be assigned with the ball at the same time, according to the following algorithm:
- the score is given by the relative distance from ball, plus additional scores to prioritize different roles according to the game conditions. The wantsBall input is used to further shape the answer, since the function is always called in any options.
- if more robots wants the ball, the one with lower score gets it. All robots on the field are checked every time, their specific behaviors would enable or not the wantsBall to insert them in the assignment queue.