Internal:Ar recog june

From Brown University Robotics

Revision as of 14:57, 11 June 2010 by Chriscrick (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search




 rosmake ar_recog

The ar_recog package downloads and compiles the AR Toolkit. It must therefore be able to connect to Sourceforge on the internet. This also accounts for why this step takes rather longer than many compilations.


Defines two message types:

  • Tag.msg
    • id
    • cf
    • x
    • y
    • diameter
    • distance
    • xRot
    • yRot
    • zRot
    • cwCorners
  • Tags.msg
    • image_width
    • image_height
    • angle_of_view
    • tag_count
    • tags

And one service:

  • CalibrateDistance.srv
    • dist
    • aov (return value)

To Run

To run code that listens to /image messages

 rosrun ar_recog ar_recog 

To run code for a specific image message such as one from gscam:

 rosrun ar_recog ar_recog image:=/gscam/image

ar_recog publishes two messages tags contains the Tags message, the information about the found tags

ar/image contains the image with the tags outlined in the image

If the camera image is a rectified one with appropriate camera parameters, ar_recog will use them to determine the mapping between image space and physical space. However, the rectification pipeline is slow and camera calibration brittle, so the package also provides distance mapping with uncalibrated images. To use this feature, it must know your camera's horizontal angle of view. This can be provided as a ROS parameter ("aov"), or determined using the CalibrateDistance service.

Calibrating distance

  1. Set up a clear, recognized AR tag at a known distance from the camera.
  2. Start the ar_recog node and monitor the /tags message
  3. Arrange the AR tag and camera so that the tag coordinates are as close as possible to the center of the image, and the xRot, yRot and zRot are as close as possible to zero. This will minimize distortion.
  4. Call the CalibrateDistance service, where <dist> is the distance between the AR tag and the camera in millimeters:
 rosservice call calibrate_distance <dist>
  1. The more accurately the distance is known, the better ar_recog is able to undistort the image. Thus you may have to repeat the service call a few times until the reported distance converges on the value you are providing.
  2. Save this aov value to provide as a ROS parameter next time you use ar_recog with this camera.