diff --git a/arucoDetector.cpp b/arucoDetector.cpp index 59cb22b..92c8d47 100644 --- a/arucoDetector.cpp +++ b/arucoDetector.cpp @@ -1,5 +1,18 @@ #include "utils/ArucoDetector.h" +#include +#include +#include + +std::atomic stopRequested(false); + +void userInputThread() { + // Wait for the user to press Enter + std::cout << "Press Enter to stop the program..." << std::endl; + std::cin.ignore(); + stopRequested = true; +} + int main(int argc, char *argv[]) { // Settup argument parser @@ -32,6 +45,8 @@ int main(int argc, char *argv[]) // End argument parser + std::thread userInput(userInputThread); + const auto robotPose = Type::RobotPose{cv::Point3f(0, 0, 0), CV_PI/2}; ArucoDetector detector(robotPose, calibrationPath, BLUE, cameraId, headless); @@ -60,7 +75,15 @@ int main(int argc, char *argv[]) ArucoDetector::solarPanelDetector(p.first, p.second.first, p.second.first, robotPose); } } + + if (stopRequested) + { + break; + } } + // Wait for the user input thread to finish + userInput.join(); + return 0; } \ No newline at end of file diff --git a/utils/ArucoDetector.cpp b/utils/ArucoDetector.cpp index 17966b2..7d7f25b 100644 --- a/utils/ArucoDetector.cpp +++ b/utils/ArucoDetector.cpp @@ -3,9 +3,13 @@ ArucoDetector::ArucoDetector(const Type::RobotPose& pose, const std::string& calibrationPath, const Team team, const int cameraId, const bool headless) : robotPose(pose), headless(headless), team(team) { // this->detector = cv::aruco::ArucoDetector(getPredefinedDictionary(cv::aruco::DICT_4X4_50), cv::aruco::DetectorParameters()); - this->dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_50); + // this->dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_50); // this->parameters = cv::aruco::DetectorParameters(); + // 4.6 + this->dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_50); + + this->transformationMatrix = (cv::Mat_(4, 4) << cos(pose.theta), 0, sin(pose.theta), pose.position.x, 0, 1, 0, pose.position.y, diff --git a/utils/ArucoDetector.h b/utils/ArucoDetector.h index e9adfe0..30181b2 100644 --- a/utils/ArucoDetector.h +++ b/utils/ArucoDetector.h @@ -13,7 +13,11 @@ class ArucoDetector { cv::VideoCapture cap; + // 4.6 cv::Ptr dictionary; + + // 4.8 + // cv::aruco::Dictionary dictionary; // cv::aruco::DetectorParameters parameters; // cv::aruco::ArucoDetector detector;