A lane detection → path generation → Pure-Pursuit control pipeline based on ROS Noetic.
This repository contains the code and demo for the 3rd Autonomous Driving Software Competition(제3회 미래형자동차 자율주행 SW 경진대회) during the 2024 summer vacation at Konkuk University.
(Includes offline verification scripts using Matplotlib.)
## Project Structure
lane_follower_ws/
├── src/
│ └── lane_follower/
│ ├── launch/ # 3-node launch file
│ │ └── lane_follower.launch
│ ├── scripts/ # Python nodes
│ │ ├── lane_detector.py # ① BEV + lane data extraction
│ │ ├── path_planner.py # ② Path and look-ahead point calculation
│ │ └── pure_pursuit_ctrl.py # ③ Steering and throttle output
│ ├── CMakeLists.txt
│ └── package.xml
└── demo/
└── lane_demo_offline.py # Matplotlib demo (no ROS required)
lane_demo_offline.pyreads a video file and performs real-time visualization of the lane, path, look-ahead point, and steering angle without ROS.
- Bird's-eye view transformation & HLS color masking
- Removes circular objects (traffic lights, signs, flower markers)
- Uses histogram + sliding window to detect left/right lane pixels
- Publishes left (1st-order) / right (3rd-order) poly-fit coefficients on
/lane/*_fittopics - Publishes BEV & debug images on
/car/*_imagetopics
- Calculates the vehicle center path function
P(x)based on the right lane - Computes target coordinates at look-ahead distance
x_la(default 0.85 m) - Publishes
/path/lookahead_point - For efficiency, sets
x_ldinstead of ld in the Pure-Pursuit node and usesP'(x_ld)during calculation
- Calculates steering angle based on the look-ahead point
- Publishes throttle (fixed at 0.8 to observe lateral motion clearly)
- Uses
/car/steeringand/car/throttletopics
demo/lane_demo_offline.py- Reads a video → displays BEV, lane, path, and look-ahead point in a matplotlib figure in real-time
- Prints Pure-Pursuit steering angles to the console → algorithm verification without ROS
The following describes the process of calculating the steering angle from the look-ahead point in Pure Pursuit.
이후 이 점을 사용하여 Pure Pursuit 공식을 재정의하였다.
- Accordingly, in sections with high curvature, y_la decreases while x_la remains constant, resulting in a shorter look-ahead distance.
- This enables the successful implementation of a dynamic look-ahead distance that adjusts according to the curvature of the road.
The target path is shifted based on the slope of the detected lane function and its normal vector to align with the vehicle's centerline.
Transcribed Content: 오른쪽 차선함수(Right Lane Polynomial)를
이에 따라
cd ~/workspace/lane_follower_ws
catkin_make -DCMAKE_BUILD_TYPE=Release
source devel/setup.bash- catkin_make -DCMAKE_BUILD_TYPE=Release builds the project with optimization enabled for better runtime performance and reflects source code changes immediately.
# Full 3-node pipeline
roslaunch lane_follower lane_follower.launch
# Test individual nodes
rosrun lane_follower lane_detector.py # Camera → Lane detection
rosrun lane_follower path_planner.py # Lane → Path generation
rosrun lane_follower pure_pursuit_ctrl.py # Path → Control
# Offline Matplotlib demo (requires video file)
python3 demo/lane_demo_offline.py --video trackrecord4_2x.mp4This GIF visualizes the Lane Detection–Path Generation–Pure Pursuit Control Pipeline. The pipeline integrates sliding window–based lane detection, polynomial path fitting, and Pure Pursuit steering control to demonstrate end-to-end autonomous path tracking.
- Blue/Red Dots: Detected left/right lane points using the Sliding Window method
- Blue/Red Curves: Polynomial-fitted lane boundaries
- Yellow Curve: Vehicle center path function P(x)
- Green Circle: Look-ahead point (xla = 0.85 m, yla = P(xla))
- Console Log: Real-time steering angle output (°)
CLICK THE IMAGE above to watch the driving demo on YouTube.
This video shows the real vehicle developed and driven by our team
during the 3rd Autonomous Driving Software Competition (2024).
| Item | Version/Tool |
|---|---|
| OS | Ubuntu 20.04 LTS |
| ROS | ROS1 Noetic |
| Programming Lang | Python 3.8 / C++14 |
| Libraries | OpenCV 4.9, NumPy, Matplotlib |

