Autonomous systems · ROS 2 · Team leadership
Cardiff Autonomous Racing
As a founding member of Cardiff University's autonomous racing team, I led the path-planning team and was responsible for the path-planning module: the ROS 2 node that turns cone detections into the racing line the car follows at Silverstone.
- Python
- ROS 2 Humble
- Trajectory optimisation
- SciPy
- Tkinter & Matplotlib
- Git
5 images: use the arrows or scroll sideways.
My role
I led a team of 8 engineers alongside my degree: running regular meetings, managing workloads, and keeping our work aligned with the other sub-teams and the competition timeline. I also set up simulators and documentation so new members could develop without the car, contributed to the technical documents required to compete at Silverstone, and helped establish the team's structure and processes as a founding member.
All of my development on the module was in Python.
Where it fits
The module is a ROS 2 Humble node, path_planner. It subscribes to SLAM odometry and YOLO
cone detections from the perception stack, pairs the two streams by approximate timestamp (0.5 s
tolerance), and publishes a nav_msgs/Path for the control team at 5 Hz.
How it works
- Sort the cones. Blue cones become the left boundary and yellow the right. Orange cones are kept for later use, and unknown or invalid labels are dropped.
- Quick centreline (fallback). Each blue cone is paired with the yellow cone closest to it along the x-axis and the path runs through the midpoints. If only one side is visible, the path is offset 1.5 m from it.
- Build a reference track. Once at least 5 cones are visible on each side, each side is ordered by stepping to the nearest unvisited cone from the car, which copes with hairpins where sorting by position doesn't. Cones are paired across the track by their place in each chain, pairs more than 12 m from their midpoint are rejected as mis-pairings, and the result is converted to TUM's
[x, y, w_right, w_left]track format. - Optimise the racing line. Using TUM's
trajectory_planning_helpers, the track is smoothed and resampled, then solved for minimum curvature (a quadratic program with a 0.4 m−1 curvature limit), with shortest path as an alternative. The line is shifted along the track normals and splined to give heading, curvature and velocity for every point. - SciPy fallback. Without the TUM library, a lightly smoothed B-spline is fitted through the centreline, closed loops are detected, and any point outside the track is pushed back inside with half the car's width as clearance. The nearest-segment search stays local so figure-8 layouts don't confuse it, and target speed falls linearly with curvature from 15 m/s to 3 m/s.
- Publish. The optimised line is published when available, otherwise the simple centreline.
Tooling
- Path Planning Tester, a Tkinter/Matplotlib GUI for placing cones or loading scenarios (straight, curves, chicane, hairpin, oval, figure-8, slalom), running either optimiser, inspecting statistics and optionally publishing to ROS.
- A smoke test for the TUM integration.
- An earlier RRT* planner, since retired in favour of the optimisation approach. My public RRT simulator comes from that line of work.
Testing & results
I ran the SciPy fallback against the four scripted test scenarios:
| Scenario | Result | Notes |
|---|---|---|
| Straight track | Pass | 42.0 m path matching the 42.0 m centreline, zero curvature, solved in 8 ms. |
| Chicane | Partial | Ran, but the line oscillates: an 87.7 m path against a 49.2 m centreline, taking 4.5 s. |
| Hairpin | Fail | Spline fit rejected the input (splprep: invalid inputs). |
| Complex circuit | Fail | Same spline error. |
I traced both failures to duplicate cones in the scenario files. They create zero-length steps in the reference track, which the spline fit rejects, and nothing upstream removes them. None of the scenarios form a closed loop either, so the closed-loop handling still needs a dedicated test.
What I'd improve next
- De-duplicate cones before chaining, which fixes the hairpin and circuit failures.
- Have the ROS node fall back to the SciPy optimiser when TUM isn't installed, instead of dropping straight to the midpoint centreline.
- Pass the car's position into the optimiser so cone chaining starts from the nearest cone, as it already does in the GUI.
- Base the speed profile on vehicle dynamics rather than a placeholder or linear rule, and set a heading on each published pose.
- Cache or rate-limit optimisation instead of re-solving on every cone message, and bring the module README up to date.
The team's code lives in a private university repository. I'm happy to walk through the module in detail in an interview.