Skip to content

Path/Speed planning, and High-Level Control modules for Formula Student Driverless

License

Notifications You must be signed in to change notification settings

imhyeonwoo/Formula-Student-Driverless-Planning-Control

Repository files navigation

StudentMobilityCompetition-Planning-Control

This repository contains my personal work for the Planning & High-Level Control Team in the Student Mobility Competition (Team K.A.I., Konkuk University).

It implements a full ROS2 stack that plans global paths from GPS data, generates local paths from traffic cones, and tracks them using Pure Pursuit, enabling our custom-built EV to drive autonomously on cone-marked tracks.

YouTube Watch the Demo


πŸ“ Project Structure
Planning/
β”œβ”€β”€ cone_labeling_k/ # Potential Field-based Planning
β”‚   └── cone_labeling_k
β”‚       β”œβ”€β”€ launch
β”‚       β”‚   └── cone_labeling.launch.py
β”‚       β”œβ”€β”€ potential_field.py  # latest version(fixed several problems)
β”‚       └── potential_field.py.BAK  # old version
β”‚
β”œβ”€β”€ cones_no_color/ # Local path generation based on traffic cones
β”‚   β”œβ”€β”€ msg/  # custon msg that describes detected cones from Perception
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ cone_safe_zone.py
β”‚   β”‚   β”œβ”€β”€ reference_path_planning.py
β”‚   β”‚   └── visualize_cones.py
β”‚   └── launch/ …
β”‚
β”œβ”€β”€ gps_global_planner/ # Global path generation using GPSΒ·RTK
β”‚   β”œβ”€β”€ data/ # CSVs containing Longitude/Latitude, UTM Coordinates, Covariances
β”‚   β”œβ”€β”€ launch/
β”‚   β”‚   β”œβ”€β”€ gps_global_planner_launch.py
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ auto_place_cones.py
β”‚   β”‚   β”œβ”€β”€ cone_roi_publisher.py
β”‚   β”‚   β”œβ”€β”€ course_csv_creator.py
β”‚   β”‚   β”œβ”€β”€ global_yaw_estimator_node.py
β”‚   β”‚   └── publish_global_cones.py
β”‚   └── src/
β”‚       β”œβ”€β”€ gps_to_local_cartesian.cpp
β”‚       β”œβ”€β”€ local_cartesian_path_publisher.cpp
β”‚       β”œβ”€β”€ status_colored_path_publisher.cpp
β”‚       └── vehicle_tf_broadcaster.cpp
β”‚
β”œβ”€β”€ reference_path_classifier/ # Classifies Cones into Left and Rigth Sides(Using Global Path)
β”‚   β”œβ”€β”€ launch/
β”‚   β”‚   └── classify_cones_by_side.launch.py
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   └── classify_cones_by_side.py
β”‚   └── src/
β”‚       └── classify_cones_by_side.cpp
β”‚
β”œβ”€β”€ speed_planner/ # Calculates Desired Speed for Each Waypoints based on Curvature of the Path
β”‚   β”œβ”€β”€ launch/
β”‚   β”‚   └── simple_speed_planner.launch.py
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── simple_speed_planner.yaml
β”‚   └── src/  # Publishes speed and rpm command
β”‚       └── simple_speed_planner.cpp
β”‚
β”œβ”€β”€ pure_pursuit/ # Path Tracking Algorithm - 3 different versions
β”‚   β”œβ”€β”€ config/ # paremeter tuning files
β”‚   β”‚   β”œβ”€β”€ adaptive_pp.yaml
β”‚   β”‚   β”œβ”€β”€ pure_pursuit_dynamic.yaml
β”‚   β”‚   └── pure_pursuit_static.yaml
β”‚   β”œβ”€β”€ launch/
β”‚   β”‚   β”œβ”€β”€ adaptive_pure_pursuit.launch.py
β”‚   β”‚   β”œβ”€β”€ pure_pursuit_dynamic.launch.py
β”‚   β”‚   └── pure_pursuit_static.launch.py
β”‚   └── src/  # 3 different methods nodes
β”‚       β”œβ”€β”€ pure_pursuit_adaptive.cpp
β”‚       β”œβ”€β”€ pure_pursuit_dynamic.cpp
β”‚       └── pure_pursuit_static.cpp
β”‚
β”” How To Play.md # Contains How to Run My Packages

Ideal rqt graph Planning rqt graph

