Racing Line Follower
The Visual Line Tracking Demo implements the movement of the racing car within the track based on a purely visual method, with guiding lines in the middle of the track assisting the car to stay within the track.
🧩 System Overview
To achieve the above function, three main modules are needed:
- Visual Input
- Environment Perception
- Motion Control
These modules interact as follows:
- The Visual Input module obtains images of the real world (or simulated world) and passes them to the environment perception module.
- The Environment Perception module analyzes the position of the racing car on the track and sends relevant information to the motion control module.
- The Motion Control module calculates motion control commands based on the car’s position and sends them to the chassis for execution.
⚙️ Implementation Using NodeHub
NodeHub is the Intelligent Robot Application Center provided by Horizon for robot developers.
It contains open-source Nodes with various functions that can be quickly installed and used.
By connecting different Nodes, the implementation of the above three modules can be completed.
1. Visual Input
In the Peripheral Adaptation section of NodeHub, various sensors and robot chassis adaptations are available to easily acquire image and point cloud data.
Here, select MIPI Camera Driver to implement the visual input module.
📷 Why MIPI Camera Driver?
- Supports the GC4663 wide-angle camera, providing a larger field of view beneficial for line tracking.
- Supports multiple resolutions: 1920×1080, 640×480.
- Publishes topics:
/hbmem_image/image_raw/camera_info
📂 Recommended Configuration
Use the following launch file for balanced performance: Publishes 640×480 NV12 images via shared memory.
▶️ Installation & Launch
sudo apt update
sudo apt install -y tros-mipi-cam
source /opt/tros/setup.bash
ros2 launch mipi_cam mipi_cam_640x480_nv12_hbmem.launch.py
sudo apt update
sudo apt install -y tros-racing-track-detection-resnet
source /opt/tros/setup.bash
ros2 launch racing_track_detection_resnet racing_track_detection_resnet.launch.py
sudo apt update
sudo apt install -y tros-racing-control
source /opt/tros/local_setup.bash
ros2 launch racing_control racing_control.launch.py \
avoid_angular_ratio:=0.2 \
avoid_linear_speed:=0.1 \
follow_angular_ratio:=-1.0 \
follow_linear_speed:=0.1
sudo apt update
sudo apt install -y tros-originbot-base tros-serial tros-originbot-msgs
source /opt/tros/setup.bash
ros2 launch originbot_base robot.launch.py
MIPI Camera Driver → Track Detection → Car Line Following Control → Chassis Driver
│ │ │ │
(Images) (Track Center) (Velocity Cmds) (Motor Control)