Internal:Ar recog june

From Brown University Robotics

Jump to: navigation, search

Contents

Description

Build

 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.

Interface

Defines two message types:

  • Tag.msg
    • id: The tag's serial number. Numbers are assigned in the order in which they are defined in the "object_data" file.
    • cf: The confidence factor provided by AR Toolkit
    • x: Horizontal location of the tag's center, in pixels
    • y: Vertical location
    • diameter: Number of pixels occupied by the center square of the AR tag
    • distance: Distance between camera focal plane and AR tag, in millimeters
    • xRot: Apparent (from the camera's perspective) rotation of the tag about its horizontal (with respect to the camera image plane) axis, in radians.
    • yRot: Apparent rotation about the vertical axis
    • zRot: Apparent rotation about the depth axis
    • xMetric: Cartesian coordinates of the tag, from the reference frame of the camera at the origin and facing along the x-axis. xMetric is the distance along the x-axis (the ray extending forward and backwards from the camera plane)
    • yMetric: Distance along the y-axis (left and right from the camera's perspective)
    • zMetric: Distance along the z-axis (up and down from the camera's perspective)
    • cwCorners: Pixel coordinates of the four corners of the AR tag
  • Tags.msg
    • image_width: Width in pixels
    • image_height: Height in pixels
    • angle_of_view: Horizontal camera angle of view
    • tag_count: Number of tags in view
    • tags: Array of Tag messages, one for each tag in view

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.
This page was last modified on 11 June 2010, at 15:08. This page has been accessed 18 times.