7. AR QR code

7.1. Overview

wiki:http://wiki.ros.org/ar_track_alvar/

Source code:https://github.com/ros-perception/ar_track_alvar.git

Feature pack location:~/yahboomcar_ws/src/yahboomcar_visual

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.However, its encoding system is still very different from QR codes. It is mostly used in camera calibration, robot positioning, augmented reality (AR) and other applications. One of its important functions is to identify the pose 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:

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 identification method that does not slow down significantly as the number of tags increases.

7.2. Create ARTag

7.2.1. Install software package

file path,

ar_track_alvar is an open source marker library, which provides examples of pr2+kinect. The first use case of this package is to identify and track gestures from (possibly) multiple AR tags, each considered individually.

7.2.2. Create AR QR code

image-20210902164850255

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.

image-20210902165006781

Command + parameters directly generate digital pictures; for example

11:The number is the QR code of 11. -s: Specifies the image size. 5:5x5 picture. 33:The number is the QR code of 33. The generated pictures are stored in the directory of the current terminal.

7.3. ARTag identification

Note: When starting the camera, the camera calibration file needs to be loaded, otherwise it cannot be recognized.

7.3.1. Start the identification instance

image-20210902194448055

In rviz, you need to set the corresponding camera topic name.

7.3.2. launch file analysis

Node parameters:

7.3.3. ar_track_alvar node

topic nametype of data
/camera_info(sensor_msgs/CameraInfo)
/image_raw(sensor_msgs/Image)
topic nametype of data
/visualization_marker(visualization_msgs/Marker)
/ar_pose_marker(ar_track_alvar/AlvarMarkers)

Single QR code: Camera coordinate system → AR tag coordinate system

Multiple QR codes: Provides transformation from the camera coordinate system to each AR tag coordinate system (named ar_marker_x), where x is the ID number of the marker.

7.3.4. View node graph

image-20210902204026973

7.3.5. View tf tree

image-20210902203913123

Through rviz, we can intuitively see the relative position of the QR code and the camera. The camera and world coordinate system are set by yourself.

7.3.6. View output information

The display is as follows: