Ask Your Question

Unable to detect AprilTag using ROS

asked 2017-08-23 08:45:03 -0500

Sulphur gravatar image

updated 2017-08-24 04:38:15 -0500

Hi, I was looking on the internet regarding resources to set-up ROS for detecting AprilTags. I came upon a write-up at about the same.

My background: I am a novice in ROS and is working on detecting apriltags using ROS. I have followed the tutorials and have the launch files, both for my camera driver(same as the usb_cam mentioned in the link) and apriltags_ros. I have caliberated the camera and have the needed .yaml file. I can view the raw and rectified images from my camera but can't read the apriltags, I am using tag36h11.

After reading the write-up( of the link) I believe, I don't have the correct set of code in my launch file as a part of roslaunch apriltag_ros [launchfilename].launch. I am attaching the code of my launch file.

  <node pkg="apriltags_ros" type="apriltag_detector_node" name="apriltag_detector" output="screen">
   <!-- Remap topic required by the node to custom topics -->
     <remap from="image_rect" to="image_rect" />
     <remap from="camera_info" to="camera_info" />

     <param name="/image_rect" type="string" value="/camera/image_rect"/>
     <param name="/camera_info" type="string"  value="/camera/camera_info"/>

     <!-- Select the tag family: 16h5, 25h7, 25h9, 36h9, or 36h11(default) -->
     <param name="tag_family" type="str" value="36h11" />

     <!-- Enable projected optical measurements for more accurate tag transformations -->
     <!-- This exists for backwards compatability and should be left true  for new setups -->
     <param name="projected_optics" type="bool" value="true" />

     <!-- Describe the tags -->
     <rosparam param="tag_descriptions">[
       {id: 0, size: 0.02},
       {id: 1, size: 0.163513, frame_id: a_frame},
       {id: 2, size: 0.163513},
       {id: 3, size: 0.163513},
       {id: 4, size: 0.163513},
       {id: 5, size: 0.163513}]

I am using tag36h11, id=0. The width of the block is 2cm and hence the change in id=0 in the above code. Can someone please help me understand as to what is possibly wrong?

Also, after launching the two launch files (apriltags_ros/launch/my.launch and bluefox2-master/launch/my_cam.launch), if I direct my camera on the april tag (I am using tag36h11), shouldn't I be seeing some values in the terminal?

When I launch my camera driver launch file, I get this:

  • /camera/aec: False
  • /camera/agc: False
  • /camera/calib_url: file:///home/sris...
  • /camera/camera_name: camera
  • /camera/cbm: 0
  • /camera/ctm: 1
  • /camera/dcfm: 0
  • /camera/expose_us: 20000
  • /camera/fps: 30.0
  • /camera/frame_id: camera
  • /camera/gain_db: 0.0
  • /camera/hdr: False
  • /camera/identifier: 26805690
  • /camera/idpf: 2
  • /camera/image_raw/compressed/jpeg_quality: 80
  • /camera/mm: 0
  • /camera/request: 0
  • /camera/wbp: -1
  • /rosdistro: kinetic
  • /rosversion: 1.12.7

:NODES /camera/

image_proc (image_proc/image_proc)

viewer (image_view/image_view)   /

camera (bluefox2/bluefox2_single_node)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-08-23 10:38:43 -0500

vkee gravatar image

You need to put frame_ids for your tags, like the tag with id 1.

edit flag offensive delete link more


Can you explain me the "frame_id" thing? as in how to put them? Something like: id: 0, size: 0.02,frame_id: a_frame?

Sulphur gravatar image Sulphur  ( 2017-08-23 10:51:40 -0500 )edit

They just need to be unique. If I remember correctly (it was awhile since I worked with AprilTags), they will correspond to their tf frames.

vkee gravatar image vkee  ( 2017-08-23 10:53:25 -0500 )edit

@vkee I am sorry but I still don't get it. Is "a_frame"/tf frame a number? If yes, then how will i get it?

Sulphur gravatar image Sulphur  ( 2017-08-24 04:12:57 -0500 )edit

No, it is just a label. You can set them to anything - they just need to be unique. The detected AprilTags will appear with those tf labels in RVIZ. Here's a link to an AprilTag launch file I used successfully before ( ).

vkee gravatar image vkee  ( 2017-08-24 04:22:05 -0500 )edit

@vkee I added few details details to the question above. See if that info helps.

Sulphur gravatar image Sulphur  ( 2017-08-24 04:38:43 -0500 )edit

@vkee Okay, My file seems similar to yours except the
<remap from="image_rect" to="axis1"/> <remap from="camera_info" to="axis1/camera_info"/> part and tag ID thing.

Sulphur gravatar image Sulphur  ( 2017-08-24 04:41:43 -0500 )edit

@vkee One more thing, what is axis1 and axis/camera/info? Is this some path? I am sorry I am bugging so much but I am farely new to it. I did read the remap function but dint understand it much.

Sulphur gravatar image Sulphur  ( 2017-08-24 04:43:33 -0500 )edit

@vkee Alright! I made the file changes and did the following steps: 1. roslaunch bluefox2 my_cam.launch ( image_raw is set TRUE) 2. roslaunch apriltags_ros my.launch When I aim my camera at the Apriltag, nothing works!! I aint using RVIZ. I just want to see the co-ordinates it returns in terminal.

Sulphur gravatar image Sulphur  ( 2017-08-24 04:48:43 -0500 )edit

answered 2017-09-05 04:09:13 -0500

Sulphur gravatar image

updated 2017-09-05 09:54:02 -0500

jayess gravatar image

The camera is detecting the tag well and good. There were two issues:

  1. As correctly out by @vkee , I had not mentioned the frame id because of which it wasn't able to find the tag.
  2. I had remapped the topics incorrectly. I had written:

    <remap from="image_rect" to="image_rect"/> <remap from="camera_info" to="camera_info"/>

It was supposed to :

<remap from="image_rect" to="/camera/image_rect" />
<remap from="camera_info" to="/camera/camera_info" />

Hope this helps!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-23 08:37:14 -0500

Seen: 1,557 times

Last updated: Sep 05 '17