Pose estimation is a common problem one has to solve when working in robotics. A common solution is to attach tags to the objects that are able to detect using cameras. One of the most wide spread implementations of this are the OpenCV ARUCO tags. In the ARCOS-Lab we attach ARUCO tags to the objects that the Humanoid robot is going to be interacting with.
We have developed a fast ARUCO detector for ROS2-humble. So far we have been able to detect tags in a video streams 1920x1080@90fps
, which is more than we usually need in our robot.
Make sure that you have a working installation of ROS2-humble. You can follow the simulator tutorial for more info on that.
cd ~/wsr2/src
git clone git@gitlab.com:arcoslab/arcos-lab-cognitive-architecture/humanoid_utils/ros2-aruco-detector.git
cd
source ros2_setup.sh
cd ~/wsr2
colcon build
cd
source ros2_setup.sh
TO run the ARUCO detector node:
cd
source ros2_setup.sh
ros2 run aruco_detector aruco_detector
The node subscribes to a images topic (By default the topic is /image
but you can change it with a simple remap by adding the following to the node call -r image:=/namespace/topic_name
). The image topic is usually published by a camera topic and it has the images that the camera is capturing. This node also subscribes to a camera_info
topic, this topic holds the intrinsic calibation parameters of the camera. We need the intrinsic calibration for doing the 2D->3D transforms.
The node publishes to two topics. status
has some statistics of the aruco-detector node. The topic aruco_detection
is used to publish the poses of the detected aruco tags for each frame. It is important to note that this poses are stamped with the same timestamp of the image they were detected in, not with the timestamp of detection. In some sense aruco_detection
is the output of this node, you can subscribe to this topic if you want to send the info to /tf
or you can read it directly in your node.
This is the definition of the MarkerPosesStamped
message, being published to aruco_detection
.
std_msgs/Header header
int32[] marker_ids
geometry_msgs/Pose[] poses
resize_factor float, default 1.0
: Before processing, the image is going to be resized according to this factor. This is useful when working with very big resolutions to improve performance.
marker_size float, default 0.019
: The actual physical size of the marker measured in meters. This is very important because the aparent size of the marker in the image is used to calculate the distance to the camera, so you have to make sure this measurement is correct.
image_is_rectified bool, default false
: Tells the node how to use the intrinsic parameters in camera_info
.
aruco_dict string, default "4x4_50"
: This will tell the node to look for specific patterns in the tags. All dictionaries can be expressed as axa_N
, where a is the amount of subdivisions in the tag and N how many different tags there are. The lower a
is, the easier is for cameras to detect. With low resolution cameras prefer lower values of a
. Low values of N
also make the algorithm to work faster, because less comparisons are needed to detect each tag. The supported dictionaries are:
4x4_50
4x4_100
4x4_250
4x4_1000
5x5_50
5x5_100
5x5_250
5x5_1000
6x6_50
6x6_100
6x6_250
6x6_1000
7x7_50
7x7_100
7x7_250
7x7_1000