SkyloveQiu / aruco_ros2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ros2_aruco

ROS2 Wrapper for OpenCV Aruco Marker Tracking

This package depends on a recent version of OpenCV python bindings and transforms3d library:

sudo apt install ros-<distro>-usb-cam
pip3 install opencv-contrib-python==3.4.18.65 transforms3d

ROS2 API for the ros2_aruco Node

This node locates Aruco AR markers in images and publishes their ids and poses.

Subscriptions:

  • /image_raw (sensor_msgs.msg.Image)
  • /camera_info (sensor_msgs.msg.CameraInfo)

Published Topics:

  • /aruco_poses (geometry_msgs.msg.PoseArray) - Poses of all detected markers (suitable for rviz visualization)
  • /aruco_markers (ros2_aruco_interfaces.msg.ArucoMarkers) - Provides an array of all poses along with the corresponding marker ids

Parameters:

  • marker_size - size of the markers in meters (default .0625)
  • aruco_dictionary_id - dictionary that was used to generate markers (default DICT_5X5_250)
  • image_topic - image topic to subscribe to (default /camera/image_raw)
  • camera_info_topic - Camera info topic to subscribe to (default /camera/camera_info)
  • camera_frame - Camera optical frame to use (default to the frame id provided by the camera info message.)
  • video_device - choose camera to use.

Running Marker Detection

  1. Using the launch file - parameters will be loaded from aruco_parameters.yaml and _camera_param.yaml.
colcon build
source install/setup.bash/source install/setup.zsh
ros2 launch ros2_aruco aruco_recognition.launch.py
  1. As a single ROS 2 node - you can specify parameter values at startup by adding --ros-args -p marker_size:=.05, for example.
ros2 run ros2_aruco aruco_node

pip3 install opencv-contrib-python transforms3d

Generating Marker Images

ros2 run ros2_aruco aruco_generate_marker

Pass the -h flag for usage information:

usage: aruco_generate_marker [-h] [--id ID] [--size SIZE] [--dictionary]

Generate a .png image of a specified maker.

optional arguments:
  -h, --help     show this help message and exit
  --id ID        Marker id to generate (default: 1)
  --size SIZE    Side length in pixels (default: 200)
  --dictionary   Dictionary to use. Valid options include: DICT_4X4_100,
                 DICT_4X4_1000, DICT_4X4_250, DICT_4X4_50, DICT_5X5_100,
                 DICT_5X5_1000, DICT_5X5_250, DICT_5X5_50, DICT_6X6_100,
                 DICT_6X6_1000, DICT_6X6_250, DICT_6X6_50, DICT_7X7_100,
                 DICT_7X7_1000, DICT_7X7_250, DICT_7X7_50, DICT_ARUCO_ORIGINAL
                 (default: DICT_5X5_250)

About

License:MIT License


Languages

Language:Python 25.9%Language:CMake 24.9%Language:Shell 20.4%Language:C 14.2%Language:C++ 8.5%Language:PowerShell 6.0%