Flow Summary (Concise):

  • Cone perception β†’ Local path: /cone/* β†’ /cones_color_subscriber β†’ /local_planned_path, /cones_marker_array (RViz shows /cones/markers).
  • AEB decision: /cones_color_subscriber β†’ /AEB_Determination_Node β†’ /aeb_roi, /aeb.
  • Curvature/Speed planning: /local_planned_path β†’ /path_sampler β†’ /sp/rep_curvature β†’ /speed_zone_planner β†’ /cmd/speed, /cmd/rpm.
  • Path tracking control: /pure_pursuit_adaptive ⟡ /local_planned_path, /current_speed β†’ /cmd/steer (+ /pure_pursuit/* debug topics).
  • HUD/Visualization: /hud_overlay_node ⟡ /cmd/, /odometry/filtered, /pure_pursuit/ β†’ /hud/overlay_text, /hud/aeb_overlay, /current_kmh; /car_marker_publisher ⟡ /cmd/steer β†’ /car_marker.

Key Features

Package Main Functions Language
cones_no_color β€’ Generates an optimal reference path from cone locations
β€’ Provides RViz visualization nodes
Python
gps_global_planner β€’ Converts RTK-GPS logs to CSV and nav_msgs/Path
β€’ ENU ↔ Local Cartesian conversion
β€’ Colors the global path by state and speed
C++, Python
reference_path_classifier β€’ Classifies cones on the left and right sides relative to the vehicle Python
pure_pursuit β€’ Tracks the local path via Pure Pursuit (static/dynamic/adaptive look-ahead)
β€’ Subscribes nav_msgs/Path (/local_planned_path) and /current_speed; publishes /cmd/steer and RViz debug markers
C++

Usage

  • Refer to How To Play.md

Build (ROS2 Humble)

cd [workspace path]
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
source install/setup.bash
  • Use --symlink-install for immediate reflection of source code changes in the install directory.
  • Use -DCMAKE_BUILD_TYPE=Release for optimized execution performance.

Example Execution

# 1) Generate and publish the GPS-based global path
ros2 launch gps_global_planner gps_global_planner_launch.py

# 2) Classify left-right cones using Global Planned Path
ros2 launch reference_path_classifier classify_cones_by_side.launch.py

# 3) Generate a local path based on detected cones
ros2 run cones_no_color reference_path_planning.py

# 4) Generate and publish the desired speed and RPM based on curvature of the path
ros2 launch speed_planner simple_speed_planner.launch.py

# 5) Track the local path using (Adaptive) Pure Pursuit Algorithm
ros2 launch pure_pursuit adaptive_pure_pursuit.launch.py

Demo Video (Main)


1. Right/Left Classification (Frenet + K-D Tree)

2. Delaunay Triangulation

3. Local Speed Planning

4. Path Tracking (Pure Pursuit)
πŸ“ View More (4 Additional Steps)

5. Global Path Planning

6. Global Cones and ROI (Sim)

7. Interpolation & Sampling

8. Obstacle Radius & Safe Zone

Several Attempts for Better Planning and Tracking


Adaptive Pure Pursuit

This GIF visualizes the Adaptive Pure Pursuit algorithm, based on the paper β€œAccurate Path Tracking by Adjusting Look-Ahead Point”. The look-ahead distance dynamically adjusts depending on vehicle speed and path curvature, enabling more accurate and stable path tracking compared to standard Pure Pursuit.

  • Pink Marker: Look-Ahead Point of Adaptive Pure Pursuit
  • Orange Arrow: Vehicle Heading Direction based on Adaptive Pure Pursuit

In curves, the look-ahead distance is reduced to minimize path deviation, while on straights it is increased for smoother tracking, improving trajectory stability under diverse driving conditions.



Potential Field-Based Local Path Planning

This GIF demonstrates local path planning using a Potential Field method. The algorithm generates a field around all detected cones and identifies the lowest "trough" line as the optimal drivable path, marking these as Through Points (mandatory waypoints the path must pass through). The selected points are then refined with Centripetal Catmull–Rom Spline Interpolation to generate a smooth and continuous local path relative to the vehicle's base_link frame.

  • Colored Grid: Potential field intensity map
  • Yellow Dots: Trough Points before smoothing
  • Pink Line: Final smoothed local path
  • Blue / Yellow Spheres: Left and Right cones respectively


Greedy Graph-Guided Local Path Planning

This GIF demonstrates local path planning using a Greedy, graph-guided centerline search. The pipeline reconstructs left/right boundary lines from color-labeled cones, generates robust midpoints (Hungarian / projection / resample-align), and then selects a forward-feasible center path on a radius graph by minimizing distance with boundary, directional, and smoothness penalties under heading-change gates. The result is resampled and anchored to the vehicle's base_link frame, then published as nav_msgs/Path.

  • Left/Right Lines: Reconstructed track boundaries from cones
  • Green Dots: Midpoints between boundaries
  • Green Line: Final fixed-length local center path
  • Blue / Yellow Spheres: Left and Right cones respectively

ROS Bag Files (Download)

You can reproduce the reference pipeline immediately using the sample bag files below (Google Drive):


Development Environment

Item Version / Tool
OS Ubuntu 22.04
ROS ROS2 Humble
GPS RTK Module ZED-F9P-04B-01
IMU Module myAHRS+
Languages Python 3.10 / C++17
Localization Stack ros2-gnss-imu-fusion

References


Contributions & Contact

About

Path/Speed planning, and High-Level Control modules for Formula Student Driverless

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published