[Study Notes] AR code (QR code) recognition

【Use background】

ROS1 20.04 noetic

Depth camera: Intel RealSense Depth Camera D435

[Install ar_track_alver function package]

The function package is git downloaded from GitHub - machinekoder/ar_track_alvar at noetic-devel . Pay attention to the storage location and cd to the workspace before compiling.

catkin_make

     

【Create AR code】

The ar_track_alver function package provides the function of generating AR codes. First, cd to the ar_track_alvar-noetic-devel function package and use the following command to create a QR code label with the corresponding label:

rosrun ar_track_alvar createMarker AR_ID

 Among them, AR_ID creates a label with any number of AR codes, for example:

rosrun ar_track_alvar createMarker 0

Created an AR code label image with the label 0 (the test found that the label range is not only 0 to 65535 as Gu Yue said, AR codes after the 65535 label can also be generated), named MarkerData_0.png, and placed it at the current location of the terminal

 

 The createMarker tool also has many parameters that can be configured. Use the following command to view:

rosrun ar_track_alvar createMarker

 Interested friends can make more configurations, generate the AR code and print it out for later identification.

[Depth camera recognition AR code]

[Modify launch file]

Use pr2_indiv_no_kinect.launch in the ar-track-alver function package launch file as a blueprint, modify the parameter settings, and rename it to ar_track_camera.launch

 Mainly make the following changes:

1) Add TF coordinate conversion between world and camera

2) The detection code uses individualMarkersNoKinect (if you want to use other detection codes, you can refer to the node folder under the ar_track_alver package), and modify the topic name for subscribing image data (if you are not sure about the corresponding topic name, you can use rostopic list after starting the camera) View), as well as the actual size of the AR code used, in centimeters

3) rviz: After starting the recognition program, start rviz in the new terminal. You can configure it according to the topic name subscribed below. After saving, modify the path in the launch file.

【Start recognition program】

1) First start the camera

roslaunch camera_driver_transfer d435.launch 

2) Start the launch file you just wrote

roslaunch ar_track_alvar ar_track_camera.launch

The successful effect is as follows:

 Next, let me introduce my rviz configuration:

a) Fixed Frame: Select world

b)camera:订阅/camera/color/image_raw topic

c) marker: Select add in the lower left corner of the Displays window to add a marker

 Select topic/visualization_marker in marker

 In this way, you should be able to see the AR code displayed in the image, and you can see the pose status of the AR code.

At the same time, we can use ROS commands to view information in the AR topic

Use rostopic info and rostopic echo to view respectively

 【grateful】

Thanks to Teacher Gu Yue for "ROS Robot Development Practice"

This article is more of a supplementary explanation of Teacher Gu Yue’s use and actual use of the updated version of ar_track_alver.

 

Guess you like

Origin blog.csdn.net/weixin_44362628/article/details/123151484