UP | HOME

April Tags Activity

Camera Calibration

# Start the camera node (exact command depends on your hardware)
ros2 run usb_cam usb_cam_node_exe --ros-args -p framerate:=30.0

# Run the camera calibration
ros2 run camera_calibration cameracalibrator --size 8x6 --square 0.108 --ros-args -r image:=/image_raw

# Do the calibration, it gets saved to /tmp/calibrationdata.tar.gz

# Extract the calibration data
cd /tmp
mkdir calib
mv /tmp/calibrationdata.tar.gz /tmp/calib
cd /tmp/calib
tar xf calibrationdata.tar.gz

# Kill the usb_cam node and restart, this time loading the calibration
ros2 run usb_cam usb_cam_node_exe --ros-args -p framerate:=30.0 -p camera_info_url:=file:///tmp/calib/ost.yaml

# Start the image proc pipeline
ros2 launch image_proc image_proc.launch.py

# Note that this is made up of components
ros2 component list

# compare the rectified and non-rectified image
ros2 run rqt_image_view rqt_image_view

April Tags

  1. Install the apriltag_ros package
    • This package will automatically install the apriltag package
    • apriltag is a ROS-independent library and apriltag_ros provides a ROS API for it
  2. Need to print April tags, with a specified size
  3. Create the tags.yaml file describing the april tags (see instructions in in the apriltag_ros git repository.
  4. Run ros2 run apriltag_ros apriltag_node --ros-args --params-file ./file.yaml
    • Remap image and camera_info topics as needed
    • file.yaml should be the name of the file containing the configuration

Rviz

  1. Run rviz2
  2. Add the rectified image and a tf tree
  3. Put tag in the frame, then change fixed frame to default cam
  4. You can now add a Camera rather than an image
  5. Have fun!

Author: Matthew Elwin.