yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
RDK X5 Robot📖
01. RDK-X5-Robot Introduction
  • 1.Introduction
  • 2.Common Problem Analysis
  • 3.Battery and charger usage precautions
  • 4.TF card expand capacity
02. Assembly Tutorial
  • Assembly Tutorial
  • Assembly Video-1
  • Assembly Video-2
  • Assembly Video-3
  • Assembly Video-4
03. Remote Control Course
  • 1.Mobile APP remote control
  • 2.USB Wireless Controller Remote Control
04. ROS Driver Board Course
  • 1. Introduction of extension board
  • 2. Set up STM32 development environment
  • 3. Key control buzzer sound
  • 4. FreeRTOS application
  • 5. Serial communication
  • 6. SBUS model remote control
  • 7. CAN bus communication
  • 8. RGB color light strip
  • 9. Timer interrupt control PWM servo
  • 10. Control serial steering gear
  • 11. Nine-axis attitude sensor to obtain data
  • 12. Control motor forward and reverse
  • 13. The timer captures encoder data
  • 14. Theory of robot kinematics analysis
  • 15. PID control robot motion
05. Basic Control Course
  • 1.Update expansion board firmware
  • 2.Install Python driver library
  • 3.Set the car type
  • 4.Open and close APP program control
  • 5.Turn hotspot mode on and off
  • 6.Buzzer sound
  • 7.Control the motor to rotate forward and reverse
  • 8.Controlling robot movement
  • 9.OLED display
  • 10.Control fans and lighting effects
06. Development Environment
  • 1. Virtual machine installation and use
  • 2. Linux Basics
  • 3. Remote connection
  • 4. Multi-machine communication configuration
  • 5. Bind device ID
  • 6. Image installation and backup
07. ROS2 Basic Course
  • 1. Introduction to ROS2
  • 2. ROS2 install Humble
  • 3. ROS2 development environment
  • 4. ROS2 workspace
  • 5. ROS2 function package
  • 6. ROS2 node
  • 7. ROS2 topic communication
  • 8. ROS2 service communication
  • 9. ROS2 action communication
  • 10. ROS2 custom interface message
  • 11. ROS2 parameter service case
  • 12. ROS2 meta-function package
  • 13. ROS2 distributed communication
  • 14. ROS2 DDS
  • 15. ROS2 time related API
  • 16. ROS2 common command tools
  • 17. ROS2 rviz2 use
  • 18. ROS2 rqt toolbox
  • 19. ROS2 Launch startup file configuration
  • 20. ROS2 recording and playback tool
  • 21. ROS2 URDF model
  • 22. ROS2 Gazebo simulation platform
  • 23. ROS2 TF2 coordinate transformation
08. Robot Chassis Control Course
  • 1. PID algorithm theory
  • 2. Robot information release
  • 3. Robot control
  • 4. Robot state estimation
  • 5. Robot calibration
  • 6. Robot trajectory tracking
  • 7. URDF Model
09. LiDAR Course
  • 1. Introduction and use of lidar
  • 2. Lidar obstacle avoidance
  • 3. Lidar tracking
  • 4. Lidar guard
  • 5. Lidar patrol
  • 6. gmapping mapping algorithm
  • 7. Cartographer mapping algorithm
  • 8. Navigation and obstacle avoidance
  • 9. App Mapping and Navigation
10. OpenCV Course
  • 1. Getting started with OpenCV
  • 2. OpenCV geometric transformation
  • 3. OpenCV Image Processing
  • 4. OpenCV image beautification
  • 5. QR code creation and recognition
11. Mipi Camera Course
  • 1. Camera driver
  • 2. Adjust the color HSV value
  • 3. Color recognition
  • 4. Color Tracking
  • 5. Color Follow
  • 6. QR code instructions
  • 7. Face Detection
  • 8. Object Detection
  • 9. Visual line patrol-OpenCV
  • 10. Visual line patrol-deep learning
  • 11. Human body tracking
  • 12. Gesture control
12. Depth Camera Course
  • 1. Use of Depth Camera
  • 2. Camera intrinsic calibration
  • 3. ROS+OpenCV Basics
  • 4. AR Vision
  • 5. Color Tracking
  • 6. Object Tracking
  • 7. RTAB-Map 3D Mapping Navigation
13. Multi-robot Synchronous Control
  • Multi-vehicle synchronous control
Remote login control
  • 1. VNC and SSH remote login
  • 2. Jupyter lab login and case code running
Download
  • System_File
  • Code
  • VM_File
  • Software_Tools
  • Hardware_Info
  • Firmware
  • Instruction_Manual
  • ROS2_Basic_VM
Download ZIP

Welcome to RDK X5 Robot repository

4. AR Vision

AR Vision

AR Vision4.1, AR Overview4.2, Program Function Description4.3, Program code reference path4.4, Program Startup4.4.1. Web page display4.4.2, rqt_image_view4.5, core source code analysis

4.1, AR Overview

Augmented Reality, referred to as "AR", is a technology that cleverly integrates virtual information with the real world. It widely uses a variety of technical means such as multimedia, three-dimensional modeling, real-time tracking and registration, intelligent interaction, and sensing. After simulating computer-generated text, images, three-dimensional models, music, videos and other virtual information, they are applied to the real world. The two types of information complement each other, thereby achieving "enhancement" of the real world.

The AR system has three outstanding characteristics: ① Information integration of the real world and the virtual world; ② Real-time interactivity; ③ Adding and positioning virtual objects in three-dimensional space.

