Skip to content

Commit

Permalink
Readd ball placement ball avoiders
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorn committed May 8, 2024
1 parent 2b80f60 commit cd2fc29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion roboteam_ai/src/stp/skills/GoToPos.cpp
Expand Up @@ -21,7 +21,9 @@ Status GoToPos::onUpdate(const StpInfo &info) noexcept {
targetPos = PositionComputations::calculateAvoidRobotsPosition(targetPos, info.getCurrentWorld(), robot->getId(), avoidObj, field);
}

if (avoidObj.shouldAvoidBall) {
RefCommand currentGameState = GameStateManager::getCurrentGameState().getCommandId();

if (roleName != "ball_placer" && (avoidObj.shouldAvoidBall || currentGameState == RefCommand::BALL_PLACEMENT_US || currentGameState == RefCommand::BALL_PLACEMENT_THEM || currentGameState == RefCommand::BALL_PLACEMENT_US_DIRECT)) {
targetPos = PositionComputations::calculateAvoidBallPosition(targetPos, ballLocation, field);
}

Expand Down
6 changes: 3 additions & 3 deletions roboteam_ai/src/utilities/GameStateManager.cpp
Expand Up @@ -116,9 +116,9 @@ void GameStateManager::updateInterfaceGameState(const char* name) {
static const std::map<std::string, std::pair<RefCommand, rtt::ai::RuleSet>> nameToGameState = {
{"Stop Formation", {RefCommand::STOP, Constants::RULESET_STOP()}},
{"Prepare Forced Start", {RefCommand::STOP, Constants::RULESET_STOP()}},
{"Ball Placement Us Free Kick", {RefCommand::BALL_PLACEMENT_US_DIRECT, Constants::RULESET_STOP()}},
{"Ball Placement Us Force Start", {RefCommand::BALL_PLACEMENT_US, Constants::RULESET_STOP()}},
{"Ball Placement Them", {RefCommand::BALL_PLACEMENT_THEM, Constants::RULESET_STOP()}},
{"Ball Placement Us Free Kick", {RefCommand::BALL_PLACEMENT_US_DIRECT, Constants::RULESET_DEFAULT()}},
{"Ball Placement Us Force Start", {RefCommand::BALL_PLACEMENT_US, Constants::RULESET_DEFAULT()}},
{"Ball Placement Them", {RefCommand::BALL_PLACEMENT_THEM, Constants::RULESET_DEFAULT()}},
{"Halt", {RefCommand::HALT, Constants::RULESET_HALT()}},
{"Free Kick Them", {RefCommand::DIRECT_FREE_THEM, Constants::RULESET_DEFAULT()}},
{"Free Kick Us At Goal", {RefCommand::DIRECT_FREE_US, Constants::RULESET_DEFAULT()}},
Expand Down

0 comments on commit cd2fc29

Please sign in to comment.