Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
raymond212 committed Oct 28, 2023
1 parent 36f2f04 commit fc30414
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/software/ai/hl/stp/play/free_kick/free_kick_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ FreeKickPlay::FreeKickPlay(TbotsProto::AiConfig config)

void FreeKickPlay::getNextTactics(TacticCoroutine::push_type &yield, const World &world)
{
// This function doesn't get called so it does nothing, will be removed once
// coroutines are phased out
// This function doesn't get called and it will be removed once coroutines are phased
// out
}

void FreeKickPlay::updateTactics(const PlayUpdate &play_update)
Expand Down
14 changes: 14 additions & 0 deletions src/software/ai/hl/stp/play/free_kick/free_kick_play.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

#include "software/ai/hl/stp/play/free_kick/free_kick_play_fsm.h"

/**
* This free kick play is used for free kicks, which are used to restart the game after a
* foul has occurred. Additionally, goal kicks and corner kicks are mapped to free kicks.
* The logic of this play is:
* - One robot (the kicker) attempts to shoot first. If there is a good shot, then it
* will shoot the ball.
* - If there is no good shot, the kicker will attempt to pass. Two robots try to get in
* good positions near the enemy net to receive a pass
* - If we cannot find a pass in time, the kicker will chip the ball towards the enemy
* goal
* - Two robots crease defend
* - One robot is goalie
*/

class FreeKickPlay : public Play
{
public:
Expand Down
12 changes: 8 additions & 4 deletions src/software/ai/hl/stp/play/free_kick/free_kick_play_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
#include "software/logger/logger.h"

/**
* This play is basically:
* - One robot attempts to shoot first. If there is no good shot, it will attempt to
* pass, and finally it will chip 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
* This FSM implements the free kick play. The logic of this play is:
* - One robot (the kicker) attempts to shoot first. If there is a good shot, then it
* will shoot the ball.
* - If there is no good shot, the kicker will attempt to pass. Two robots try to get in
* good positions near the enemy net to receive a pass
* - If we cannot find a pass in time, the kicker will chip the ball towards the enemy
* goal
* - Two robots crease defend
* - One robot is goalie
*/
Expand Down Expand Up @@ -204,6 +207,7 @@ struct FreeKickPlayFSM

// If the time to look for a pass is over, chip the ball towards the enemy net
AttemptPassState_S + Update_E[timeExpired_G] = ChipState_S,

// Keep looking for a pass
AttemptPassState_S + Update_E[!passFound_G] / lookForPass_A =
AttemptPassState_S,
Expand Down

0 comments on commit fc30414

Please sign in to comment.