Augmented reality technology includes new technologies and new means such as multimedia, three-dimensional modeling, real-time video display and control, multi-sensor fusion, real-time tracking and registration, and scene fusion.

4.2, Program Function Description

After the program is started, the Astra camera recognizes the chessboard and displays the AR effect, which can be visualized on the web page.

The operation of this function requires the camera's internal parameters, and the internal parameter file path is,

xxxxxxxxxx
/home/sunrise/yahboomcar_ws/src/yahboomcar_visual/astra.yaml

Internal parameter calibration can be quickly calibrated using a checkerboard grid. For specific methods, see the content in [Camera Internal Parameter Calibration] in [Depth Camera Series Course]. ** (This step has been completed in the system image)**

After completing the calibration work on the virtual machine side, move the generated [calibrationdata.tar.gz] file to the current directory and decompress it, open the [ost.yaml] file in the folder, and find the camera internal parameter matrix and distortion coefficient.

After remotely connecting to the car in VSCode, open the [/home/sunrise/yahboomcar_ws/src/yahboomcar_visual/astra.yaml] file and modify the following two [data] contents (if you are familiar with Linux commands, you can also directly switch to the file directory after connecting to the car through SSH in the terminal and use the vim tool to modify the file content),

xxxxxxxxxx
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [608.182089, 0. , 324.255471,
0. , 607.855617, 245.971079,
0. , 0. , 1. ]
distortion_model: plumb_bob
distortion_coefficients: !!opencv-matrix
rows: 1
cols: 5
dt: d
data: [0.100236, -0.073376, 0.004033, -0.001132, 0.000000]

There are 12 effects in this section,

xxxxxxxxxx
["Triangle", "Rectangle", "Parallelogram", "WindMill", "TableTennisTable", "Ball", "Arrow", "Knife", "Desk", "Bench", "Stickman", "ParallelBars"]

4.3, Program code reference path

After SSH connects to the car, the source code of this function is located at,

xxxxxxxxxx
#launch file
/home/sunrise/yahboomcar_ws/src/yahboomcar_visual/launch/ar_launch.xml

The node or launch file launched is explained as follows,

  • simple_AR: Generate AR effect, source code path is,

xxxxxxxxxx
/home/sunrise/yahboomcar_ws/src/yahboomcar_visual/yahboomcar_visual/simple_AR.py
  • rosbridge_websocket_launch.xml: Start websocket to realize the interaction between ROS and Web

  • rosboard_node: Start ROSboard

This program uses opencv to read camera image data, so the ROS node of Astra camera is not started.

4.4, Program Startup

After SSH connects to the car, input in the terminal: If the camera image capture fails, you can re-plug the depth camera or use the ls /dev/video* command to check whether the video0 device is recognized

xxxxxxxxxx
ros2 launch yahboomcar_visual ar_launch.xml

Use the following command to view the ros topic, input in the virtual machine terminal,

xxxxxxxxxx
ros2 topic list

image-20241114151017511

  • /Graphics_topic: The topic name of the effect, subscribe to the effect to be recognized.

  • /simpleAR/camera: The topic name of the image, publish the image.

4.4.1. Web page display

Open the browser on the PC (note that the computer and the Sunrise network must be in the same LAN), enter the URL: car IP:9999, for example, my car IP is 192.168.2.84, enter the URL in the browser on the virtual machine to open the ROSboard web page:

xxxxxxxxxx
192.168.2.84:9999

Select the /simpleAR/camera topic,

image-20241114151211177

The AR effect can be displayed.

image-20241114152831065

Press the [f] key on the page to switch between different effects.

image-20241114153055062

4.4.2, rqt_image_view

You can also use rqt_image_view to view the published images. Enter in the virtual machine terminal,

xxxxxxxxxx
ros2 run rqt_image_view rqt_image_view

image-20241114153409381

Select /simpleAR/camera in the upper left corner to view the image.

At this time, the effect cannot be switched by keyboard keys, but it can be modified by publishing topic data, for example, input in the virtual machine terminal,

xxxxxxxxxx
ros2 topic pub /Graphics_topic std_msgs/msg/String "data: Desk"

image-20241114153535966

At this time, the AR effect is changed to Desk.

4.5, core source code analysis

Some codes in simple_AR.py are as follows,

x
# Find the corner of each image
# Find the corner of each image
retval, corners = cv.findChessboardCorners(
gray, self.patternSize, None,
flags=cv.CALIB_CB_ADAPTIVE_THRESH + cv.CALIB_CB_NORMALIZE_IMAGE + cv.CALIB_CB_FAST_CHECK)
# Find corner subpixels
# Find corner subpixels
if retval:
corners = cv.cornerSubPix(
gray, corners, (11, 11), (-1, -1),
(cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001))
# Compute object pose
retval, rvec, tvec, inliers = cv.solvePnPRansac(
self.objectPoints, corners, self.cameraMatrix, self.distCoeffs)
# Output image points and Jacobian matrix
# Output image points and Jacobian matrix
image_Points, jacobian = cv.projectPoints(
self.axis, rvec, tvec, self.cameraMatrix, self.distCoeffs, )
img = self.draw(img, corners, image_Points)
# Publish image
# Publish image
self.pub_img.publish(self.bridge.cv2_to_imgmsg(img, "bgr8"))
ROS+OpenCV Basics
Color Tracking

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文