11. AprilTag tag code follow

11.1 Introduction

Apriltag tag code tracking is based on apriltag tag code recognition, adding the function of car body movement, controlling the car body so that the camera will keep the tag code moving left and right in the middle of the vision, and based on the principle that objects are larger when near and smaller when far in the camera image, the tag code following function is realized.

11.2 Startup

11.2.1 Preparation before program startup

This apriltag tag code uses TAG36H11 format, and the factory has equipped the relevant tag code and attached it to the building block. You need to take out the building block and place it on the camera screen for recognition.

11.2.2 Program description

After the program is started, the camera captures the image, puts the tag code into the camera screen, and the system will recognize and frame the four vertices of the tag code and display the ID number of the tag code. Then slowly move the position of the building block, and the car will move forward and backward, left and right with the building block.

Note: When the building blocks move, the label code should face the camera, and the movement speed should not be too fast to prevent the camera pan/tilt from failing to keep up.

image-20240702165110669

11.2.3, Program Startup

Open a terminal and enter the following command to enter docker,

The following interface appears, indicating that you have successfully entered docker

image-20240814152903441

Enter the following command in the docker terminal to start the program

11.2.4, Source code

After entering the docker container, the source code of this function is located at,

Code path: /root/yahboomcar_ws/src/yahboomcar_apriltag/yahboomcar_apriltag/apriltag_follow.py