Tutorial for AprilTag Detection with a USB Camera#
Overview#
This tutorial walks you through a graph to estimate the 6DOF pose of AprilTags using images streamed from a USB camera.
Tutorial Walkthrough#
Complete the Isaac ROS AprilTag Quickstart section.
Calibrate your USB camera before starting this tutorial. In the activated Isaac ROS environment, save the resulting calibration YAML as
${ISAAC_ROS_WS}/camera_info.yaml. The launch command below loads this file for both binary packages and source builds. The package’s bundledconfig/camera_info.yamlis only an example calibration.Install the ROS 2
usb_campackagesudo apt-get install -y ros-lyrical-usb-cam
Activate the Isaac ROS environment:
isaac-ros activateFinally, launch the provided launch file:
Warning
Set
camera_widthandcamera_heightto the resolution used for camera calibration. The camera must support this resolution.ros2 launch isaac_ros_apriltag isaac_ros_apriltag_usb_cam.launch.py \ camera_width:=1280 camera_height:=720 \ camera_info_url:=file://${ISAAC_ROS_WS}/camera_info.yaml
Launch a second terminal inside the container
isaac-ros activateInstall RViz:
sudo apt-get install -y ros-lyrical-rviz2 source /opt/ros/lyrical/setup.bash
Run RViz2 using the preset config file
rviz2 -d $(ros2 pkg prefix isaac_ros_apriltag --share)/rviz/usb_cam.rviz
Note
Your camera vendor may offer a specific ROS 2-compatible
camera driver package and you can use that in place of the usb_cam
package.
Warning
If you are using a different camera driver
package ensure that the camera stream publishes Image and
CameraInfo pairs to the topics /image_raw and /camera_info,
respectively.