Welcome to Raspberry Pi 5 repository
2.AR QR code
2.AR QR code
The Raspberry Pi motherboard does not currently support running this function on the motherboard, but the image data can be transmitted to the virtual machine through distributed communication, and the virtual machine can track and identify it. The premise is that the motherboard and the virtual machine need to set up distributed communication, refer to the previous tutorial to set up.
2.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.
2.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.
The files generated by the above two generation methods are stored in the terminal directory of the running command.
2.3 ARTag identification
Raspberry Pi motherboard startup method is as follows:
xxxxxxxxxx#Establishing multi-machine communication between Raspberry Pi and virtual machine, and taking Raspberry Pi as the host as an exampleroslaunch usb_cam usb_cam-test.launch #Start the Raspberry Pi and drive the USB cameraroslaunch dofbot_visual ar_track.launch open_rviz:=true #Start the virtual machine, identify and trackJetson-nano and the virtual machine are started as follows,
xxxxxxxxxxroslaunch dofbot_visual ar_track.launch open_rviz:=true
The open_rviz parameter is open by default

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.
2.4 ar_track_alvar node
Subscribed topics:

Topics posted:

2.5 View the node diagram
Terminal input,
xxxxxxxxxxrqt_graph
