woensdag 8 april 2015

Recognize AR tags with ROS

Augmented Reality tags, or AR markers, are a very useful in robotics. They can be used to identify objects or to calibrate the robot's position. 

I experimented with AR_Kinect earlier on, but that package was very instable. Now, a new package has come out, called AR_Track_Alvar that can be used to scan for AR tags.



Software:
I tested this on ROS Indigo.

Hardware:
Just some piece of paper with *one* AR tag on it. I used this example which I extracted from the samples on the wiki AR_Track_Alvar . 

Installation:
Simply install using 
sudo apt-get install ros-indigo-ar-track-alvar

Starting:
The package comes with some launch files for the PR2 which can be used as an example to create your own.
I use a Turtlebot with a Kinect to scan for AR tags and use the following launch file for that; I named it alvar.launch:
<launch>
    <include file="$(find turtlebot_bringup)/launch/3dsensor.launch"/>

    <arg name="marker_size"          default="5.0" />
    <arg name="max_new_marker_error" default="0.05" />
    <arg name="max_track_error"      default="0.05" />
    <arg name="cam_image_topic"      default="/camera/depth_registered/points" />
    <arg name="cam_info_topic"       default="/camera/rgb/camera_info" />
    <arg name="output_frame"         default="/camera_rgb_optical_frame" />

    <node name="ar_track_alvar" pkg="ar_track_alvar" type="individualMarkers" respawn="false" output="screen" args="$(arg marker_size) $(arg max_new_marker_error) $(arg max_track_error) $(arg cam_image_topic) $(arg cam_info_topic) $(arg output_frame)" />
</launch>

Change the marker size if needed and set the topics as per published and then launch the system in one go:
roslaunch alvar.launch


Checking the output:
Check the /ar_pose_marker topic for AR markers detected.
rostopic echo /ar_pose_marker


Geen opmerkingen:

Een reactie posten