From 776f44f2714d8cd8503522474c45de1eacc74b3b Mon Sep 17 00:00:00 2001 From: ackimixs Date: Wed, 17 Apr 2024 09:57:57 +0200 Subject: [PATCH] change calculation fo distance --- aruco/ArucoDetector.cpp | 2 +- utils/utils.cpp | 4 ++-- utils/utils.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aruco/ArucoDetector.cpp b/aruco/ArucoDetector.cpp index d047c04..fb1a86d 100644 --- a/aruco/ArucoDetector.cpp +++ b/aruco/ArucoDetector.cpp @@ -212,7 +212,7 @@ std::pair>>> Ar std::sort(result.second.begin(), result.second.end(), [this](const std::pair>& a, const std::pair>& b) { - return distanceBetweenRobotAndTag(a.second.first) < distanceBetweenRobotAndTag(b.second.first); + return distanceBetweenRobotAndTagOnXY(a.second.first) < distanceBetweenRobotAndTagOnXY(b.second.first); }); if (!headless) diff --git a/utils/utils.cpp b/utils/utils.cpp index b257d27..98ff43b 100644 --- a/utils/utils.cpp +++ b/utils/utils.cpp @@ -1,6 +1,6 @@ #include "utils.h" -double distanceBetweenRobotAndTag(const cv::Mat& a) +double distanceBetweenRobotAndTagOnXY(const cv::Mat& a) { - return sqrt(pow(a.at(0, 0), 2) + pow(a.at(1, 0), 2) + pow(a.at(2, 0), 2)); + return sqrt(pow(a.at(0, 0), 2) + pow(a.at(2, 0), 2)); } \ No newline at end of file diff --git a/utils/utils.h b/utils/utils.h index 0793b5c..f219e54 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -18,4 +18,4 @@ enum Team YELLOW }; -double distanceBetweenRobotAndTag(const cv::Mat& a); \ No newline at end of file +double distanceBetweenRobotAndTagOnXY(const cv::Mat& a); \ No newline at end of file