Skip to content

Commit

Permalink
Defender counter starts at 0 instead of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JornJorn committed Oct 31, 2023
1 parent 2fe7fd1 commit 2a4365f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roboteam_ai/src/stp/computations/PositionComputations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ void PositionComputations::calculateInfoForDefenders(std::unordered_map<std::str
if (activeDefenderNames.empty()) {
auto loopSize = std::min(defenderNames.size(), enemyMap.size());
for (int i = 0; i < loopSize; i++) {
stpInfos["defender_" + std::to_string(i + 1)].setPositionToDefend(enemyMap.begin()->second);
stpInfos["defender_" + std::to_string(i)].setPositionToDefend(enemyMap.begin()->second);
enemyMap.erase(enemyMap.begin());
}
for (int i = loopSize; i < defenderNames.size(); i++) {
// For each waller, stand in the right wall position and look at the ball
auto positionToMoveTo = PositionComputations::getWallPosition(i, defenderNames.size() - enemyMap.size(), field, world);
auto& wallerStpInfo = stpInfos["defender_" + std::to_string(i + 1)];
auto& wallerStpInfo = stpInfos["defender_" + std::to_string(i)];

wallerStpInfo.setPositionToMoveTo(positionToMoveTo);
wallerStpInfo.setAngle((world->getWorld()->getBall()->get()->position - field.leftGoalArea.rightLine().center()).angle());
Expand Down

0 comments on commit 2a4365f

Please sign in to comment.