Welcome to DOFBOT Pro repository
6.AR QR code
6.AR QR code
This section is a dedicated course for the Jetson-Nano mainboard. The Orin mainboard does not have a ROS1 environment and cannot run the following programs. The startup commands for this section are run on the Jetson-Nano host machine (mainboard). Simply open a terminal directly on the mainboard and enter the course commands; there is no need to run them in Docker.
6.1 Overview
ARTag (AR tag, AR means "augmented reality") is a benchmark marking system that can be understood as a reference for other objects.It looks similar to a QR code, but its encoding system is still very different from a QR code. It is mostly used in camera calibration, robot positioning, augmented reality (AR) and other applications.One of the most important functions is to identify the position relationship between the object and the camera. ARTag can be attached to the object, or ARTag label can be attached to the plane to calibrate the camera. After the camera recognizes the ARTag, it can calculate the position and attitude of the tag in the camera coordinates.
ar_track_alvar has 4 main functions:
- Generate AR tags with different sizes, resolutions and data/ID encodings.
- Recognize and track poses of individual AR tags, optionally integrating kinect depth data (when kinect is available) for better pose estimation.
- Recognize and track poses in "bundles" consisting of multiple tags. This allows for more stable pose estimation, robustness to occlusions, and tracking of multilateral objects.
- Automatically calculate spatial relationships between tags in bundles using camera images so users don't have to manually measure and enter tag locations in an XML file to use the bundle feature.
Alvar is newer and more advanced than ARToolkit, which has been the basis for several other ROS AR tag packages. Alvar features adaptive thresholding to handle various lighting conditions, optical flow-based tracking for more stable pose estimation, and an improved tag recognition method that does not slow down significantly as the number of tags increases.
6.2 Create AR QR code
- Continuously generate multiple tags on one image
roscorerosrun ar_track_alvar createMarker

You can enter [ID] and location information here, and enter [-1] to end. One or more can be generated, and the layout can be designed by yourself.

Generate a single number: command + parameters directly generate a digital picture; for example
xxxxxxxxxxrosrun ar_track_alvar createMarker 11rosrun ar_track_alvar createMarker -s 5 3311: The number is the QR code of 11. -s: Specify image size. 5: 5x5 picture. 33: The number is the QR code of 33.
6.3 ARTag identification
Open the terminal and run the following command
xxxxxxxxxxroslaunch dofbot_visual ar_track.launch open_rviz:=true
- Just open the open_rviz parameter by default and put the TAG tag code into the camera image, as shown in the figure below.

In rviz, you need to set the corresponding camera topic name.
- Image_Topic: The camera topic is [/usb_cam/image_raw].
- Marker: The display component of rviz. Different squares display the location of the AR QR code.
- TF: The display component of rviz, used to display the coordinate system of AR QR codes.
- Camera: The display component of rviz, which displays the camera screen.
- world: world coordinate system.
- usb_cam: camera coordinate system.
6.4 ar_track_alvar node
Subscribed topics:
| Topic | Data Types |
|---|---|
| /camera_info | (sensor_msgs/Camerainfo) |
| /image_raw | (sensor_msgs/image) |
Topics posted:
| Topic | Data Types |
|---|---|
| /visualization_marker | (visualization_msgs/Marker) |
| /ar_pose_marker | (ar_track_alvar/AlvarMarkers) |
6.5 View the node diagram
Terminal input,
xxxxxxxxxxrqt_graph
