From 7c22f84f34e1cea79e5439eac7274225106e8143 Mon Sep 17 00:00:00 2001 From: Becky Date: Thu, 18 Jul 2024 21:03:29 +0200 Subject: [PATCH] Different collision and more margin to their defense --- .../src/control/positionControl/CollisionCalculations.cpp | 6 +++--- roboteam_ai/src/world/FieldComputations.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roboteam_ai/src/control/positionControl/CollisionCalculations.cpp b/roboteam_ai/src/control/positionControl/CollisionCalculations.cpp index b5b6b4ef6..0f485e081 100644 --- a/roboteam_ai/src/control/positionControl/CollisionCalculations.cpp +++ b/roboteam_ai/src/control/positionControl/CollisionCalculations.cpp @@ -72,8 +72,8 @@ double CollisionCalculations::getFirstCollisionTimeMovingObject(const Trajectory auto pathLine = LineSegment(pathPoints[checkPoint - 1], pathPoints[checkPoint]); double velocityOurRobot = Trajectory.getVelocity(checkPoint * 0.1).length(); auto positionOurRobot = Trajectory.getPosition(checkPoint * 0.1); - double additionalMargin = std::pow(std::min(maxVel, velocityOurRobot) / maxVel, 2) * 0.2; - if (velocityOurRobot > 0.4 && avoidObjects.shouldAvoidOurRobots) { + double additionalMargin = std::pow(std::min(3.5, velocityOurRobot) / 3.5, 2) * 0.2; + if (velocityOurRobot > 0.7 && avoidObjects.shouldAvoidOurRobots) { for (const auto &ourOtherRobot : ourRobots) { const int &ourOtherRobotId = ourOtherRobot->getId(); if (ourOtherRobotId == robotId) { @@ -111,7 +111,7 @@ double CollisionCalculations::getFirstCollisionTimeMovingObject(const Trajectory } } } - if (velocityOurRobot > 0.4 && avoidObjects.shouldAvoidTheirRobots) { + if (velocityOurRobot > 0.7 && avoidObjects.shouldAvoidTheirRobots) { if (std::any_of(theirRobots.begin(), theirRobots.end(), [&](const auto &theirRobot) { return LineSegment(theirRobot->getPos() + theirRobot->getVel() * 0.1 * (checkPoint - 1), theirRobot->getPos() + theirRobot->getVel() * 0.1 * checkPoint) .closestDistanceToLineSegment(pathLine) < 2 * constants::ROBOT_RADIUS + additionalMargin; diff --git a/roboteam_ai/src/world/FieldComputations.cpp b/roboteam_ai/src/world/FieldComputations.cpp index 0e22ef900..0215b1c84 100644 --- a/roboteam_ai/src/world/FieldComputations.cpp +++ b/roboteam_ai/src/world/FieldComputations.cpp @@ -9,7 +9,7 @@ namespace rtt::ai { std::tuple FieldComputations::getDefenseAreaMargin() { - double theirDefenseAreaMargin = constants::ROBOT_RADIUS * 1.1 + constants::GO_TO_POS_ERROR_MARGIN; + double theirDefenseAreaMargin = constants::ROBOT_RADIUS * 1.4 + constants::GO_TO_POS_ERROR_MARGIN; double ourDefenseAreaMargin = -constants::ROBOT_RADIUS * 0.9 + constants::GO_TO_POS_ERROR_MARGIN; RuleSetName ruleSetTitle = GameStateManager::getCurrentGameState().getRuleSet().getTitle(); @@ -17,7 +17,7 @@ std::tuple FieldComputations::getDefenseAreaMargin() { if (ruleSetTitle == RuleSetName::STOP || currentGameState == RefCommand::DIRECT_FREE_THEM || currentGameState == RefCommand::KICKOFF_THEM || currentGameState == RefCommand::DIRECT_FREE_US) { - theirDefenseAreaMargin += 0.2; + theirDefenseAreaMargin += 0.3; } return std::make_tuple(theirDefenseAreaMargin, ourDefenseAreaMargin);