From a2a36fcc97fe3db6b45b57fe54f0c874e23e3901 Mon Sep 17 00:00:00 2001 From: Alexander de Ranitz Date: Mon, 17 Jan 2022 18:38:38 +0100 Subject: [PATCH 1/2] Clang-format --- src/ApplicationManager.cpp | 24 +++++++++---------- .../BBTrajectories/Trajectory2D.cpp | 3 ++- src/stp/plays/offensive/Attack.cpp | 2 +- src/world/Robot.cpp | 2 +- src/world/views/RobotView.cpp | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/ApplicationManager.cpp b/src/ApplicationManager.cpp index d0b47553d5..2bf072ee49 100644 --- a/src/ApplicationManager.cpp +++ b/src/ApplicationManager.cpp @@ -55,29 +55,29 @@ void ApplicationManager::start() { /// This play is only used for testing purposes, when needed uncomment this play! // plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); - //plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); + // plays.emplace_back(std::make_unique()); playChecker.setPlays(plays); int amountOfCycles = 0; diff --git a/src/control/positionControl/BBTrajectories/Trajectory2D.cpp b/src/control/positionControl/BBTrajectories/Trajectory2D.cpp index d0292b3e78..a182fadd8e 100644 --- a/src/control/positionControl/BBTrajectories/Trajectory2D.cpp +++ b/src/control/positionControl/BBTrajectories/Trajectory2D.cpp @@ -3,10 +3,11 @@ // #include "control/positionControl/BBTrajectories/Trajectory2D.h" -#include "control/positionControl/BBTrajectories/BBTrajectory2D.h" #include +#include "control/positionControl/BBTrajectories/BBTrajectory2D.h" + namespace rtt { Trajectory2D::Trajectory2D(const Vector2 &initialPos, const Vector2 &initialVel, const Vector2 &finalPos, double maxVel, double maxAcc) { diff --git a/src/stp/plays/offensive/Attack.cpp b/src/stp/plays/offensive/Attack.cpp index b85a0d7f5e..b4d55df003 100644 --- a/src/stp/plays/offensive/Attack.cpp +++ b/src/stp/plays/offensive/Attack.cpp @@ -72,7 +72,7 @@ void Attack::calculateInfoForRoles() noexcept { } bool Attack::shouldEndPlay() noexcept { - return std::any_of(roles.begin(), roles.end(), [](const std::unique_ptr& role) {return role != nullptr && role->getName() == "attacker" && role->finished();}); + return std::any_of(roles.begin(), roles.end(), [](const std::unique_ptr& role) { return role != nullptr && role->getName() == "attacker" && role->finished(); }); } const char* Attack::getName() { return "Attack"; } diff --git a/src/world/Robot.cpp b/src/world/Robot.cpp index d79a5c8cf7..f5bc3c519a 100644 --- a/src/world/Robot.cpp +++ b/src/world/Robot.cpp @@ -24,7 +24,7 @@ Robot::Robot(std::unordered_map &feedback, const workingBallSensor = ai::Constants::ROBOT_HAS_WORKING_BALL_SENSOR(id); } - if (team == Team::us){ + if (team == Team::us) { if (feedback.find(id) != feedback.end()) { updateFromFeedback(feedback[id]); } diff --git a/src/world/views/RobotView.cpp b/src/world/views/RobotView.cpp index 5b13d494b8..1fbbf04122 100644 --- a/src/world/views/RobotView.cpp +++ b/src/world/views/RobotView.cpp @@ -19,7 +19,7 @@ robot::Robot const *RobotView::operator->() const noexcept { return get(); } bool RobotView::hasBall(double maxDist, double maxAngle) const noexcept { // In the sim, we only use the ball sensor to determine if the robot has the ball // On the field, and for the enemies in the sim, we also use the camera to do so - return ((this->robotPtr->getTeam()==Team::them || SETTINGS.isSerialMode()) && hasBallAccordingToVision(maxDist, maxAngle)) || get()->ballSensorSeesBall(); + return ((this->robotPtr->getTeam() == Team::them || SETTINGS.isSerialMode()) && hasBallAccordingToVision(maxDist, maxAngle)) || get()->ballSensorSeesBall(); } Vector2 RobotView::getKicker() const noexcept { From ab60d81a03544e20254c7bf1fcc897555134cedf Mon Sep 17 00:00:00 2001 From: Floris Heinen Date: Thu, 20 Jan 2022 12:57:59 +0100 Subject: [PATCH 2/2] Fix formatting again --- src/stp/plays/referee_specific/BallPlacementUs.cpp | 3 ++- src/stp/tactics/passive/BlockBall.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stp/plays/referee_specific/BallPlacementUs.cpp b/src/stp/plays/referee_specific/BallPlacementUs.cpp index 9960e49484..c085efbe04 100644 --- a/src/stp/plays/referee_specific/BallPlacementUs.cpp +++ b/src/stp/plays/referee_specific/BallPlacementUs.cpp @@ -35,7 +35,8 @@ void BallPlacementUs::calculateInfoForRoles() noexcept { auto ballTarget = rtt::ai::GameStateManager::getRefereeDesignatedPosition(); // Adjust placement position to be one robot radius away in the distance of movement - if (stpInfos["ball_placer"].getRobot()) ballTarget -= (world->getWorld()->get()->getBall()->get()->getPos() - stpInfos["ball_placer"].getRobot()->get()->getPos()).stretchToLength(control_constants::ROBOT_RADIUS); + if (stpInfos["ball_placer"].getRobot()) + ballTarget -= (world->getWorld()->get()->getBall()->get()->getPos() - stpInfos["ball_placer"].getRobot()->get()->getPos()).stretchToLength(control_constants::ROBOT_RADIUS); stpInfos["ball_placer"].setPositionToMoveTo(ballTarget); diff --git a/src/stp/tactics/passive/BlockBall.cpp b/src/stp/tactics/passive/BlockBall.cpp index a7d18c1535..2fa2a96b36 100644 --- a/src/stp/tactics/passive/BlockBall.cpp +++ b/src/stp/tactics/passive/BlockBall.cpp @@ -62,7 +62,6 @@ Vector2 BlockBall::calculateTargetPosition(const world::view::BallView &ball, Ve default: distance = targetToBall.length() / 2; break; - } // Do not get closer than 4 robot radii (to avoid collisions)