Safe Lane Following on the GEM ev4
Lane following with stop sign and obstacle detection on a full-scale electric vehicle
Team GEMstones · ECE 484 Principles of Safe Autonomy, Fall 2026 · University of Illinois Urbana-Champaign
Abstract
We are building an autonomy stack for the Polaris GEM ev4, a full-scale electric vehicle, that drives a closed track from start to goal without leaving the drivable region. A front camera detects the lane and estimates where the car sits within it, while GNSS localization tracks progress along a set of waypoints we recorded on the track. The same camera feeds a learned detector that recognizes stop signs, and the LiDAR checks the lane corridor ahead for obstacles. A behavior state machine combines these signals: the car brakes to a full stop for a sign or an obstacle, resumes on its own once the path is clear, and comes to rest within 2 m of the goal. A lateral path tracker and a speed controller turn those decisions into steering, throttle, and brake commands. The stack is now running on the GEM ev4 itself: with lane detection active, the car has driven the track’s straights and taken a turn, and the same code completes full laps in simulation.
Objectives
1
Detect the drivable region (lane following)
2
Generate waypoints to the destination
3
Stay in the drivable region for the entire journey
4
Stop completely and automatically for an obstacle or stop sign
5
Resume automatically once the obstacle is removed
6
Stop within 2 m of the goal
Approach
The stack is split into perception, decision, and control, with each module running as a ROS node so we can develop and replay it against recorded bags before it touches the car.
Lane detection
Threshold the camera image on color and gradient, warp it to a bird’s-eye view, and fit the lane lines with a sliding-window polynomial. The output is the lane center and the car’s lateral offset and heading error relative to it.
Stop sign detection
Run a COCO-pretrained YOLO11n detector on the front camera, which already includes a stop sign class. Range comes from the box height through a pinhole model, using the sign’s known size. We calibrate it by placing the sign at measured distances on the track, and cross-check it with LiDAR points that project into the box.
Obstacle detection
Crop the LiDAR point cloud to a corridor along the lane ahead of the car, remove ground points, and cluster what is left. Any cluster inside the corridor within the stopping distance is treated as an obstacle.
Waypoints and localization
We drove the track and recorded GNSS waypoints. At runtime, GNSS/INS gives the car’s pose, which we use for route progress, distance to the goal, and as the fallback path when lane detection is not confident.
Behavior
A state machine with DRIVE, STOP SIGN HOLD, OBSTACLE HOLD, and GOAL REACHED states. It holds at a stop sign for a fixed time, waits at an obstacle until the corridor is clear, and commands a stop once the car is within 2 m of the goal.
Control
Pure Pursuit (with Stanley as a comparison) tracks the reference path for steering, and a PID loop tracks the target speed through throttle and brake. Speed decelerates on a set profile into each stop rather than braking hard.
Which path does the controller track?
The camera lane center is the primary reference, since staying in the drivable region is the core requirement, and GNSS drift alone can be enough to push the car toward a lane edge. The lane polynomial is sampled into look-ahead points in the vehicle frame, and Pure Pursuit tracks those. The recorded GNSS waypoints set the route and the goal, and take over as the steering reference only when lane confidence drops (too few lane pixels, or a fit that jumps between frames). If the two references disagree by more than a set threshold, the car slows down and logs the event instead of picking one silently. Switching between them is blended over a short window so the steering command doesn’t jump.
Sensors and inputs
| Input | Used for |
|---|---|
| Front camera | Lane detection, stop sign detection |
| LiDAR | Obstacle detection in the lane corridor |
| GNSS / INS | Vehicle pose, waypoint tracking, distance to goal |
| Recorded waypoints | Route from start to goal |
| Vehicle speed feedback | Speed control |
Safety
| Failure | Detection | Response |
|---|---|---|
| Sensor stops publishing | Watchdog on each topic’s message age | Controlled stop until data returns |
| Lane lost | Low lane-pixel count or unstable fit for several frames | Slow down, follow GNSS waypoints, stop if it persists |
| GNSS degraded | Fix quality and covariance from the receiver | Track lane only at reduced speed; no goal stop until the fix recovers |
| Lane and GNSS disagree | Offset between the two references over a threshold | Slow down and log |
| Unsafe commands | Bounds on steering angle, steering rate, and acceleration | Commands are clamped before they reach the vehicle |
| Anything unexpected | Safety driver | Driver takeover or the vehicle’s emergency stop, which overrides software at all times |
All testing runs at a capped low speed with a safety driver in the seat, and new code is replayed on recorded bags before it runs on the vehicle.
Evaluation
Every run is recorded as a ROS bag so the metrics below are computed the same way offline. Targets are for low-speed track runs (up to about 5 mph), counted over 10 trials each, and will be tightened once we have baseline numbers.
| Area | Metric | Target | How we measure it |
|---|---|---|---|
| Lane tracking | RMS cross-track error | ≤ 0.25 m | Lateral offset from the lane center over a full run |
| Lane tracking | Max lane deviation | ≤ 0.5 m, never leaving the lane | Same, worst case per run |
| Speed control | RMS speed error | ≤ 0.3 m/s | Commanded vs measured speed |
| Speed control | Overshoot on a speed step | ≤ 10% | Step from stop to cruise speed |
| Stopping | Full stop for sign and obstacle | 10 / 10 trials | Speed reaches zero before the stop point |
| Stopping | Overshoot past the stop point | ≤ 0.5 m | Pose at rest vs the stop line or obstacle |
| Resume | Time to resume after obstacle removed | ≤ 3 s | Corridor clear to speed above zero |
| Goal | Final distance to goal | < 2 m in 10 / 10 (aim < 1 m) | GNSS pose at rest vs goal waypoint |
| Stop sign detection | Precision and recall within 15 m | ≥ 95% each | Labeled frames from bags |
| Stop sign detection | Range error | ≤ 10% of true distance | Sign placed at measured distances |
| Obstacle detection | Detection before stopping distance | 10 / 10 staged obstacles | Obstacles at known positions |
| Obstacle detection | False stops | 0 per full run | Runs with a clear corridor |
| Controller comparison | Pure Pursuit vs Stanley | Report all lane tracking metrics | Same track and speed, 10 runs each |
| Robustness | Cross-track error with localization noise | ≤ 0.4 m RMS | Noise added to pose in bag replay |
Preliminary Work
We have started working on the GEM ev4 itself. In the first clip we drive the track while recording ROS bags from the camera, LiDAR, and GNSS, which gives us real data to develop lane and obstacle detection against. Along the same drive we recorded the waypoints that define the route to the goal. The second clip shows our first simulation setup.
Data collection on the GEM ev4 (4x speed)
Simulation (4x speed)
Current Work Done
Since the pitch we have taken the stack from simulation onto the GEM ev4. The ROS bags and the RTK route from our data collection drive gave us the car’s calibration (camera tilt, sensor positions, wheelbase, and lane width), and the same code that runs in simulation now runs on the vehicle. In the clips below, lane detection is running on the car’s front camera while it drives: it holds the lane down the straight and follows the curve through a turn.
Before each car session we test changes in two simulators. Our own track simulator runs the full stack around the track layout, with a stop sign, a pedestrian, and the goal placed on the route, and reports the lane offset and heading error frame by frame. The Gazebo simulation of the track checks the same nodes against a physics model. What remains is showing the stop sign, pedestrian, and obstacle stops live on the car, then full runs from start to goal.
| Item | Status |
|---|---|
| ROS bags and RTK route from the track | Done |
| Car calibration from recorded data | Done |
| Lane detection on the car | Working on straights and turns |
| Full laps in our track simulator | Working |
| Gazebo simulation of the track | Running |
| Stop sign, pedestrian, and obstacle stops on the car | In progress |
| Full start to goal runs on the car | Next |
On the GEM ev4
Taking a turn with lane detection running
Holding the lane on the straight
In-car view with a pedestrian ahead
In simulation
Full lap in our track simulator: top-down route on the left, camera view with detected lane lines on the right (sim time sped up 4x)
Following the track in Gazebo (4x speed)
Car clips play at real speed; the Gazebo clip plays at 4x.
Team and Task Allocation
Hridik Hingorani
Dynamics, Controls and Testing
Akanksh Saxena
Decision and Path Planning
Karm Desai
Sensors, GNSS and Safety (Primary driver)
Fernando Lopez Espinoza
Perception
Plan
| When | Milestone | Completed when |
|---|---|---|
| Early Oct | Sensor data and track waypoints collected | Bags with camera, LiDAR, and GNSS covering the full route |
| Oct 20 / 22 | Project pitch | Approach, plan, and roles presented |
| Late Oct | Lane and stop sign detection on bags | Lane fit holds through the whole recorded route; stop sign range calibrated at measured distances |
| Early Nov | Controller and behavior on the vehicle | Lane following at low speed with logged cross-track error; state machine stops on command |
| Mid-point check-in | Stopping behavior integrated | Repeated full stops at the stop sign and a staged obstacle, resuming on its own |
| Late Nov | Full runs and tuning | Start to goal runs ending under 2 m from goal; Pure Pursuit vs Stanley compared |
| Dec 11 | Final presentation | All objectives shown on video with metrics |
BibTeX
@misc{gemstones2026,
author = {Hingorani, Hridik and Saxena, Akanksh and
Desai, Karm and Lopez Espinoza, Fernando},
title = {Safe Lane Following on the GEM ev4},
note = {ECE 484 Final Project, University of Illinois Urbana-Champaign},
year = {2026},
}