From 55441a0efe26c615710609968c4e89ca9a4ce4c3 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Mon, 19 Oct 2026 09:18:04 +1000 Subject: [PATCH 1/4] Add aruco_ros (not on Windows) [skip ci] Ports RoboStack/ros-lyrical#87. The patches make aruco build with OpenCV 5 and Eigen 5 from conda-forge (version requirement, top-level headers, cv::Error::Code exceptions, Eigen3::Eigen), and fix aruco_ros' hard-coded opencv4/ include. jazzy and lyrical (5.0.5) also carry the PR's target_link_libraries / tf2 .hpp changes for aruco_ros; humble and rolling (5.0.6) have those upstream. Co-authored-by: Kamil Baradziej <49471097+baradejoo@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 --- distros/humble/patch/ros2-aruco-ros.patch | 13 + distros/humble/patch/ros2-aruco.patch | 503 +++++++++++++++++++++ distros/jazzy/patch/ros2-aruco-ros.patch | 149 ++++++ distros/jazzy/patch/ros2-aruco.patch | 503 +++++++++++++++++++++ distros/lyrical/patch/ros2-aruco-ros.patch | 149 ++++++ distros/lyrical/patch/ros2-aruco.patch | 503 +++++++++++++++++++++ distros/rolling/patch/ros2-aruco-ros.patch | 13 + distros/rolling/patch/ros2-aruco.patch | 503 +++++++++++++++++++++ shared/vinca.yaml | 2 + 9 files changed, 2338 insertions(+) create mode 100644 distros/humble/patch/ros2-aruco-ros.patch create mode 100644 distros/humble/patch/ros2-aruco.patch create mode 100644 distros/jazzy/patch/ros2-aruco-ros.patch create mode 100644 distros/jazzy/patch/ros2-aruco.patch create mode 100644 distros/lyrical/patch/ros2-aruco-ros.patch create mode 100644 distros/lyrical/patch/ros2-aruco.patch create mode 100644 distros/rolling/patch/ros2-aruco-ros.patch create mode 100644 distros/rolling/patch/ros2-aruco.patch diff --git a/distros/humble/patch/ros2-aruco-ros.patch b/distros/humble/patch/ros2-aruco-ros.patch new file mode 100644 index 00000000..15537de0 --- /dev/null +++ b/distros/humble/patch/ros2-aruco-ros.patch @@ -0,0 +1,13 @@ +diff --git a/src/aruco_ros_utils.cpp b/src/aruco_ros_utils.cpp +index 707ea97..392b154 100644 +--- a/src/aruco_ros_utils.cpp ++++ b/src/aruco_ros_utils.cpp +@@ -8,7 +8,7 @@ + #else + #include "cv_bridge/cv_bridge.h" + #endif +-#include "opencv4/opencv2/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "rclcpp/logging.hpp" + #include "tf2/transform_datatypes.hpp" + diff --git a/distros/humble/patch/ros2-aruco.patch b/distros/humble/patch/ros2-aruco.patch new file mode 100644 index 00000000..e96fe592 --- /dev/null +++ b/distros/humble/patch/ros2-aruco.patch @@ -0,0 +1,503 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 896dae9..68e29ef 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") + # find dependencies + find_package(ament_cmake) + find_package(Eigen3 REQUIRED) +-find_package(OpenCV 4.2.0 REQUIRED) ++find_package(OpenCV REQUIRED) + + add_library(${PROJECT_NAME} + SHARED +@@ -48,7 +48,7 @@ target_include_directories( + ${EIGEN3_INCLUDE_DIRS} + ) + +-target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) + + ############# + ## Install ## +diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp +index cb6f440..2d38d96 100755 +--- a/src/aruco/cameraparameters.cpp ++++ b/src/aruco/cameraparameters.cpp +@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + */ + #include "cameraparameters.h" + +-#include ++#include + #include + + #include +@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, + } + + if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) +- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", ++ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", + __FILE__, __LINE__); + cameraMatrix.convertTo(CameraMatrix, CV_32FC1); + if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) +- throw cv::Exception(9000, "invalid input distorsionCoeff", ++ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", + "CameraParameters::setParams", __FILE__, __LINE__); + cv::Mat auxD; + +@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M + void CameraParameters::saveToFile(string path, bool inXML) + { + if (!isValid()) +- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); + if (!inXML) + { + ofstream file(path.c_str()); + if (!file) +- throw cv::Exception(9006, "could not open file:" + path, ++ throw cv::Exception(static_cast(9006), "could not open file:" + path, + "CameraParameters::saveToFile", __FILE__, __LINE__); + file << "# Aruco 1.0 CameraParameters" << endl; + file << "fx = " << CameraMatrix.at(0, 0) << endl; +@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) + void CameraParameters::resize(cv::Size size) + { + if (!isValid()) +- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); + if (size == CamSize) + return; + // now, read the camera size +@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Camera_Matrix"] >> MCamera; + if (MCamera.cols == 0 || MCamera.rows == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + +@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) + fs["image_Width"] >> w; + fs["image_Height"] >> h; + if (w == -1 || h == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + if (MCamera.type() != CV_32FC1) +@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Distortion_Coefficients"] >> MDist; + if (MDist.total() < 4) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + // convert to 32 and get the 4 first elements only +@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, + std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " + << __FILE__ << " " << __LINE__ << endl; + if (isValid() == false) +- throw cv::Exception(9100, "invalid camera parameters", ++ throw cv::Exception(static_cast(9100), "invalid camera parameters", + "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); + + // Deterime the rsized info +@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh + cparam[2][2] *= -1.0; + + if (arParamDecompMat(cparam, icpara, trans) < 0) +- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", ++ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", + __FILE__, __LINE__); + + for (i = 0; i < 3; i++) +diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp +index 37484df..0a0bf19 100755 +--- a/src/aruco/cvdrawingutils.cpp ++++ b/src/aruco/cvdrawingutils.cpp +@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +-#include ++#include + #include + #include "cvdrawingutils.h" + #include "cameraparameters.h" +diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp +index c399c57..d227fdb 100755 +--- a/src/aruco/dictionary.cpp ++++ b/src/aruco/dictionary.cpp +@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "Dictionary::loadPredefined", "dictionary.h", -1); + break; + case ALL_DICTS: +@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + }; + return d; +@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) + else + return CUSTOM; + +- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary ++ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary + // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); + } + +@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + const std::vector &ids, bool chess_board) + { + if (gridSize.height * gridSize.width != int(ids.size())) +- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", ++ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", + "Dictionary::createMarkerMap", __FILE__, __LINE__); + MarkerMap TInfo; + +@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + if (toWrite) + { + if (CurMarkerIdx >= int(ids.size())) +- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", ++ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", + "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); + TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); + /// \todo use const auto & +diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp +index 56db5a1..42277ed 100755 +--- a/src/aruco/fractaldetector.cpp ++++ b/src/aruco/fractaldetector.cpp +@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + along with this program. If not, see . + */ + #include "fractaldetector.h" +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "cvdrawingutils.h" + #include + #include "aruco_cvversioning.h" +diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp +index 75f1f1c..4b1b502 100755 +--- a/src/aruco/fractallabelers/fractalmarkerset.cpp ++++ b/src/aruco/fractallabelers/fractalmarkerset.cpp +@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + } + return fms; +@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + } + catch (std::exception &ex) + { +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); + } + +@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + std::vector coordinates3d; + (*itp) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + "invalid file type 3", __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + corners.push_back(point); +@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) + FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + { + if (!(isExpressedInPixels() || isNormalize())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + FractalMarkerSet FractalMarkerSet::normalize() + { + if (!(isExpressedInPixels() || isExpressedInMeters())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() + cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) + { + if (fractalMarkerCollection.size() < 1) +- throw cv::Exception(9001, "There is not any fractal marker loaded", ++ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", + "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); + + // Smallest fractal marker +diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp +index 0ec8983..4cd19da 100755 +--- a/src/aruco/fractallabelers/fractalposetracker.cpp ++++ b/src/aruco/fractallabelers/fractalposetracker.cpp +@@ -5,7 +5,8 @@ + #include "timers.h" + + +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" ++#include "opencv2/features2d.hpp" + #include "aruco_cvversioning.h" + + namespace aruco +@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, + _fractalMarker = msconf; + + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) +- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", + __FILE__, __LINE__); + if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && + markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) +diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp +index 917ba63..083aede 100755 +--- a/src/aruco/marker.cpp ++++ b/src/aruco/marker.cpp +@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + /// \todo set this definition in the cmake code + #define _USE_MATH_DEFINES + +-#include ++#include + #include + + #include +@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + cv::Mat Rot(3, 3, CV_32FC1), Jacob; + cv::Rodrigues(Rvec, Rot, Jacob); +@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo + void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) + { + if (!CP.isValid()) +- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, + setYPerpendicular); +@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: + cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) + { + if (!isValid()) +- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + if (markerSizeMeters <= 0) +- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", ++ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", + __FILE__, __LINE__); + if (camMatrix.rows == 0 || camMatrix.cols == 0) +- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); + + std::vector objpoints = get3DPoints(markerSizeMeters); + +diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp +index 94de8d0..40cde14 100755 +--- a/src/aruco/markerdetector.cpp ++++ b/src/aruco/markerdetector.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp +index 1a48c5b..3f8d8fe 100755 +--- a/src/aruco/markerdetector_impl.cpp ++++ b/src/aruco/markerdetector_impl.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const + bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) + { + if (points.size() != 4) +- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); + // obtain the perspective transform + Point2f pointsRes[4], pointsIn[4]; + for (int i = 0; i < 4; i++) +diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp +index 5afc105..55dd028 100755 +--- a/src/aruco/markermap.cpp ++++ b/src/aruco/markermap.cpp +@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + #include "markermap.h" + #include "dictionary.h" + +-#include ++#include + #include + + #include +@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) + { + cv::FileStorage fs(sfile, cv::FileStorage::READ); + if (!fs.isOpened()) +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + string(" file not opened ") + sfile, __FILE__, __LINE__); + readFromFile(fs); + } + catch (std::exception& ex) + { +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); + } + } +@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + int aux = 0; + // look for the nmarkers + if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); + fs["aruco_bc_nmarkers"] >> aux; + resize(aux); + fs["aruco_bc_mInfoType"] >> mInfoType; +@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + vector coordinates3d; + (*itc) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", + __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + at(i).push_back(point); +@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const + for (size_t i = 0; i < size(); i++) + if (at(i).id == id) + return at(i); +- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", ++ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", + "Marker with the id given is not found", __FILE__, __LINE__); + } + +@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co + invalid |= false; + } + if (invalid) +- throw cv::Exception(9002, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + Mat Rot(3, 3, CV_32FC1), Jacob; + Rodrigues(Rvec, Rot, Jacob); +@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const + MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + { + if (!isExpressedInPixels()) +- throw cv::Exception(-1, "The board is not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", + "MarkerMap::convertToMeters", __FILE__, __LINE__); + // first, we are assuming all markers are equally sized. So, lets get the size in pixels + int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); +@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + cv::Mat MarkerMap::getImage(float METER2PIX) const + { + if (mInfoType == NONE) +- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", ++ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", + "MarkerMap::getImage", __FILE__, __LINE__); + if (METER2PIX <= 0 && mInfoType != PIX) +- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", + "MarkerMap::getImage", __FILE__, __LINE__); + + auto Dict = Dictionary::loadPredefined(dictionary); +diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp +index 4cb14f4..7b571a2 100755 +--- a/src/aruco/posetracker.cpp ++++ b/src/aruco/posetracker.cpp +@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, + _msconf = msconf; + _cam_params = cam_params; + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::NONE) +- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", + __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX) + _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/jazzy/patch/ros2-aruco-ros.patch b/distros/jazzy/patch/ros2-aruco-ros.patch new file mode 100644 index 00000000..d9e3d2e0 --- /dev/null +++ b/distros/jazzy/patch/ros2-aruco-ros.patch @@ -0,0 +1,149 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5f6f4a9..d2d1190 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,6 +28,20 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) + find_package(${Dependency} REQUIRED) + endforeach() + ++set(THIS_PACKAGE_TARGETS ++ cv_bridge::cv_bridge ++ ${geometry_msgs_TARGETS} ++ image_transport::image_transport ++ rclcpp::rclcpp ++ tf2::tf2 ++ tf2_ros::tf2_ros ++ tf2_geometry_msgs::tf2_geometry_msgs ++ ${aruco_LIBRARIES} ++ ${aruco_msgs_TARGETS} ++ ${sensor_msgs_TARGETS} ++ ${visualization_msgs_TARGETS} ++) ++ + #generate_dynamic_reconfigure_options( + # cfg/ArucoThreshold.cfg + #) +@@ -40,8 +54,9 @@ target_include_directories(aruco_ros_utils + target_include_directories(aruco_ros_utils + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(aruco_ros_utils ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(aruco_ros_utils ${THIS_PACKAGE_TARGETS}) + target_link_libraries(aruco_ros_utils ${OpenCV_LIBRARIES}) + + add_executable(single src/simple_single.cpp +@@ -54,8 +69,9 @@ target_include_directories(single + target_include_directories(single + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(single ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(single ${THIS_PACKAGE_TARGETS}) + target_link_libraries(single ${OpenCV_LIBRARIES}) + + add_executable(double src/simple_double.cpp +@@ -67,8 +83,9 @@ target_include_directories(double + target_include_directories(double + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(double ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(double ${THIS_PACKAGE_TARGETS}) + target_link_libraries(double ${OpenCV_LIBRARIES}) + + add_executable(marker_publisher src/marker_publish.cpp +@@ -80,8 +97,9 @@ target_include_directories(marker_publisher + target_include_directories(marker_publisher + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(marker_publisher ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(marker_publisher ${THIS_PACKAGE_TARGETS}) + target_link_libraries(marker_publisher ${OpenCV_LIBRARIES}) + + if(BUILD_TESTING) +diff --git a/include/aruco_ros/aruco_ros_utils.hpp b/include/aruco_ros/aruco_ros_utils.hpp +index b030211..7586a53 100644 +--- a/include/aruco_ros/aruco_ros_utils.hpp ++++ b/include/aruco_ros/aruco_ros_utils.hpp +@@ -9,8 +9,8 @@ + #include "geometry_msgs/msg/pose_stamped.hpp" + #include "sensor_msgs/msg/camera_info.hpp" + #include "sensor_msgs/msg/image.hpp" +-#include "tf2/LinearMath/Transform.h" +-#include "tf2/transform_datatypes.h" ++#include "tf2/LinearMath/Transform.hpp" ++#include "tf2/transform_datatypes.hpp" + #include "visualization_msgs/msg/marker.hpp" + + namespace aruco_ros +diff --git a/src/aruco_ros_utils.cpp b/src/aruco_ros_utils.cpp +index c501b61..392b154 100644 +--- a/src/aruco_ros_utils.cpp ++++ b/src/aruco_ros_utils.cpp +@@ -8,9 +8,9 @@ + #else + #include "cv_bridge/cv_bridge.h" + #endif +-#include "opencv4/opencv2/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "rclcpp/logging.hpp" +-#include "tf2/transform_datatypes.h" ++#include "tf2/transform_datatypes.hpp" + + aruco::CameraParameters aruco_ros::rosCameraInfo2ArucoCamParams( + const sensor_msgs::msg::CameraInfo & cam_info, +diff --git a/src/marker_publish.cpp b/src/marker_publish.cpp +index a578e77..4765f19 100644 +--- a/src/marker_publish.cpp ++++ b/src/marker_publish.cpp +@@ -50,8 +50,8 @@ + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" + #include "std_msgs/msg/u_int32_multi_array.hpp" +-#include "tf2_ros/transform_listener.h" +-#include "tf2_ros/buffer.h" ++#include "tf2_ros/transform_listener.hpp" ++#include "tf2_ros/buffer.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + + using namespace std::chrono_literals; +diff --git a/src/simple_double.cpp b/src/simple_double.cpp +index afb7ada..3f41cba 100644 +--- a/src/simple_double.cpp ++++ b/src/simple_double.cpp +@@ -52,9 +52,9 @@ + #include "rclcpp/rclcpp.hpp" + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" +-#include "tf2_ros/transform_broadcaster.h" +-#include "tf2_ros/buffer.h" +-#include "tf2_ros/transform_listener.h" ++#include "tf2_ros/transform_broadcaster.hpp" ++#include "tf2_ros/buffer.hpp" ++#include "tf2_ros/transform_listener.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + #include "visualization_msgs/msg/marker.hpp" + +diff --git a/src/simple_single.cpp b/src/simple_single.cpp +index 6a4035d..bc7c784 100644 +--- a/src/simple_single.cpp ++++ b/src/simple_single.cpp +@@ -50,9 +50,9 @@ + #include "rclcpp/rclcpp.hpp" + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" +-#include "tf2_ros/transform_broadcaster.h" +-#include "tf2_ros/buffer.h" +-#include "tf2_ros/transform_listener.h" ++#include "tf2_ros/transform_broadcaster.hpp" ++#include "tf2_ros/buffer.hpp" ++#include "tf2_ros/transform_listener.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + #include "visualization_msgs/msg/marker.hpp" + diff --git a/distros/jazzy/patch/ros2-aruco.patch b/distros/jazzy/patch/ros2-aruco.patch new file mode 100644 index 00000000..bb36a135 --- /dev/null +++ b/distros/jazzy/patch/ros2-aruco.patch @@ -0,0 +1,503 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ee3c69a..9ed1af6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") + # find dependencies + find_package(ament_cmake) + find_package(Eigen3 REQUIRED) +-find_package(OpenCV 4.2.0 REQUIRED) ++find_package(OpenCV REQUIRED) + + add_library(${PROJECT_NAME} + SHARED +@@ -48,7 +48,7 @@ target_include_directories( + ${EIGEN3_INCLUDE_DIRS} + ) + +-target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) + + ############# + ## Install ## +diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp +index cb6f440..2d38d96 100755 +--- a/src/aruco/cameraparameters.cpp ++++ b/src/aruco/cameraparameters.cpp +@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + */ + #include "cameraparameters.h" + +-#include ++#include + #include + + #include +@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, + } + + if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) +- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", ++ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", + __FILE__, __LINE__); + cameraMatrix.convertTo(CameraMatrix, CV_32FC1); + if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) +- throw cv::Exception(9000, "invalid input distorsionCoeff", ++ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", + "CameraParameters::setParams", __FILE__, __LINE__); + cv::Mat auxD; + +@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M + void CameraParameters::saveToFile(string path, bool inXML) + { + if (!isValid()) +- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); + if (!inXML) + { + ofstream file(path.c_str()); + if (!file) +- throw cv::Exception(9006, "could not open file:" + path, ++ throw cv::Exception(static_cast(9006), "could not open file:" + path, + "CameraParameters::saveToFile", __FILE__, __LINE__); + file << "# Aruco 1.0 CameraParameters" << endl; + file << "fx = " << CameraMatrix.at(0, 0) << endl; +@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) + void CameraParameters::resize(cv::Size size) + { + if (!isValid()) +- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); + if (size == CamSize) + return; + // now, read the camera size +@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Camera_Matrix"] >> MCamera; + if (MCamera.cols == 0 || MCamera.rows == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + +@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) + fs["image_Width"] >> w; + fs["image_Height"] >> h; + if (w == -1 || h == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + if (MCamera.type() != CV_32FC1) +@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Distortion_Coefficients"] >> MDist; + if (MDist.total() < 4) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + // convert to 32 and get the 4 first elements only +@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, + std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " + << __FILE__ << " " << __LINE__ << endl; + if (isValid() == false) +- throw cv::Exception(9100, "invalid camera parameters", ++ throw cv::Exception(static_cast(9100), "invalid camera parameters", + "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); + + // Deterime the rsized info +@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh + cparam[2][2] *= -1.0; + + if (arParamDecompMat(cparam, icpara, trans) < 0) +- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", ++ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", + __FILE__, __LINE__); + + for (i = 0; i < 3; i++) +diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp +index 37484df..0a0bf19 100755 +--- a/src/aruco/cvdrawingutils.cpp ++++ b/src/aruco/cvdrawingutils.cpp +@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +-#include ++#include + #include + #include "cvdrawingutils.h" + #include "cameraparameters.h" +diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp +index c399c57..d227fdb 100755 +--- a/src/aruco/dictionary.cpp ++++ b/src/aruco/dictionary.cpp +@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "Dictionary::loadPredefined", "dictionary.h", -1); + break; + case ALL_DICTS: +@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + }; + return d; +@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) + else + return CUSTOM; + +- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary ++ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary + // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); + } + +@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + const std::vector &ids, bool chess_board) + { + if (gridSize.height * gridSize.width != int(ids.size())) +- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", ++ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", + "Dictionary::createMarkerMap", __FILE__, __LINE__); + MarkerMap TInfo; + +@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + if (toWrite) + { + if (CurMarkerIdx >= int(ids.size())) +- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", ++ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", + "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); + TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); + /// \todo use const auto & +diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp +index 56db5a1..42277ed 100755 +--- a/src/aruco/fractaldetector.cpp ++++ b/src/aruco/fractaldetector.cpp +@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + along with this program. If not, see . + */ + #include "fractaldetector.h" +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "cvdrawingutils.h" + #include + #include "aruco_cvversioning.h" +diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp +index 75f1f1c..4b1b502 100755 +--- a/src/aruco/fractallabelers/fractalmarkerset.cpp ++++ b/src/aruco/fractallabelers/fractalmarkerset.cpp +@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + } + return fms; +@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + } + catch (std::exception &ex) + { +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); + } + +@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + std::vector coordinates3d; + (*itp) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + "invalid file type 3", __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + corners.push_back(point); +@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) + FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + { + if (!(isExpressedInPixels() || isNormalize())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + FractalMarkerSet FractalMarkerSet::normalize() + { + if (!(isExpressedInPixels() || isExpressedInMeters())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() + cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) + { + if (fractalMarkerCollection.size() < 1) +- throw cv::Exception(9001, "There is not any fractal marker loaded", ++ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", + "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); + + // Smallest fractal marker +diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp +index ac17b7f..5fbb2f2 100755 +--- a/src/aruco/fractallabelers/fractalposetracker.cpp ++++ b/src/aruco/fractallabelers/fractalposetracker.cpp +@@ -5,7 +5,8 @@ + #include "timers.h" + + +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" ++#include "opencv2/features2d.hpp" + #include "aruco_cvversioning.h" + + namespace aruco +@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, + _fractalMarker = msconf; + + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) +- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", + __FILE__, __LINE__); + if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && + markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) +diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp +index 917ba63..083aede 100755 +--- a/src/aruco/marker.cpp ++++ b/src/aruco/marker.cpp +@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + /// \todo set this definition in the cmake code + #define _USE_MATH_DEFINES + +-#include ++#include + #include + + #include +@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + cv::Mat Rot(3, 3, CV_32FC1), Jacob; + cv::Rodrigues(Rvec, Rot, Jacob); +@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo + void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) + { + if (!CP.isValid()) +- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, + setYPerpendicular); +@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: + cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) + { + if (!isValid()) +- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + if (markerSizeMeters <= 0) +- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", ++ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", + __FILE__, __LINE__); + if (camMatrix.rows == 0 || camMatrix.cols == 0) +- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); + + std::vector objpoints = get3DPoints(markerSizeMeters); + +diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp +index debc1f4..66de492 100755 +--- a/src/aruco/markerdetector.cpp ++++ b/src/aruco/markerdetector.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp +index e1a21a6..575645f 100755 +--- a/src/aruco/markerdetector_impl.cpp ++++ b/src/aruco/markerdetector_impl.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const + bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) + { + if (points.size() != 4) +- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); + // obtain the perspective transform + Point2f pointsRes[4], pointsIn[4]; + for (int i = 0; i < 4; i++) +diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp +index 5afc105..55dd028 100755 +--- a/src/aruco/markermap.cpp ++++ b/src/aruco/markermap.cpp +@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + #include "markermap.h" + #include "dictionary.h" + +-#include ++#include + #include + + #include +@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) + { + cv::FileStorage fs(sfile, cv::FileStorage::READ); + if (!fs.isOpened()) +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + string(" file not opened ") + sfile, __FILE__, __LINE__); + readFromFile(fs); + } + catch (std::exception& ex) + { +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); + } + } +@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + int aux = 0; + // look for the nmarkers + if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); + fs["aruco_bc_nmarkers"] >> aux; + resize(aux); + fs["aruco_bc_mInfoType"] >> mInfoType; +@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + vector coordinates3d; + (*itc) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", + __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + at(i).push_back(point); +@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const + for (size_t i = 0; i < size(); i++) + if (at(i).id == id) + return at(i); +- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", ++ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", + "Marker with the id given is not found", __FILE__, __LINE__); + } + +@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co + invalid |= false; + } + if (invalid) +- throw cv::Exception(9002, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + Mat Rot(3, 3, CV_32FC1), Jacob; + Rodrigues(Rvec, Rot, Jacob); +@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const + MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + { + if (!isExpressedInPixels()) +- throw cv::Exception(-1, "The board is not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", + "MarkerMap::convertToMeters", __FILE__, __LINE__); + // first, we are assuming all markers are equally sized. So, lets get the size in pixels + int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); +@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + cv::Mat MarkerMap::getImage(float METER2PIX) const + { + if (mInfoType == NONE) +- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", ++ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", + "MarkerMap::getImage", __FILE__, __LINE__); + if (METER2PIX <= 0 && mInfoType != PIX) +- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", + "MarkerMap::getImage", __FILE__, __LINE__); + + auto Dict = Dictionary::loadPredefined(dictionary); +diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp +index 4cb14f4..7b571a2 100755 +--- a/src/aruco/posetracker.cpp ++++ b/src/aruco/posetracker.cpp +@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, + _msconf = msconf; + _cam_params = cam_params; + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::NONE) +- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", + __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX) + _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/lyrical/patch/ros2-aruco-ros.patch b/distros/lyrical/patch/ros2-aruco-ros.patch new file mode 100644 index 00000000..d9e3d2e0 --- /dev/null +++ b/distros/lyrical/patch/ros2-aruco-ros.patch @@ -0,0 +1,149 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5f6f4a9..d2d1190 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,6 +28,20 @@ foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS}) + find_package(${Dependency} REQUIRED) + endforeach() + ++set(THIS_PACKAGE_TARGETS ++ cv_bridge::cv_bridge ++ ${geometry_msgs_TARGETS} ++ image_transport::image_transport ++ rclcpp::rclcpp ++ tf2::tf2 ++ tf2_ros::tf2_ros ++ tf2_geometry_msgs::tf2_geometry_msgs ++ ${aruco_LIBRARIES} ++ ${aruco_msgs_TARGETS} ++ ${sensor_msgs_TARGETS} ++ ${visualization_msgs_TARGETS} ++) ++ + #generate_dynamic_reconfigure_options( + # cfg/ArucoThreshold.cfg + #) +@@ -40,8 +54,9 @@ target_include_directories(aruco_ros_utils + target_include_directories(aruco_ros_utils + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(aruco_ros_utils ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(aruco_ros_utils ${THIS_PACKAGE_TARGETS}) + target_link_libraries(aruco_ros_utils ${OpenCV_LIBRARIES}) + + add_executable(single src/simple_single.cpp +@@ -54,8 +69,9 @@ target_include_directories(single + target_include_directories(single + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(single ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(single ${THIS_PACKAGE_TARGETS}) + target_link_libraries(single ${OpenCV_LIBRARIES}) + + add_executable(double src/simple_double.cpp +@@ -67,8 +83,9 @@ target_include_directories(double + target_include_directories(double + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(double ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(double ${THIS_PACKAGE_TARGETS}) + target_link_libraries(double ${OpenCV_LIBRARIES}) + + add_executable(marker_publisher src/marker_publish.cpp +@@ -80,8 +97,9 @@ target_include_directories(marker_publisher + target_include_directories(marker_publisher + SYSTEM PUBLIC + ${OpenCV_INCLUDE_DIRS} ++ ${aruco_INCLUDE_DIRS} + ) +-ament_target_dependencies(marker_publisher ${THIS_PACKAGE_INCLUDE_DEPENDS}) ++target_link_libraries(marker_publisher ${THIS_PACKAGE_TARGETS}) + target_link_libraries(marker_publisher ${OpenCV_LIBRARIES}) + + if(BUILD_TESTING) +diff --git a/include/aruco_ros/aruco_ros_utils.hpp b/include/aruco_ros/aruco_ros_utils.hpp +index b030211..7586a53 100644 +--- a/include/aruco_ros/aruco_ros_utils.hpp ++++ b/include/aruco_ros/aruco_ros_utils.hpp +@@ -9,8 +9,8 @@ + #include "geometry_msgs/msg/pose_stamped.hpp" + #include "sensor_msgs/msg/camera_info.hpp" + #include "sensor_msgs/msg/image.hpp" +-#include "tf2/LinearMath/Transform.h" +-#include "tf2/transform_datatypes.h" ++#include "tf2/LinearMath/Transform.hpp" ++#include "tf2/transform_datatypes.hpp" + #include "visualization_msgs/msg/marker.hpp" + + namespace aruco_ros +diff --git a/src/aruco_ros_utils.cpp b/src/aruco_ros_utils.cpp +index c501b61..392b154 100644 +--- a/src/aruco_ros_utils.cpp ++++ b/src/aruco_ros_utils.cpp +@@ -8,9 +8,9 @@ + #else + #include "cv_bridge/cv_bridge.h" + #endif +-#include "opencv4/opencv2/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "rclcpp/logging.hpp" +-#include "tf2/transform_datatypes.h" ++#include "tf2/transform_datatypes.hpp" + + aruco::CameraParameters aruco_ros::rosCameraInfo2ArucoCamParams( + const sensor_msgs::msg::CameraInfo & cam_info, +diff --git a/src/marker_publish.cpp b/src/marker_publish.cpp +index a578e77..4765f19 100644 +--- a/src/marker_publish.cpp ++++ b/src/marker_publish.cpp +@@ -50,8 +50,8 @@ + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" + #include "std_msgs/msg/u_int32_multi_array.hpp" +-#include "tf2_ros/transform_listener.h" +-#include "tf2_ros/buffer.h" ++#include "tf2_ros/transform_listener.hpp" ++#include "tf2_ros/buffer.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + + using namespace std::chrono_literals; +diff --git a/src/simple_double.cpp b/src/simple_double.cpp +index afb7ada..3f41cba 100644 +--- a/src/simple_double.cpp ++++ b/src/simple_double.cpp +@@ -52,9 +52,9 @@ + #include "rclcpp/rclcpp.hpp" + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" +-#include "tf2_ros/transform_broadcaster.h" +-#include "tf2_ros/buffer.h" +-#include "tf2_ros/transform_listener.h" ++#include "tf2_ros/transform_broadcaster.hpp" ++#include "tf2_ros/buffer.hpp" ++#include "tf2_ros/transform_listener.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + #include "visualization_msgs/msg/marker.hpp" + +diff --git a/src/simple_single.cpp b/src/simple_single.cpp +index 6a4035d..bc7c784 100644 +--- a/src/simple_single.cpp ++++ b/src/simple_single.cpp +@@ -50,9 +50,9 @@ + #include "rclcpp/rclcpp.hpp" + #include "rcpputils/asserts.hpp" + #include "sensor_msgs/image_encodings.hpp" +-#include "tf2_ros/transform_broadcaster.h" +-#include "tf2_ros/buffer.h" +-#include "tf2_ros/transform_listener.h" ++#include "tf2_ros/transform_broadcaster.hpp" ++#include "tf2_ros/buffer.hpp" ++#include "tf2_ros/transform_listener.hpp" + #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" + #include "visualization_msgs/msg/marker.hpp" + diff --git a/distros/lyrical/patch/ros2-aruco.patch b/distros/lyrical/patch/ros2-aruco.patch new file mode 100644 index 00000000..bb36a135 --- /dev/null +++ b/distros/lyrical/patch/ros2-aruco.patch @@ -0,0 +1,503 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ee3c69a..9ed1af6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") + # find dependencies + find_package(ament_cmake) + find_package(Eigen3 REQUIRED) +-find_package(OpenCV 4.2.0 REQUIRED) ++find_package(OpenCV REQUIRED) + + add_library(${PROJECT_NAME} + SHARED +@@ -48,7 +48,7 @@ target_include_directories( + ${EIGEN3_INCLUDE_DIRS} + ) + +-target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) + + ############# + ## Install ## +diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp +index cb6f440..2d38d96 100755 +--- a/src/aruco/cameraparameters.cpp ++++ b/src/aruco/cameraparameters.cpp +@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + */ + #include "cameraparameters.h" + +-#include ++#include + #include + + #include +@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, + } + + if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) +- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", ++ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", + __FILE__, __LINE__); + cameraMatrix.convertTo(CameraMatrix, CV_32FC1); + if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) +- throw cv::Exception(9000, "invalid input distorsionCoeff", ++ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", + "CameraParameters::setParams", __FILE__, __LINE__); + cv::Mat auxD; + +@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M + void CameraParameters::saveToFile(string path, bool inXML) + { + if (!isValid()) +- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); + if (!inXML) + { + ofstream file(path.c_str()); + if (!file) +- throw cv::Exception(9006, "could not open file:" + path, ++ throw cv::Exception(static_cast(9006), "could not open file:" + path, + "CameraParameters::saveToFile", __FILE__, __LINE__); + file << "# Aruco 1.0 CameraParameters" << endl; + file << "fx = " << CameraMatrix.at(0, 0) << endl; +@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) + void CameraParameters::resize(cv::Size size) + { + if (!isValid()) +- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); + if (size == CamSize) + return; + // now, read the camera size +@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Camera_Matrix"] >> MCamera; + if (MCamera.cols == 0 || MCamera.rows == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + +@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) + fs["image_Width"] >> w; + fs["image_Height"] >> h; + if (w == -1 || h == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + if (MCamera.type() != CV_32FC1) +@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Distortion_Coefficients"] >> MDist; + if (MDist.total() < 4) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + // convert to 32 and get the 4 first elements only +@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, + std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " + << __FILE__ << " " << __LINE__ << endl; + if (isValid() == false) +- throw cv::Exception(9100, "invalid camera parameters", ++ throw cv::Exception(static_cast(9100), "invalid camera parameters", + "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); + + // Deterime the rsized info +@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh + cparam[2][2] *= -1.0; + + if (arParamDecompMat(cparam, icpara, trans) < 0) +- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", ++ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", + __FILE__, __LINE__); + + for (i = 0; i < 3; i++) +diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp +index 37484df..0a0bf19 100755 +--- a/src/aruco/cvdrawingutils.cpp ++++ b/src/aruco/cvdrawingutils.cpp +@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +-#include ++#include + #include + #include "cvdrawingutils.h" + #include "cameraparameters.h" +diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp +index c399c57..d227fdb 100755 +--- a/src/aruco/dictionary.cpp ++++ b/src/aruco/dictionary.cpp +@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "Dictionary::loadPredefined", "dictionary.h", -1); + break; + case ALL_DICTS: +@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + }; + return d; +@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) + else + return CUSTOM; + +- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary ++ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary + // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); + } + +@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + const std::vector &ids, bool chess_board) + { + if (gridSize.height * gridSize.width != int(ids.size())) +- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", ++ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", + "Dictionary::createMarkerMap", __FILE__, __LINE__); + MarkerMap TInfo; + +@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + if (toWrite) + { + if (CurMarkerIdx >= int(ids.size())) +- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", ++ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", + "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); + TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); + /// \todo use const auto & +diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp +index 56db5a1..42277ed 100755 +--- a/src/aruco/fractaldetector.cpp ++++ b/src/aruco/fractaldetector.cpp +@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + along with this program. If not, see . + */ + #include "fractaldetector.h" +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "cvdrawingutils.h" + #include + #include "aruco_cvversioning.h" +diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp +index 75f1f1c..4b1b502 100755 +--- a/src/aruco/fractallabelers/fractalmarkerset.cpp ++++ b/src/aruco/fractallabelers/fractalmarkerset.cpp +@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + } + return fms; +@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + } + catch (std::exception &ex) + { +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); + } + +@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + std::vector coordinates3d; + (*itp) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + "invalid file type 3", __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + corners.push_back(point); +@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) + FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + { + if (!(isExpressedInPixels() || isNormalize())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + FractalMarkerSet FractalMarkerSet::normalize() + { + if (!(isExpressedInPixels() || isExpressedInMeters())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() + cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) + { + if (fractalMarkerCollection.size() < 1) +- throw cv::Exception(9001, "There is not any fractal marker loaded", ++ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", + "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); + + // Smallest fractal marker +diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp +index ac17b7f..5fbb2f2 100755 +--- a/src/aruco/fractallabelers/fractalposetracker.cpp ++++ b/src/aruco/fractallabelers/fractalposetracker.cpp +@@ -5,7 +5,8 @@ + #include "timers.h" + + +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" ++#include "opencv2/features2d.hpp" + #include "aruco_cvversioning.h" + + namespace aruco +@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, + _fractalMarker = msconf; + + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) +- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", + __FILE__, __LINE__); + if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && + markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) +diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp +index 917ba63..083aede 100755 +--- a/src/aruco/marker.cpp ++++ b/src/aruco/marker.cpp +@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + /// \todo set this definition in the cmake code + #define _USE_MATH_DEFINES + +-#include ++#include + #include + + #include +@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + cv::Mat Rot(3, 3, CV_32FC1), Jacob; + cv::Rodrigues(Rvec, Rot, Jacob); +@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo + void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) + { + if (!CP.isValid()) +- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, + setYPerpendicular); +@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: + cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) + { + if (!isValid()) +- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + if (markerSizeMeters <= 0) +- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", ++ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", + __FILE__, __LINE__); + if (camMatrix.rows == 0 || camMatrix.cols == 0) +- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); + + std::vector objpoints = get3DPoints(markerSizeMeters); + +diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp +index debc1f4..66de492 100755 +--- a/src/aruco/markerdetector.cpp ++++ b/src/aruco/markerdetector.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp +index e1a21a6..575645f 100755 +--- a/src/aruco/markerdetector_impl.cpp ++++ b/src/aruco/markerdetector_impl.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const + bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) + { + if (points.size() != 4) +- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); + // obtain the perspective transform + Point2f pointsRes[4], pointsIn[4]; + for (int i = 0; i < 4; i++) +diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp +index 5afc105..55dd028 100755 +--- a/src/aruco/markermap.cpp ++++ b/src/aruco/markermap.cpp +@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + #include "markermap.h" + #include "dictionary.h" + +-#include ++#include + #include + + #include +@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) + { + cv::FileStorage fs(sfile, cv::FileStorage::READ); + if (!fs.isOpened()) +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + string(" file not opened ") + sfile, __FILE__, __LINE__); + readFromFile(fs); + } + catch (std::exception& ex) + { +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); + } + } +@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + int aux = 0; + // look for the nmarkers + if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); + fs["aruco_bc_nmarkers"] >> aux; + resize(aux); + fs["aruco_bc_mInfoType"] >> mInfoType; +@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + vector coordinates3d; + (*itc) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", + __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + at(i).push_back(point); +@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const + for (size_t i = 0; i < size(); i++) + if (at(i).id == id) + return at(i); +- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", ++ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", + "Marker with the id given is not found", __FILE__, __LINE__); + } + +@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co + invalid |= false; + } + if (invalid) +- throw cv::Exception(9002, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + Mat Rot(3, 3, CV_32FC1), Jacob; + Rodrigues(Rvec, Rot, Jacob); +@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const + MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + { + if (!isExpressedInPixels()) +- throw cv::Exception(-1, "The board is not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", + "MarkerMap::convertToMeters", __FILE__, __LINE__); + // first, we are assuming all markers are equally sized. So, lets get the size in pixels + int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); +@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + cv::Mat MarkerMap::getImage(float METER2PIX) const + { + if (mInfoType == NONE) +- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", ++ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", + "MarkerMap::getImage", __FILE__, __LINE__); + if (METER2PIX <= 0 && mInfoType != PIX) +- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", + "MarkerMap::getImage", __FILE__, __LINE__); + + auto Dict = Dictionary::loadPredefined(dictionary); +diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp +index 4cb14f4..7b571a2 100755 +--- a/src/aruco/posetracker.cpp ++++ b/src/aruco/posetracker.cpp +@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, + _msconf = msconf; + _cam_params = cam_params; + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::NONE) +- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", + __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX) + _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/rolling/patch/ros2-aruco-ros.patch b/distros/rolling/patch/ros2-aruco-ros.patch new file mode 100644 index 00000000..15537de0 --- /dev/null +++ b/distros/rolling/patch/ros2-aruco-ros.patch @@ -0,0 +1,13 @@ +diff --git a/src/aruco_ros_utils.cpp b/src/aruco_ros_utils.cpp +index 707ea97..392b154 100644 +--- a/src/aruco_ros_utils.cpp ++++ b/src/aruco_ros_utils.cpp +@@ -8,7 +8,7 @@ + #else + #include "cv_bridge/cv_bridge.h" + #endif +-#include "opencv4/opencv2/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "rclcpp/logging.hpp" + #include "tf2/transform_datatypes.hpp" + diff --git a/distros/rolling/patch/ros2-aruco.patch b/distros/rolling/patch/ros2-aruco.patch new file mode 100644 index 00000000..e96fe592 --- /dev/null +++ b/distros/rolling/patch/ros2-aruco.patch @@ -0,0 +1,503 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 896dae9..68e29ef 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") + # find dependencies + find_package(ament_cmake) + find_package(Eigen3 REQUIRED) +-find_package(OpenCV 4.2.0 REQUIRED) ++find_package(OpenCV REQUIRED) + + add_library(${PROJECT_NAME} + SHARED +@@ -48,7 +48,7 @@ target_include_directories( + ${EIGEN3_INCLUDE_DIRS} + ) + +-target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) + + ############# + ## Install ## +diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp +index cb6f440..2d38d96 100755 +--- a/src/aruco/cameraparameters.cpp ++++ b/src/aruco/cameraparameters.cpp +@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + */ + #include "cameraparameters.h" + +-#include ++#include + #include + + #include +@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, + } + + if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) +- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", ++ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", + __FILE__, __LINE__); + cameraMatrix.convertTo(CameraMatrix, CV_32FC1); + if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) +- throw cv::Exception(9000, "invalid input distorsionCoeff", ++ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", + "CameraParameters::setParams", __FILE__, __LINE__); + cv::Mat auxD; + +@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M + void CameraParameters::saveToFile(string path, bool inXML) + { + if (!isValid()) +- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); + if (!inXML) + { + ofstream file(path.c_str()); + if (!file) +- throw cv::Exception(9006, "could not open file:" + path, ++ throw cv::Exception(static_cast(9006), "could not open file:" + path, + "CameraParameters::saveToFile", __FILE__, __LINE__); + file << "# Aruco 1.0 CameraParameters" << endl; + file << "fx = " << CameraMatrix.at(0, 0) << endl; +@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) + void CameraParameters::resize(cv::Size size) + { + if (!isValid()) +- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); + if (size == CamSize) + return; + // now, read the camera size +@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Camera_Matrix"] >> MCamera; + if (MCamera.cols == 0 || MCamera.rows == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + +@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) + fs["image_Width"] >> w; + fs["image_Height"] >> h; + if (w == -1 || h == 0) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + if (MCamera.type() != CV_32FC1) +@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) + { + fs["Distortion_Coefficients"] >> MDist; + if (MDist.total() < 4) +- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", ++ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", + "CameraParameters::readFromXML", __FILE__, __LINE__); + } + // convert to 32 and get the 4 first elements only +@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, + std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " + << __FILE__ << " " << __LINE__ << endl; + if (isValid() == false) +- throw cv::Exception(9100, "invalid camera parameters", ++ throw cv::Exception(static_cast(9100), "invalid camera parameters", + "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); + + // Deterime the rsized info +@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh + cparam[2][2] *= -1.0; + + if (arParamDecompMat(cparam, icpara, trans) < 0) +- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", ++ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", + __FILE__, __LINE__); + + for (i = 0; i < 3; i++) +diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp +index 37484df..0a0bf19 100755 +--- a/src/aruco/cvdrawingutils.cpp ++++ b/src/aruco/cvdrawingutils.cpp +@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +-#include ++#include + #include + #include "cvdrawingutils.h" + #include "cameraparameters.h" +diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp +index c399c57..d227fdb 100755 +--- a/src/aruco/dictionary.cpp ++++ b/src/aruco/dictionary.cpp +@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "Dictionary::loadPredefined", "dictionary.h", -1); + break; + case ALL_DICTS: +@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + }; + return d; +@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) + else + return CUSTOM; + +- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary ++ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary + // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); + } + +@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + const std::vector &ids, bool chess_board) + { + if (gridSize.height * gridSize.width != int(ids.size())) +- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", ++ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", + "Dictionary::createMarkerMap", __FILE__, __LINE__); + MarkerMap TInfo; + +@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar + if (toWrite) + { + if (CurMarkerIdx >= int(ids.size())) +- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", ++ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", + "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); + TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); + /// \todo use const auto & +diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp +index 56db5a1..42277ed 100755 +--- a/src/aruco/fractaldetector.cpp ++++ b/src/aruco/fractaldetector.cpp +@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + along with this program. If not, see . + */ + #include "fractaldetector.h" +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" + #include "cvdrawingutils.h" + #include + #include "aruco_cvversioning.h" +diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp +index 75f1f1c..4b1b502 100755 +--- a/src/aruco/fractallabelers/fractalmarkerset.cpp ++++ b/src/aruco/fractallabelers/fractalmarkerset.cpp +@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) + } + break; + case CUSTOM: +- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", ++ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", + "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); + break; + + default: +- throw cv::Exception(9001, "Invalid Dictionary type requested", ++ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", + "Dictionary::loadPredefined", __FILE__, __LINE__); + } + return fms; +@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + } + catch (std::exception &ex) + { +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); + } + +@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) + std::vector coordinates3d; + (*itp) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", ++ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", + "invalid file type 3", __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + corners.push_back(point); +@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) + FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + { + if (!(isExpressedInPixels() || isNormalize())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) + FractalMarkerSet FractalMarkerSet::normalize() + { + if (!(isExpressedInPixels() || isExpressedInMeters())) +- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", ++ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", + "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); + + FractalMarkerSet BInfo(*this); +@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() + cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) + { + if (fractalMarkerCollection.size() < 1) +- throw cv::Exception(9001, "There is not any fractal marker loaded", ++ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", + "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); + + // Smallest fractal marker +diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp +index 0ec8983..4cd19da 100755 +--- a/src/aruco/fractallabelers/fractalposetracker.cpp ++++ b/src/aruco/fractallabelers/fractalposetracker.cpp +@@ -5,7 +5,8 @@ + #include "timers.h" + + +-#include "opencv2/calib3d/calib3d.hpp" ++#include "opencv2/calib3d.hpp" ++#include "opencv2/features2d.hpp" + #include "aruco_cvversioning.h" + + namespace aruco +@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, + _fractalMarker = msconf; + + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) +- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", + __FILE__, __LINE__); + if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && + markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", + "FractalPoseTracker::setParams", __FILE__, __LINE__); + if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || + _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) +diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp +index 917ba63..083aede 100755 +--- a/src/aruco/marker.cpp ++++ b/src/aruco/marker.cpp +@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + /// \todo set this definition in the cmake code + #define _USE_MATH_DEFINES + +-#include ++#include + #include + + #include +@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + cv::Mat Rot(3, 3, CV_32FC1), Jacob; + cv::Rodrigues(Rvec, Rot, Jacob); +@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo + void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) + { + if (!CP.isValid()) +- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, + setYPerpendicular); +@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: + cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) + { + if (!isValid()) +- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", ++ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", + "calculateExtrinsics", __FILE__, __LINE__); + if (markerSizeMeters <= 0) +- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", ++ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", + __FILE__, __LINE__); + if (camMatrix.rows == 0 || camMatrix.cols == 0) +- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); + + std::vector objpoints = get3DPoints(markerSizeMeters); + +diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp +index 94de8d0..40cde14 100755 +--- a/src/aruco/markerdetector.cpp ++++ b/src/aruco/markerdetector.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp +index 1a48c5b..3f8d8fe 100755 +--- a/src/aruco/markerdetector_impl.cpp ++++ b/src/aruco/markerdetector_impl.cpp +@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + + #include + #include +-#include +-#include ++#include ++#include + #include + #include + #include +@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const + bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) + { + if (points.size() != 4) +- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); + // obtain the perspective transform + Point2f pointsRes[4], pointsIn[4]; + for (int i = 0; i < 4; i++) +diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp +index 5afc105..55dd028 100755 +--- a/src/aruco/markermap.cpp ++++ b/src/aruco/markermap.cpp +@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. + #include "markermap.h" + #include "dictionary.h" + +-#include ++#include + #include + + #include +@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) + { + cv::FileStorage fs(sfile, cv::FileStorage::READ); + if (!fs.isOpened()) +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + string(" file not opened ") + sfile, __FILE__, __LINE__); + readFromFile(fs); + } + catch (std::exception& ex) + { +- throw cv::Exception(81818, "MarkerMap::readFromFile", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", + ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); + } + } +@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + int aux = 0; + // look for the nmarkers + if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); + fs["aruco_bc_nmarkers"] >> aux; + resize(aux); + fs["aruco_bc_mInfoType"] >> mInfoType; +@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) + vector coordinates3d; + (*itc) >> coordinates3d; + if (coordinates3d.size() != 3) +- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", ++ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", + __FILE__, __LINE__); + cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); + at(i).push_back(point); +@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const + for (size_t i = 0; i < size(); i++) + if (at(i).id == id) + return at(i); +- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", ++ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", + "Marker with the id given is not found", __FILE__, __LINE__); + } + +@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co + invalid |= false; + } + if (invalid) +- throw cv::Exception(9002, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + Mat Rot(3, 3, CV_32FC1), Jacob; + Rodrigues(Rvec, Rot, Jacob); +@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], + invalid |= false; + } + if (invalid) +- throw cv::Exception(9003, "extrinsic parameters are not set", ++ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", + "Marker::getModelViewMatrix", __FILE__, __LINE__); + + // calculate position vector +@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const + MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + { + if (!isExpressedInPixels()) +- throw cv::Exception(-1, "The board is not expressed in pixels", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", + "MarkerMap::convertToMeters", __FILE__, __LINE__); + // first, we are assuming all markers are equally sized. So, lets get the size in pixels + int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); +@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const + cv::Mat MarkerMap::getImage(float METER2PIX) const + { + if (mInfoType == NONE) +- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", ++ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", + "MarkerMap::getImage", __FILE__, __LINE__); + if (METER2PIX <= 0 && mInfoType != PIX) +- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", ++ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", + "MarkerMap::getImage", __FILE__, __LINE__); + + auto Dict = Dictionary::loadPredefined(dictionary); +diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp +index 4cb14f4..7b571a2 100755 +--- a/src/aruco/posetracker.cpp ++++ b/src/aruco/posetracker.cpp +@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, + _msconf = msconf; + _cam_params = cam_params; + if (!cam_params.isValid()) +- throw cv::Exception(9001, "Invalid camera parameters", ++ throw cv::Exception(static_cast(9001), "Invalid camera parameters", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) +- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", ++ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", + "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::NONE) +- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", ++ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", + __FILE__, __LINE__); + if (_msconf.mInfoType == MarkerMap::PIX) + _msconf = _msconf.convertToMeters(markerSize); diff --git a/shared/vinca.yaml b/shared/vinca.yaml index c93bc085..90c3e936 100644 --- a/shared/vinca.yaml +++ b/shared/vinca.yaml @@ -519,6 +519,8 @@ packages_select_by_deps: - if: not win then: + - aruco_ros # Windows not tried yet; requested in https://github.com/RoboStack/ros-lyrical/pull/87 + - aruco_ros # Windows not tried yet; requested in https://github.com/RoboStack/ros-lyrical/pull/87 - as2_cli - as2_msgs - automatika_embodied_agents From 7fb5146f2111f7c1d130a8a2e212d737f2920c12 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Mon, 19 Oct 2026 18:33:08 +1000 Subject: [PATCH 2/4] aruco_ros: recipe test that the marker detector node starts [skip ci] Turns the local checks of this PR into a recipe test, so later rebuilds keep them. Co-Authored-By: Claude Opus 5.5 --- shared/tests/ros2-aruco-ros.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 shared/tests/ros2-aruco-ros.yaml diff --git a/shared/tests/ros2-aruco-ros.yaml b/shared/tests/ros2-aruco-ros.yaml new file mode 100644 index 00000000..483e011c --- /dev/null +++ b/shared/tests/ros2-aruco-ros.yaml @@ -0,0 +1,6 @@ +tests: + # Smoke test: `aruco_ros/single` (the marker detector) starts (loads its libraries and the RMW) and is still running after 5 s. + - if: unix + then: + script: + - python -c "import os, subprocess, sys, time; p = subprocess.Popen([os.path.join(os.environ['PREFIX'], 'lib', 'aruco_ros', 'single')]); time.sleep(5); r = p.poll(); p.terminate(); sys.exit(0 if r is None else 1)" From e991efd05a4a57397a6c3b3094cf8fa2ee5e6bc3 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Tue, 20 Oct 2026 09:03:13 +1000 Subject: [PATCH 3/4] aruco_ros: select it once [skip ci] The selection line was added twice. Co-Authored-By: Claude Opus 5.5 --- shared/vinca.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/shared/vinca.yaml b/shared/vinca.yaml index 90c3e936..17f31f3a 100644 --- a/shared/vinca.yaml +++ b/shared/vinca.yaml @@ -519,7 +519,6 @@ packages_select_by_deps: - if: not win then: - - aruco_ros # Windows not tried yet; requested in https://github.com/RoboStack/ros-lyrical/pull/87 - aruco_ros # Windows not tried yet; requested in https://github.com/RoboStack/ros-lyrical/pull/87 - as2_cli - as2_msgs From 2f65bace0a3cb5e2519bac1994beacc8bf6068b8 Mon Sep 17 00:00:00 2001 From: Tobias Fischer Date: Tue, 20 Oct 2026 09:05:13 +1000 Subject: [PATCH 4/4] aruco, aruco_ros: shared patches instead of one copy per distribution [skip ci] The aruco patch was the same in all four distributions, so it moves to shared/. aruco_ros's has two versions, for 5.0.6 (humble, rolling) and 5.0.5 (jazzy, lyrical): the 5.0.6 one becomes the shared patch and jazzy and lyrical keep theirs, until they get 5.0.6 too. Every distribution still gets the same patch content as before (checked against each sync's source). Co-Authored-By: Claude Opus 5.5 --- distros/jazzy/patch/ros2-aruco.patch | 503 ------------------ distros/lyrical/patch/ros2-aruco.patch | 503 ------------------ distros/rolling/patch/ros2-aruco-ros.patch | 13 - distros/rolling/patch/ros2-aruco.patch | 503 ------------------ .../patch/ros2-aruco-ros.patch | 0 .../humble => shared}/patch/ros2-aruco.patch | 0 6 files changed, 1522 deletions(-) delete mode 100644 distros/jazzy/patch/ros2-aruco.patch delete mode 100644 distros/lyrical/patch/ros2-aruco.patch delete mode 100644 distros/rolling/patch/ros2-aruco-ros.patch delete mode 100644 distros/rolling/patch/ros2-aruco.patch rename {distros/humble => shared}/patch/ros2-aruco-ros.patch (100%) rename {distros/humble => shared}/patch/ros2-aruco.patch (100%) diff --git a/distros/jazzy/patch/ros2-aruco.patch b/distros/jazzy/patch/ros2-aruco.patch deleted file mode 100644 index bb36a135..00000000 --- a/distros/jazzy/patch/ros2-aruco.patch +++ /dev/null @@ -1,503 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ee3c69a..9ed1af6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") - # find dependencies - find_package(ament_cmake) - find_package(Eigen3 REQUIRED) --find_package(OpenCV 4.2.0 REQUIRED) -+find_package(OpenCV REQUIRED) - - add_library(${PROJECT_NAME} - SHARED -@@ -48,7 +48,7 @@ target_include_directories( - ${EIGEN3_INCLUDE_DIRS} - ) - --target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) -+target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) - - ############# - ## Install ## -diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp -index cb6f440..2d38d96 100755 ---- a/src/aruco/cameraparameters.cpp -+++ b/src/aruco/cameraparameters.cpp -@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - */ - #include "cameraparameters.h" - --#include -+#include - #include - - #include -@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, - } - - if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) -- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", -+ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", - __FILE__, __LINE__); - cameraMatrix.convertTo(CameraMatrix, CV_32FC1); - if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) -- throw cv::Exception(9000, "invalid input distorsionCoeff", -+ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", - "CameraParameters::setParams", __FILE__, __LINE__); - cv::Mat auxD; - -@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M - void CameraParameters::saveToFile(string path, bool inXML) - { - if (!isValid()) -- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); - if (!inXML) - { - ofstream file(path.c_str()); - if (!file) -- throw cv::Exception(9006, "could not open file:" + path, -+ throw cv::Exception(static_cast(9006), "could not open file:" + path, - "CameraParameters::saveToFile", __FILE__, __LINE__); - file << "# Aruco 1.0 CameraParameters" << endl; - file << "fx = " << CameraMatrix.at(0, 0) << endl; -@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) - void CameraParameters::resize(cv::Size size) - { - if (!isValid()) -- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); - if (size == CamSize) - return; - // now, read the camera size -@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Camera_Matrix"] >> MCamera; - if (MCamera.cols == 0 || MCamera.rows == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - -@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) - fs["image_Width"] >> w; - fs["image_Height"] >> h; - if (w == -1 || h == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - if (MCamera.type() != CV_32FC1) -@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Distortion_Coefficients"] >> MDist; - if (MDist.total() < 4) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - // convert to 32 and get the 4 first elements only -@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, - std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " - << __FILE__ << " " << __LINE__ << endl; - if (isValid() == false) -- throw cv::Exception(9100, "invalid camera parameters", -+ throw cv::Exception(static_cast(9100), "invalid camera parameters", - "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); - - // Deterime the rsized info -@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh - cparam[2][2] *= -1.0; - - if (arParamDecompMat(cparam, icpara, trans) < 0) -- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", -+ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", - __FILE__, __LINE__); - - for (i = 0; i < 3; i++) -diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp -index 37484df..0a0bf19 100755 ---- a/src/aruco/cvdrawingutils.cpp -+++ b/src/aruco/cvdrawingutils.cpp -@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ --#include -+#include - #include - #include "cvdrawingutils.h" - #include "cameraparameters.h" -diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp -index c399c57..d227fdb 100755 ---- a/src/aruco/dictionary.cpp -+++ b/src/aruco/dictionary.cpp -@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "Dictionary::loadPredefined", "dictionary.h", -1); - break; - case ALL_DICTS: -@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - }; - return d; -@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) - else - return CUSTOM; - -- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary -+ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary - // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); - } - -@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - const std::vector &ids, bool chess_board) - { - if (gridSize.height * gridSize.width != int(ids.size())) -- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", -+ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", - "Dictionary::createMarkerMap", __FILE__, __LINE__); - MarkerMap TInfo; - -@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - if (toWrite) - { - if (CurMarkerIdx >= int(ids.size())) -- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", -+ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", - "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); - TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); - /// \todo use const auto & -diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp -index 56db5a1..42277ed 100755 ---- a/src/aruco/fractaldetector.cpp -+++ b/src/aruco/fractaldetector.cpp -@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - along with this program. If not, see . - */ - #include "fractaldetector.h" --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" - #include "cvdrawingutils.h" - #include - #include "aruco_cvversioning.h" -diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp -index 75f1f1c..4b1b502 100755 ---- a/src/aruco/fractallabelers/fractalmarkerset.cpp -+++ b/src/aruco/fractallabelers/fractalmarkerset.cpp -@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - } - return fms; -@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - } - catch (std::exception &ex) - { -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); - } - -@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - std::vector coordinates3d; - (*itp) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - "invalid file type 3", __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - corners.push_back(point); -@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) - FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - { - if (!(isExpressedInPixels() || isNormalize())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - FractalMarkerSet FractalMarkerSet::normalize() - { - if (!(isExpressedInPixels() || isExpressedInMeters())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() - cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) - { - if (fractalMarkerCollection.size() < 1) -- throw cv::Exception(9001, "There is not any fractal marker loaded", -+ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", - "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); - - // Smallest fractal marker -diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp -index ac17b7f..5fbb2f2 100755 ---- a/src/aruco/fractallabelers/fractalposetracker.cpp -+++ b/src/aruco/fractallabelers/fractalposetracker.cpp -@@ -5,7 +5,8 @@ - #include "timers.h" - - --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" -+#include "opencv2/features2d.hpp" - #include "aruco_cvversioning.h" - - namespace aruco -@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, - _fractalMarker = msconf; - - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) -- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", - __FILE__, __LINE__); - if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && - markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) -diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp -index 917ba63..083aede 100755 ---- a/src/aruco/marker.cpp -+++ b/src/aruco/marker.cpp -@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - /// \todo set this definition in the cmake code - #define _USE_MATH_DEFINES - --#include -+#include - #include - - #include -@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - cv::Mat Rot(3, 3, CV_32FC1), Jacob; - cv::Rodrigues(Rvec, Rot, Jacob); -@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo - void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) - { - if (!CP.isValid()) -- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, - setYPerpendicular); -@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: - cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) - { - if (!isValid()) -- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - if (markerSizeMeters <= 0) -- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", -+ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", - __FILE__, __LINE__); - if (camMatrix.rows == 0 || camMatrix.cols == 0) -- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); - - std::vector objpoints = get3DPoints(markerSizeMeters); - -diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp -index debc1f4..66de492 100755 ---- a/src/aruco/markerdetector.cpp -+++ b/src/aruco/markerdetector.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp -index e1a21a6..575645f 100755 ---- a/src/aruco/markerdetector_impl.cpp -+++ b/src/aruco/markerdetector_impl.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const - bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) - { - if (points.size() != 4) -- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); - // obtain the perspective transform - Point2f pointsRes[4], pointsIn[4]; - for (int i = 0; i < 4; i++) -diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp -index 5afc105..55dd028 100755 ---- a/src/aruco/markermap.cpp -+++ b/src/aruco/markermap.cpp -@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - #include "markermap.h" - #include "dictionary.h" - --#include -+#include - #include - - #include -@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) - { - cv::FileStorage fs(sfile, cv::FileStorage::READ); - if (!fs.isOpened()) -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - string(" file not opened ") + sfile, __FILE__, __LINE__); - readFromFile(fs); - } - catch (std::exception& ex) - { -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); - } - } -@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - int aux = 0; - // look for the nmarkers - if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); - fs["aruco_bc_nmarkers"] >> aux; - resize(aux); - fs["aruco_bc_mInfoType"] >> mInfoType; -@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - vector coordinates3d; - (*itc) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", - __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - at(i).push_back(point); -@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const - for (size_t i = 0; i < size(); i++) - if (at(i).id == id) - return at(i); -- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", -+ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", - "Marker with the id given is not found", __FILE__, __LINE__); - } - -@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co - invalid |= false; - } - if (invalid) -- throw cv::Exception(9002, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - Mat Rot(3, 3, CV_32FC1), Jacob; - Rodrigues(Rvec, Rot, Jacob); -@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const - MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - { - if (!isExpressedInPixels()) -- throw cv::Exception(-1, "The board is not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", - "MarkerMap::convertToMeters", __FILE__, __LINE__); - // first, we are assuming all markers are equally sized. So, lets get the size in pixels - int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); -@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - cv::Mat MarkerMap::getImage(float METER2PIX) const - { - if (mInfoType == NONE) -- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", -+ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", - "MarkerMap::getImage", __FILE__, __LINE__); - if (METER2PIX <= 0 && mInfoType != PIX) -- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", - "MarkerMap::getImage", __FILE__, __LINE__); - - auto Dict = Dictionary::loadPredefined(dictionary); -diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp -index 4cb14f4..7b571a2 100755 ---- a/src/aruco/posetracker.cpp -+++ b/src/aruco/posetracker.cpp -@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, - _msconf = msconf; - _cam_params = cam_params; - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::NONE) -- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", - __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX) - _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/lyrical/patch/ros2-aruco.patch b/distros/lyrical/patch/ros2-aruco.patch deleted file mode 100644 index bb36a135..00000000 --- a/distros/lyrical/patch/ros2-aruco.patch +++ /dev/null @@ -1,503 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ee3c69a..9ed1af6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") - # find dependencies - find_package(ament_cmake) - find_package(Eigen3 REQUIRED) --find_package(OpenCV 4.2.0 REQUIRED) -+find_package(OpenCV REQUIRED) - - add_library(${PROJECT_NAME} - SHARED -@@ -48,7 +48,7 @@ target_include_directories( - ${EIGEN3_INCLUDE_DIRS} - ) - --target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) -+target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) - - ############# - ## Install ## -diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp -index cb6f440..2d38d96 100755 ---- a/src/aruco/cameraparameters.cpp -+++ b/src/aruco/cameraparameters.cpp -@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - */ - #include "cameraparameters.h" - --#include -+#include - #include - - #include -@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, - } - - if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) -- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", -+ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", - __FILE__, __LINE__); - cameraMatrix.convertTo(CameraMatrix, CV_32FC1); - if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) -- throw cv::Exception(9000, "invalid input distorsionCoeff", -+ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", - "CameraParameters::setParams", __FILE__, __LINE__); - cv::Mat auxD; - -@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M - void CameraParameters::saveToFile(string path, bool inXML) - { - if (!isValid()) -- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); - if (!inXML) - { - ofstream file(path.c_str()); - if (!file) -- throw cv::Exception(9006, "could not open file:" + path, -+ throw cv::Exception(static_cast(9006), "could not open file:" + path, - "CameraParameters::saveToFile", __FILE__, __LINE__); - file << "# Aruco 1.0 CameraParameters" << endl; - file << "fx = " << CameraMatrix.at(0, 0) << endl; -@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) - void CameraParameters::resize(cv::Size size) - { - if (!isValid()) -- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); - if (size == CamSize) - return; - // now, read the camera size -@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Camera_Matrix"] >> MCamera; - if (MCamera.cols == 0 || MCamera.rows == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - -@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) - fs["image_Width"] >> w; - fs["image_Height"] >> h; - if (w == -1 || h == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - if (MCamera.type() != CV_32FC1) -@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Distortion_Coefficients"] >> MDist; - if (MDist.total() < 4) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - // convert to 32 and get the 4 first elements only -@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, - std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " - << __FILE__ << " " << __LINE__ << endl; - if (isValid() == false) -- throw cv::Exception(9100, "invalid camera parameters", -+ throw cv::Exception(static_cast(9100), "invalid camera parameters", - "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); - - // Deterime the rsized info -@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh - cparam[2][2] *= -1.0; - - if (arParamDecompMat(cparam, icpara, trans) < 0) -- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", -+ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", - __FILE__, __LINE__); - - for (i = 0; i < 3; i++) -diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp -index 37484df..0a0bf19 100755 ---- a/src/aruco/cvdrawingutils.cpp -+++ b/src/aruco/cvdrawingutils.cpp -@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ --#include -+#include - #include - #include "cvdrawingutils.h" - #include "cameraparameters.h" -diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp -index c399c57..d227fdb 100755 ---- a/src/aruco/dictionary.cpp -+++ b/src/aruco/dictionary.cpp -@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "Dictionary::loadPredefined", "dictionary.h", -1); - break; - case ALL_DICTS: -@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - }; - return d; -@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) - else - return CUSTOM; - -- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary -+ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary - // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); - } - -@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - const std::vector &ids, bool chess_board) - { - if (gridSize.height * gridSize.width != int(ids.size())) -- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", -+ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", - "Dictionary::createMarkerMap", __FILE__, __LINE__); - MarkerMap TInfo; - -@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - if (toWrite) - { - if (CurMarkerIdx >= int(ids.size())) -- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", -+ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", - "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); - TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); - /// \todo use const auto & -diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp -index 56db5a1..42277ed 100755 ---- a/src/aruco/fractaldetector.cpp -+++ b/src/aruco/fractaldetector.cpp -@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - along with this program. If not, see . - */ - #include "fractaldetector.h" --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" - #include "cvdrawingutils.h" - #include - #include "aruco_cvversioning.h" -diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp -index 75f1f1c..4b1b502 100755 ---- a/src/aruco/fractallabelers/fractalmarkerset.cpp -+++ b/src/aruco/fractallabelers/fractalmarkerset.cpp -@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - } - return fms; -@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - } - catch (std::exception &ex) - { -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); - } - -@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - std::vector coordinates3d; - (*itp) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - "invalid file type 3", __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - corners.push_back(point); -@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) - FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - { - if (!(isExpressedInPixels() || isNormalize())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - FractalMarkerSet FractalMarkerSet::normalize() - { - if (!(isExpressedInPixels() || isExpressedInMeters())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() - cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) - { - if (fractalMarkerCollection.size() < 1) -- throw cv::Exception(9001, "There is not any fractal marker loaded", -+ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", - "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); - - // Smallest fractal marker -diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp -index ac17b7f..5fbb2f2 100755 ---- a/src/aruco/fractallabelers/fractalposetracker.cpp -+++ b/src/aruco/fractallabelers/fractalposetracker.cpp -@@ -5,7 +5,8 @@ - #include "timers.h" - - --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" -+#include "opencv2/features2d.hpp" - #include "aruco_cvversioning.h" - - namespace aruco -@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, - _fractalMarker = msconf; - - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) -- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", - __FILE__, __LINE__); - if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && - markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) -diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp -index 917ba63..083aede 100755 ---- a/src/aruco/marker.cpp -+++ b/src/aruco/marker.cpp -@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - /// \todo set this definition in the cmake code - #define _USE_MATH_DEFINES - --#include -+#include - #include - - #include -@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - cv::Mat Rot(3, 3, CV_32FC1), Jacob; - cv::Rodrigues(Rvec, Rot, Jacob); -@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo - void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) - { - if (!CP.isValid()) -- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, - setYPerpendicular); -@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: - cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) - { - if (!isValid()) -- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - if (markerSizeMeters <= 0) -- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", -+ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", - __FILE__, __LINE__); - if (camMatrix.rows == 0 || camMatrix.cols == 0) -- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); - - std::vector objpoints = get3DPoints(markerSizeMeters); - -diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp -index debc1f4..66de492 100755 ---- a/src/aruco/markerdetector.cpp -+++ b/src/aruco/markerdetector.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp -index e1a21a6..575645f 100755 ---- a/src/aruco/markerdetector_impl.cpp -+++ b/src/aruco/markerdetector_impl.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const - bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) - { - if (points.size() != 4) -- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); - // obtain the perspective transform - Point2f pointsRes[4], pointsIn[4]; - for (int i = 0; i < 4; i++) -diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp -index 5afc105..55dd028 100755 ---- a/src/aruco/markermap.cpp -+++ b/src/aruco/markermap.cpp -@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - #include "markermap.h" - #include "dictionary.h" - --#include -+#include - #include - - #include -@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) - { - cv::FileStorage fs(sfile, cv::FileStorage::READ); - if (!fs.isOpened()) -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - string(" file not opened ") + sfile, __FILE__, __LINE__); - readFromFile(fs); - } - catch (std::exception& ex) - { -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); - } - } -@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - int aux = 0; - // look for the nmarkers - if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); - fs["aruco_bc_nmarkers"] >> aux; - resize(aux); - fs["aruco_bc_mInfoType"] >> mInfoType; -@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - vector coordinates3d; - (*itc) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", - __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - at(i).push_back(point); -@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const - for (size_t i = 0; i < size(); i++) - if (at(i).id == id) - return at(i); -- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", -+ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", - "Marker with the id given is not found", __FILE__, __LINE__); - } - -@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co - invalid |= false; - } - if (invalid) -- throw cv::Exception(9002, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - Mat Rot(3, 3, CV_32FC1), Jacob; - Rodrigues(Rvec, Rot, Jacob); -@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const - MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - { - if (!isExpressedInPixels()) -- throw cv::Exception(-1, "The board is not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", - "MarkerMap::convertToMeters", __FILE__, __LINE__); - // first, we are assuming all markers are equally sized. So, lets get the size in pixels - int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); -@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - cv::Mat MarkerMap::getImage(float METER2PIX) const - { - if (mInfoType == NONE) -- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", -+ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", - "MarkerMap::getImage", __FILE__, __LINE__); - if (METER2PIX <= 0 && mInfoType != PIX) -- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", - "MarkerMap::getImage", __FILE__, __LINE__); - - auto Dict = Dictionary::loadPredefined(dictionary); -diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp -index 4cb14f4..7b571a2 100755 ---- a/src/aruco/posetracker.cpp -+++ b/src/aruco/posetracker.cpp -@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, - _msconf = msconf; - _cam_params = cam_params; - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::NONE) -- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", - __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX) - _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/rolling/patch/ros2-aruco-ros.patch b/distros/rolling/patch/ros2-aruco-ros.patch deleted file mode 100644 index 15537de0..00000000 --- a/distros/rolling/patch/ros2-aruco-ros.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/aruco_ros_utils.cpp b/src/aruco_ros_utils.cpp -index 707ea97..392b154 100644 ---- a/src/aruco_ros_utils.cpp -+++ b/src/aruco_ros_utils.cpp -@@ -8,7 +8,7 @@ - #else - #include "cv_bridge/cv_bridge.h" - #endif --#include "opencv4/opencv2/calib3d.hpp" -+#include "opencv2/calib3d.hpp" - #include "rclcpp/logging.hpp" - #include "tf2/transform_datatypes.hpp" - diff --git a/distros/rolling/patch/ros2-aruco.patch b/distros/rolling/patch/ros2-aruco.patch deleted file mode 100644 index e96fe592..00000000 --- a/distros/rolling/patch/ros2-aruco.patch +++ /dev/null @@ -1,503 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 896dae9..68e29ef 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${NEW_CXX_FLAGS}") - # find dependencies - find_package(ament_cmake) - find_package(Eigen3 REQUIRED) --find_package(OpenCV 4.2.0 REQUIRED) -+find_package(OpenCV REQUIRED) - - add_library(${PROJECT_NAME} - SHARED -@@ -48,7 +48,7 @@ target_include_directories( - ${EIGEN3_INCLUDE_DIRS} - ) - --target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES}) -+target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBRARIES} Eigen3::Eigen) - - ############# - ## Install ## -diff --git a/src/aruco/cameraparameters.cpp b/src/aruco/cameraparameters.cpp -index cb6f440..2d38d96 100755 ---- a/src/aruco/cameraparameters.cpp -+++ b/src/aruco/cameraparameters.cpp -@@ -15,7 +15,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - */ - #include "cameraparameters.h" - --#include -+#include - #include - - #include -@@ -84,11 +84,11 @@ void CameraParameters::setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, - } - - if (cameraMatrix.rows != 3 || cameraMatrix.cols != 3) -- throw cv::Exception(9000, "invalid input cameraMatrix", "CameraParameters::setParams", -+ throw cv::Exception(static_cast(9000), "invalid input cameraMatrix", "CameraParameters::setParams", - __FILE__, __LINE__); - cameraMatrix.convertTo(CameraMatrix, CV_32FC1); - if (distorsionCoeff.total() < 4 || distorsionCoeff.total() >= 7) -- throw cv::Exception(9000, "invalid input distorsionCoeff", -+ throw cv::Exception(static_cast(9000), "invalid input distorsionCoeff", - "CameraParameters::setParams", __FILE__, __LINE__); - cv::Mat auxD; - -@@ -128,12 +128,12 @@ cv::Point3f CameraParameters::getCameraLocation(const cv::Mat &Rvec, const cv::M - void CameraParameters::saveToFile(string path, bool inXML) - { - if (!isValid()) -- throw cv::Exception(9006, "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9006), "invalid object", "CameraParameters::saveToFile", __FILE__, __LINE__); - if (!inXML) - { - ofstream file(path.c_str()); - if (!file) -- throw cv::Exception(9006, "could not open file:" + path, -+ throw cv::Exception(static_cast(9006), "could not open file:" + path, - "CameraParameters::saveToFile", __FILE__, __LINE__); - file << "# Aruco 1.0 CameraParameters" << endl; - file << "fx = " << CameraMatrix.at(0, 0) << endl; -@@ -166,7 +166,7 @@ void CameraParameters::saveToFile(string path, bool inXML) - void CameraParameters::resize(cv::Size size) - { - if (!isValid()) -- throw cv::Exception(9007, "invalid object", "CameraParameters::resize", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9007), "invalid object", "CameraParameters::resize", __FILE__, __LINE__); - if (size == CamSize) - return; - // now, read the camera size -@@ -205,7 +205,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Camera_Matrix"] >> MCamera; - if (MCamera.cols == 0 || MCamera.rows == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera matrix", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera matrix", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - -@@ -214,7 +214,7 @@ void CameraParameters::readFromXMLFile(string filePath) - fs["image_Width"] >> w; - fs["image_Height"] >> h; - if (w == -1 || h == 0) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid camera dimensions", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid camera dimensions", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - if (MCamera.type() != CV_32FC1) -@@ -226,7 +226,7 @@ void CameraParameters::readFromXMLFile(string filePath) - { - fs["Distortion_Coefficients"] >> MDist; - if (MDist.total() < 4) -- throw cv::Exception(9007, "File :" + filePath + " does not contains valid distortion_coefficients", -+ throw cv::Exception(static_cast(9007), "File :" + filePath + " does not contains valid distortion_coefficients", - "CameraParameters::readFromXML", __FILE__, __LINE__); - } - // convert to 32 and get the 4 first elements only -@@ -253,7 +253,7 @@ void CameraParameters::glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, - std::cerr << "CameraParameters::glGetProjectionMatrix :: The camera has distortion coefficients " - << __FILE__ << " " << __LINE__ << endl; - if (isValid() == false) -- throw cv::Exception(9100, "invalid camera parameters", -+ throw cv::Exception(static_cast(9100), "invalid camera parameters", - "CameraParameters::glGetProjectionMatrix", __FILE__, __LINE__); - - // Deterime the rsized info -@@ -305,7 +305,7 @@ void CameraParameters::argConvGLcpara2(double cparam[3][4], int width, int heigh - cparam[2][2] *= -1.0; - - if (arParamDecompMat(cparam, icpara, trans) < 0) -- throw cv::Exception(9002, "parameter error", "MarkerDetector::argConvGLcpara2", -+ throw cv::Exception(static_cast(9002), "parameter error", "MarkerDetector::argConvGLcpara2", - __FILE__, __LINE__); - - for (i = 0; i < 3; i++) -diff --git a/src/aruco/cvdrawingutils.cpp b/src/aruco/cvdrawingutils.cpp -index 37484df..0a0bf19 100755 ---- a/src/aruco/cvdrawingutils.cpp -+++ b/src/aruco/cvdrawingutils.cpp -@@ -13,7 +13,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ --#include -+#include - #include - #include "cvdrawingutils.h" - #include "cameraparameters.h" -diff --git a/src/aruco/dictionary.cpp b/src/aruco/dictionary.cpp -index c399c57..d227fdb 100755 ---- a/src/aruco/dictionary.cpp -+++ b/src/aruco/dictionary.cpp -@@ -3314,7 +3314,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "Dictionary::loadPredefined", "dictionary.h", -1); - break; - case ALL_DICTS: -@@ -3327,7 +3327,7 @@ Dictionary Dictionary::loadPredefined(DICT_TYPES type) - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - }; - return d; -@@ -3524,7 +3524,7 @@ Dictionary::DICT_TYPES Dictionary::getTypeFromString(std::string str) - else - return CUSTOM; - -- // throw cv::Exception(9001, "Invalid string <"+str+"> to convert to Dictionary -+ // throw cv::Exception(static_cast(9001), "Invalid string <"+str+"> to convert to Dictionary - // type", "Dictionary::getTypeFromString", __FILE__, __LINE__); - } - -@@ -3545,7 +3545,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - const std::vector &ids, bool chess_board) - { - if (gridSize.height * gridSize.width != int(ids.size())) -- throw cv::Exception(9001, "gridSize != ids.size()Invalid ", -+ throw cv::Exception(static_cast(9001), "gridSize != ids.size()Invalid ", - "Dictionary::createMarkerMap", __FILE__, __LINE__); - MarkerMap TInfo; - -@@ -3586,7 +3586,7 @@ MarkerMap Dictionary::createMarkerMap(cv::Size gridSize, int MarkerSize, int Mar - if (toWrite) - { - if (CurMarkerIdx >= int(ids.size())) -- throw cv::Exception(999, " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", -+ throw cv::Exception(static_cast(999), " FiducidalMarkers::createMarkerMapImage_ChessMarkerMap", - "INTERNAL ERROR. REWRITE THIS!!", __FILE__, __LINE__); - TInfo.push_back(Marker3DInfo(ids[CurMarkerIdx++])); - /// \todo use const auto & -diff --git a/src/aruco/fractaldetector.cpp b/src/aruco/fractaldetector.cpp -index 56db5a1..42277ed 100755 ---- a/src/aruco/fractaldetector.cpp -+++ b/src/aruco/fractaldetector.cpp -@@ -14,7 +14,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - along with this program. If not, see . - */ - #include "fractaldetector.h" --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" - #include "cvdrawingutils.h" - #include - #include "aruco_cvversioning.h" -diff --git a/src/aruco/fractallabelers/fractalmarkerset.cpp b/src/aruco/fractallabelers/fractalmarkerset.cpp -index 75f1f1c..4b1b502 100755 ---- a/src/aruco/fractallabelers/fractalmarkerset.cpp -+++ b/src/aruco/fractallabelers/fractalmarkerset.cpp -@@ -252,12 +252,12 @@ FractalMarkerSet FractalMarkerSet::loadPredefined(CONF_TYPES type) - } - break; - case CUSTOM: -- throw cv::Exception(-1, "CUSTOM type is only set by loading from file", -+ throw cv::Exception(static_cast(-1), "CUSTOM type is only set by loading from file", - "FractalMarkerSet::loadPredefined", "fractalmarkerset.h", -1); - break; - - default: -- throw cv::Exception(9001, "Invalid Dictionary type requested", -+ throw cv::Exception(static_cast(9001), "Invalid Dictionary type requested", - "Dictionary::loadPredefined", __FILE__, __LINE__); - } - return fms; -@@ -585,7 +585,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - } - catch (std::exception &ex) - { -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - ex.what() + std::string(" file=)") + path, __FILE__, __LINE__); - } - -@@ -621,7 +621,7 @@ FractalMarkerSet FractalMarkerSet::readFromFile(std::string path) - std::vector coordinates3d; - (*itp) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "FractalMarkerSet::readFromFile", -+ throw cv::Exception(static_cast(81818), "FractalMarkerSet::readFromFile", - "invalid file type 3", __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - corners.push_back(point); -@@ -725,7 +725,7 @@ bool FractalMarkerSet::isFractalMarker(cv::Mat &m, int nbits, int &markerid) - FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - { - if (!(isExpressedInPixels() || isNormalize())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -748,7 +748,7 @@ FractalMarkerSet FractalMarkerSet::convertToMeters(float fractalSizeM) - FractalMarkerSet FractalMarkerSet::normalize() - { - if (!(isExpressedInPixels() || isExpressedInMeters())) -- throw cv::Exception(-1, "The FractalMarkers are not expressed in pixels or meters", -+ throw cv::Exception(static_cast(-1), "The FractalMarkers are not expressed in pixels or meters", - "FractalMarkerSet::convertToMeters", __FILE__, __LINE__); - - FractalMarkerSet BInfo(*this); -@@ -786,7 +786,7 @@ std::map> FractalMarkerSet::getInnerCorners() - cv::Mat FractalMarkerSet::getFractalMarkerImage(int pixSize, bool border) - { - if (fractalMarkerCollection.size() < 1) -- throw cv::Exception(9001, "There is not any fractal marker loaded", -+ throw cv::Exception(static_cast(9001), "There is not any fractal marker loaded", - "FractalMarkerSet::getFractalMarkerImage", __FILE__, __LINE__); - - // Smallest fractal marker -diff --git a/src/aruco/fractallabelers/fractalposetracker.cpp b/src/aruco/fractallabelers/fractalposetracker.cpp -index 0ec8983..4cd19da 100755 ---- a/src/aruco/fractallabelers/fractalposetracker.cpp -+++ b/src/aruco/fractallabelers/fractalposetracker.cpp -@@ -5,7 +5,8 @@ - #include "timers.h" - - --#include "opencv2/calib3d/calib3d.hpp" -+#include "opencv2/calib3d.hpp" -+#include "opencv2/features2d.hpp" - #include "aruco_cvversioning.h" - - namespace aruco -@@ -238,15 +239,15 @@ void FractalPoseTracker::setParams(const CameraParameters &cam_params, - _fractalMarker = msconf; - - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::NONE) -- throw cv::Exception(9001, "Invalid FractalMarker", "FractalPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid FractalMarker", "FractalPoseTracker::setParams", - __FILE__, __LINE__); - if ((_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) && - markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the Fractal Marker is in pixels or normalized", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the Fractal Marker is in pixels or normalized", - "FractalPoseTracker::setParams", __FILE__, __LINE__); - if (_fractalMarker.mInfoType == aruco::FractalMarkerSet::PIX || - _fractalMarker.mInfoType == aruco::FractalMarkerSet::NORM) -diff --git a/src/aruco/marker.cpp b/src/aruco/marker.cpp -index 917ba63..083aede 100755 ---- a/src/aruco/marker.cpp -+++ b/src/aruco/marker.cpp -@@ -19,7 +19,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - /// \todo set this definition in the cmake code - #define _USE_MATH_DEFINES - --#include -+#include - #include - - #include -@@ -111,7 +111,7 @@ void Marker::glGetModelViewMatrix(double modelview_matrix[16]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - cv::Mat Rot(3, 3, CV_32FC1), Jacob; - cv::Rodrigues(Rvec, Rot, Jacob); -@@ -168,7 +168,7 @@ void Marker::OgreGetPoseParameters(double position[3], double orientation[4]) - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -301,7 +301,7 @@ void Marker::draw(cv::Mat& in, cv::Scalar color, int lineWidth, bool writeId, bo - void Marker::calculateExtrinsics(float markerSize, const CameraParameters& CP, bool setYPerpendicular) - { - if (!CP.isValid()) -- throw cv::Exception(9004, "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!CP.isValid(): invalid camera parameters. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - calculateExtrinsics(markerSize, CP.CameraMatrix, CP.Distorsion, CP.ExtrinsicMatrix, - setYPerpendicular); -@@ -317,13 +317,13 @@ void Marker::calculateExtrinsics(float markerSizeMeters, cv::Mat camMatrix, cv:: - cv::Mat Extrinsics, bool setYPerpendicular, bool correctFisheye) - { - if (!isValid()) -- throw cv::Exception(9004, "!isValid(): invalid marker. It is not possible to calculate extrinsics", -+ throw cv::Exception(static_cast(9004), "!isValid(): invalid marker. It is not possible to calculate extrinsics", - "calculateExtrinsics", __FILE__, __LINE__); - if (markerSizeMeters <= 0) -- throw cv::Exception(9004, "markerSize<=0: invalid markerSize", "calculateExtrinsics", -+ throw cv::Exception(static_cast(9004), "markerSize<=0: invalid markerSize", "calculateExtrinsics", - __FILE__, __LINE__); - if (camMatrix.rows == 0 || camMatrix.cols == 0) -- throw cv::Exception(9004, "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9004), "CameraMatrix is empty", "calculateExtrinsics", __FILE__, __LINE__); - - std::vector objpoints = get3DPoints(markerSizeMeters); - -diff --git a/src/aruco/markerdetector.cpp b/src/aruco/markerdetector.cpp -index 94de8d0..40cde14 100755 ---- a/src/aruco/markerdetector.cpp -+++ b/src/aruco/markerdetector.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -diff --git a/src/aruco/markerdetector_impl.cpp b/src/aruco/markerdetector_impl.cpp -index 1a48c5b..3f8d8fe 100755 ---- a/src/aruco/markerdetector_impl.cpp -+++ b/src/aruco/markerdetector_impl.cpp -@@ -21,8 +21,8 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - - #include - #include --#include --#include -+#include -+#include - #include - #include - #include -@@ -1433,7 +1433,7 @@ int MarkerDetector_Impl::getMinMarkerSizePix(cv::Size orginput_imageSize) const - bool MarkerDetector_Impl::warp(Mat &in, Mat &out, Size size, vector points) - { - if (points.size() != 4) -- throw cv::Exception(9001, "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(9001), "point.size()!=4", "MarkerDetector_Impl::warp", __FILE__, __LINE__); - // obtain the perspective transform - Point2f pointsRes[4], pointsIn[4]; - for (int i = 0; i < 4; i++) -diff --git a/src/aruco/markermap.cpp b/src/aruco/markermap.cpp -index 5afc105..55dd028 100755 ---- a/src/aruco/markermap.cpp -+++ b/src/aruco/markermap.cpp -@@ -17,7 +17,7 @@ Copyright 2020 Rafael Muñoz Salinas. All rights reserved. - #include "markermap.h" - #include "dictionary.h" - --#include -+#include - #include - - #include -@@ -94,13 +94,13 @@ void MarkerMap::readFromFile(string sfile) - { - cv::FileStorage fs(sfile, cv::FileStorage::READ); - if (!fs.isOpened()) -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - string(" file not opened ") + sfile, __FILE__, __LINE__); - readFromFile(fs); - } - catch (std::exception& ex) - { -- throw cv::Exception(81818, "MarkerMap::readFromFile", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", - ex.what() + string(" file=)") + sfile, __FILE__, __LINE__); - } - } -@@ -112,7 +112,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - int aux = 0; - // look for the nmarkers - if (fs["aruco_bc_nmarkers"].name() != "aruco_bc_nmarkers") -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type", __FILE__, __LINE__); - fs["aruco_bc_nmarkers"] >> aux; - resize(aux); - fs["aruco_bc_mInfoType"] >> mInfoType; -@@ -127,7 +127,7 @@ void MarkerMap::readFromFile(cv::FileStorage& fs) - vector coordinates3d; - (*itc) >> coordinates3d; - if (coordinates3d.size() != 3) -- throw cv::Exception(81818, "MarkerMap::readFromFile", "invalid file type 3", -+ throw cv::Exception(static_cast(81818), "MarkerMap::readFromFile", "invalid file type 3", - __FILE__, __LINE__); - cv::Point3f point(coordinates3d[0], coordinates3d[1], coordinates3d[2]); - at(i).push_back(point); -@@ -155,7 +155,7 @@ const Marker3DInfo& MarkerMap::getMarker3DInfo(int id) const - for (size_t i = 0; i < size(); i++) - if (at(i).id == id) - return at(i); -- throw cv::Exception(111, "MarkerMap::getMarker3DInfo", -+ throw cv::Exception(static_cast(111), "MarkerMap::getMarker3DInfo", - "Marker with the id given is not found", __FILE__, __LINE__); - } - -@@ -171,7 +171,7 @@ void __glGetModelViewMatrix(double modelview_matrix[16], const cv::Mat& Rvec, co - invalid |= false; - } - if (invalid) -- throw cv::Exception(9002, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9002), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - Mat Rot(3, 3, CV_32FC1), Jacob; - Rodrigues(Rvec, Rot, Jacob); -@@ -229,7 +229,7 @@ void __OgreGetPoseParameters(double position[3], double orientation[4], - invalid |= false; - } - if (invalid) -- throw cv::Exception(9003, "extrinsic parameters are not set", -+ throw cv::Exception(static_cast(9003), "extrinsic parameters are not set", - "Marker::getModelViewMatrix", __FILE__, __LINE__); - - // calculate position vector -@@ -320,7 +320,7 @@ void MarkerMap::getIdList(std::vector& ids, bool append) const - MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - { - if (!isExpressedInPixels()) -- throw cv::Exception(-1, "The board is not expressed in pixels", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels", - "MarkerMap::convertToMeters", __FILE__, __LINE__); - // first, we are assuming all markers are equally sized. So, lets get the size in pixels - int markerSizePix = static_cast(cv::norm(at(0)[0] - at(0)[1])); -@@ -340,10 +340,10 @@ MarkerMap MarkerMap::convertToMeters(float markerSize_meters) const - cv::Mat MarkerMap::getImage(float METER2PIX) const - { - if (mInfoType == NONE) -- throw cv::Exception(-1, "The board is not valid mInfoType==NONE ", -+ throw cv::Exception(static_cast(-1), "The board is not valid mInfoType==NONE ", - "MarkerMap::getImage", __FILE__, __LINE__); - if (METER2PIX <= 0 && mInfoType != PIX) -- throw cv::Exception(-1, "The board is not expressed in pixels and not METER2PIX indicated", -+ throw cv::Exception(static_cast(-1), "The board is not expressed in pixels and not METER2PIX indicated", - "MarkerMap::getImage", __FILE__, __LINE__); - - auto Dict = Dictionary::loadPredefined(dictionary); -diff --git a/src/aruco/posetracker.cpp b/src/aruco/posetracker.cpp -index 4cb14f4..7b571a2 100755 ---- a/src/aruco/posetracker.cpp -+++ b/src/aruco/posetracker.cpp -@@ -416,13 +416,13 @@ void MarkerMapPoseTracker::setParams(const CameraParameters& cam_params, - _msconf = msconf; - _cam_params = cam_params; - if (!cam_params.isValid()) -- throw cv::Exception(9001, "Invalid camera parameters", -+ throw cv::Exception(static_cast(9001), "Invalid camera parameters", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX && markerSize <= 0) -- throw cv::Exception(9001, "You should indicate the markersize since the MarkerMap is in pixels", -+ throw cv::Exception(static_cast(9001), "You should indicate the markersize since the MarkerMap is in pixels", - "MarkerMapPoseTracker::setParams", __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::NONE) -- throw cv::Exception(9001, "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", -+ throw cv::Exception(static_cast(9001), "Invalid MarkerMap", "MarkerMapPoseTracker::setParams", - __FILE__, __LINE__); - if (_msconf.mInfoType == MarkerMap::PIX) - _msconf = _msconf.convertToMeters(markerSize); diff --git a/distros/humble/patch/ros2-aruco-ros.patch b/shared/patch/ros2-aruco-ros.patch similarity index 100% rename from distros/humble/patch/ros2-aruco-ros.patch rename to shared/patch/ros2-aruco-ros.patch diff --git a/distros/humble/patch/ros2-aruco.patch b/shared/patch/ros2-aruco.patch similarity index 100% rename from distros/humble/patch/ros2-aruco.patch rename to shared/patch/ros2-aruco.patch