Skip to content

Add aruco_ros - #87

Closed
baradejoo wants to merge 4 commits into
RoboStack:mainfrom
baradejoo:add-aruco-ros
Closed

baradejoo wants to merge 4 commits into
RoboStack:mainfrom
baradejoo:add-aruco-ros

Conversation

@baradejoo

Copy link
Copy Markdown
Contributor

Summary

  • Add aruco_ros (5.0.5) to vinca.yaml. This pulls in aruco and aruco_msgs as well.
  • patch/ros-lyrical-aruco.patch: make the aruco library build with OpenCV 5 and Eigen 5 from conda-forge (the ROS buildfarm builds it against OpenCV 4.10 / Eigen 3.4 from Ubuntu, so these issues don't show up there):
    • find_package(OpenCV 4.2.0 REQUIRED) rejects OpenCV 5.0.0 ("The version found is not compatible with the version requested"), so the version requirement is dropped.
    • Eigen 5 no longer sets EIGEN3_INCLUDE_DIRS ('Eigen/Core' file not found), so the library links Eigen3::Eigen instead.
    • opencv2/calib3d/calib3d.hpp and opencv2/features2d/features2d.hpp don't exist in OpenCV 5, use the top-level opencv2/calib3d.hpp / opencv2/features2d.hpp headers (available in OpenCV 4 as well). fractalposetracker.cpp also needs an explicit opencv2/features2d.hpp include for cv::FastFeatureDetector.
    • OpenCV 5 removed the cv::Exception(int, ...) constructor, it only takes cv::Error::Code now. Most of the patch is this mechanical change: cv::Exception(9001, ...) → cv::Exception(static_cast<cv::Error::Code>(9001), ...) (45 call sites, same error codes).
  • patch/ros-lyrical-aruco-ros.patch:
    • ament_target_dependencies is no longer available in lyrical, replaced with target_link_libraries on the dependency targets (same approach as the other patches in this repo).
    • The deprecated tf2/*.h and tf2_ros/*.h headers were removed in lyrical, switched to the .hpp headers.
    • "opencv4/opencv2/calib3d.hpp" is hardcoded, which doesn't exist with OpenCV 5 (include/opencv5), use "opencv2/calib3d.hpp".

aruco_ros 5.0.5 (the version in the current rosdistro snapshot) was never published for lyrical via apt (ros-lyrical-aruco and ros-lyrical-aruco-msgs 5.0.5 are). Upstream fixed the ament_target_dependencies and tf2 header issues in 5.0.6, released on 2026-10-10 and already built on the buildfarm (Lbin_uR64__aruco_ros__ubuntu_resolute_amd64__binary). Once the snapshot is updated to 5.0.6, the aruco_ros patch can be reduced to the hardcoded opencv4/ include path fix.

Notes

Tested locally on osx-arm64: aruco, aruco_msgs and aruco_ros build, and the nodes start in a fresh pixi environment:

$ pixi run ros2 run aruco_ros double --ros-args -p parent_name:=camera -p child_name1:=marker1 -p child_name2:=marker2
[INFO] [1791719465.593098000] [aruco_double]: Image is rectified: 1
[INFO] [1791719465.609170000] [aruco_double]: ArUco node started with marker size of 0.050000 meters and marker ids to track: 582, 26
[INFO] [1791719465.609185000] [aruco_double]: ArUco node will publish pose to TF with (camera, marker1) and (camera, marker2) as (parent,child).

Without the required parameters, double exits on purpose (parent_name and/or child_name was not set!), but on macOS this exit path then aborts with mutex lock failed: Invalid argument, because the global node is destroyed after rclcpp::shutdown(). That's an upstream issue in the error path only and not related to this PR.

@Tobias-Fischer

Copy link
Copy Markdown
Contributor

Candidate for porting to the RoboStack monorepo, RoboStack/robostack, where all ROS 2 distributions are now built. aruco_ros is in lyrical's snapshot there but not selected yet; the selection would go to the shared shared/vinca.yaml (so all distributions get it where it builds) and the patches to distros/lyrical/patch/. Pull requests can't be transferred, so if a maintainer replies "go ahead", I'll open the equivalent PR there, crediting @baradejoo.

🤖 Claude (AI assistant), on behalf of @Tobias-Fischer

@baradejoo

Copy link
Copy Markdown
Contributor Author

go ahead

1 similar comment
@Tobias-Fischer

Copy link
Copy Markdown
Contributor

go ahead

Tobias-Fischer added a commit to RoboStack/robostack that referenced this pull request Oct 25, 2026
* 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 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>

* aruco_ros: select it once [skip ci]

The selection line was added twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 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 <noreply@anthropic.com>

* aruco_ros: build on Windows too

Export all symbols of the aruco and aruco_ros_utils libraries on Windows
(aruco only dllexports with ARUCO_DSO_EXPORTS, which its CMake never sets).
Recipe test on Windows: the single executable is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Kamil Baradziej <49471097+baradejoo@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants