Tutorial - AprilTag Detection with ZED and Isaac™ ROS
Tutorial - AprilTag Detection with ZED and Isaac™ ROS
This tutorial demonstrates how to create an Isaac™ ROS application using AprilTag detection as example. It assumes you have already set up the ZED camera and are publishing its data using the zed-ros2-wrapper packages as described in the Setting up Isaac™ ROS to work with ZED Cameras in ROS 2 section.
The application will subscribe to the ZED camera’s image stream, convert the ZED images to a supported format, and finally process the images to detect AprilTags, and publish the detected tags’ information.

The example leverages the NITROS communication framework for efficient data exchange between the ZED camera and the AprilTag detection module through the GPU memory without unnecessary data copies on CPU.
It is not required to rectify the images for AprilTag detection, because the ZED Wrapper component handles any necessary image preprocessing in the GPU memory through the ZED SDK.
Please refer to the official NVIDIA® documentation for more details on the Image Format Converter and AprilTag Isaac™ ROS nodes.

Setup the example
If you haven’t done so already, set up your development environment by following our NVIDIA® Isaac™ ROS installation guide.
Install the ZED ROS2 Examples packages in the workspace:
If you are using Docker, start the Isaac™ ROS environment with ZED support:
Install the Isaac™ ROS AprilTag and Image Process packages in the workspace:
Build the AprilTag detection application:
Run the AprilTag detection application
Before running the AprilTag detection application you must configure the example.
Modify the zed_isaac_ros_april_tag.yaml file to configure the AprilTag detection parameters:
size: The size of the AprilTag in meters (e.g., 0.155).max_tags: The maximum number of tags to detect (e.g., 64).tile_size: The tile/window size for adaptive thresholding in pixels (e.g., 4).tag_family: The family of AprilTags to detect. CUDA backend only supportstag36h11. CPU and PVA backends supporttag36h11,tag16h5,tag25h9,tag36h10,tag36h11,circle21h7,circle49h12,custom48h12,standard41h12,standard52h13backends: The backend to use for detection. Options includeCPU,CUDA,PVA.
You can generate the April Tags using the tool at this page.
Modify the zed_params.yaml file to configure the ZED camera parameters:
grab_resolution: The native camera grab resolution. Options includeHD2K,HD1200,HD1080,HD720,SVGA,AUTO.grab_frame_rate: The ZED SDK internal grabbing rate. Options include60,30,15forHD1200/HD1080and120,60,30,15forSVGA.pub_resolution: The resolution used for image and depth map publishing. Options includeNATIVEandCUSTOM. SetNATIVEto use the samegeneral.grab_resolution; setCUSTOMto apply thegeneral.pub_downscale_factordownscale factory to reduce bandwidth in data transmission.pub_downscale_factor: The rescale factor used to rescale the image before publishing whenpub_resolutionisCUSTOM.pub_frame_rate: The data publishing frame rate.
Visualize Results
First, make sure you compiled and built the example as described in the Setup section.
If you are using Docker, make sure to start the Isaac™ ROS environment with ZED support:
Start the processing by using the command:
where <camera_model> is the model of the ZED camera you are using (e.g., zedx, zed2i, etc.).
Point the camera to an AprilTag target and observe the AprilTag detection output /tag_detections on a separate terminal with the command:
The AprilTag detection does not use the ZED depth information, so you can use this tutorial indifferently with a ZED stereo or monocular camera.
You can visualize the full ROS2 topic graph with:

The launch file explained
The launch file launch/zed_isaac_ros_april_tag.launch.py is responsible for starting all the necessary nodes and configurations for the AprilTag detection application. It sets up the parameters, including the ZED camera settings and the AprilTag detection parameters, and launches the required nodes in a ROS 2 component container.
Retrieve the configuration parameters from the relative path config/zed_isaac_ros_april_tag.yaml and config/zed_params.yaml:
Create a ROS 2 component container:
Create a ZED Component and automatically load it into the container_name container previously created:
Setup the Image Format converter resolution by retrieving the information from the camera configuration:
Create the Image Format Converter component and set the resolution parameter and the required topic name remappings:
Create the AprilTag component with the required topic name remappings:
Load the Image Converter and AprilTag components into the container:
The launch file accepts two arguments:
camera_model: The model of the camera being used (e.g., ZED 2i, ZED 2, etc.).disable_tf: IfTruedisable TF broadcasting for all the cameras in order to fuse visual odometry information externally.
These arguments can be passed when launching the file to customize the behavior of the nodes.
Fix the TF issue (optional)
If you notice that the TF of the detected AprilTags is not correctly propagated, you must download the patched version of the isaac_ros_apriltag package and build it from the source.
Clone the repository into your workspace:
Fetch the specific Pull Request that contains the fix:
Build the package:
Now you can run the launch file again, and the TF of the detected AprilTags should be correctly propagated.

