Home

>

Software

ARTag tracking with Alvar

In this example, we will use ar_track_alvar package for detecting individual markers.

Prerequisites

An AR-tag is a fiduciary marker system that can help with robot perception challenges, serving as a point of reference for autonomous tasks.

In this example, we will use ar_track_alvar package for detecting individual markers.

As sending raw images from the camera via wireless network may be insufficient, we will relay all the processing to the Raspberry Pi.

Installation

Start by

Logging into your Rover via SSH

Create a workspace in your home directory if you don't have one yet:

Create a new package that depends on ar_track_alvar:

Run rosdep to install dependent packages:

Now, add launch/ and config/ directories inside your package:

Inside launch/ directory add alvar.launch file with the following content:

leo_alvar_example/launch/alvar.launch

Inside config/ directory add alvar.yaml file:

leo_alvar_example/config/alvar.yaml

You will most likely need to change marker_size parameter depending on the actual size of your printed AR tag. You can read more about the parameters on the package wiki.

And build the package:

Launch

To start the Alvar tracking, type:

If you want to start the node when the rover boots, add this line to robot.launch file:

/etc/ros/robot.launch

Generate ARTags

Now, we need to create some markers, so go back to your computer.

Install the ar_track_alvar package:

And run the createMarker script:

This will create MarkerData_0.png file that stores a 10cm x 10cm marker with id 0. Print this file on a sheet of paper.

Due to differences in printer setups, the actual size of the printed marker may be different. Make sure the marker_size parameter represents the actual size (in centimeters) of the AR tag.

Now to visualize detected AR Tags, you just need to:

  • open RViz, by typing rviz in the terminal
  • set Fixed Frame to base_link
  • Click Add -> Marker and set Marker Topic to visualization_marker
  • (optionally) Click Add -> RobotModel to visualize the Rover
  • (optionally) Click Add -> Image, set Image Topic to /camera/image_raw and Transport Hint to compressed to open the image stream

If all goes well, you should end up with something like this:

The detected AR Tags are also published to /ar_pose_marker topic, so you could use the output in your custom nodes.

Contents

Need help? Contact us - contact@fictionlab.pl