ONGOING · NXP CUP COMPETITION

NXP CupRacing Car

A fully autonomous line-following race car on an automotive-grade S32K144, with computer-vision track detection via a Pixy2 camera, dual PID loops for independent cruise control and steering, and BLDC motor control, built in S32 Design Studio with register-level C/C++.

THE GOAL

Built for the NXP Cup competition: a car that reads the track with its own onboard camera and drives itself around it, with no remote control and no human in the loop.

  • Pixy2 camera vision feeds dual PID loops: one for cruise, one for steering
  • BLDC motor control and CAN bus communication between modules
  • ROS 2 / Gazebo simulation for testing control software before touching the real car
  • ESP32-C3 + MPU6050 telemetry streamed to a FastAPI server for live trajectory plots
NXP Cup autonomous line-following race car on the competition track

PHOTO — CAR ON TRACK

The car connected to a laptop for flashing and debugging, sitting on the taped-out practice track ahead of a run. The black tape lines are exactly what the Pixy2 camera is trained to follow.

HOW IT WORKS

A Pixy2 camera feeds track position to two independent PID loops running at register level on the automotive-grade S32K144 (one holding cruise speed, one handling steering), which drive the car's BLDC motors. Modules communicate over CAN bus, all written in register-level C/C++ in S32 Design Studio.

TRACK RUN

A run on the practice track: the car reading the line and correcting steering on its own, no remote control involved.

CURRENTLY EXPLORING

I'm exploring RTOS task scheduling for deterministic real-time sensor fusion, instead of a simple polling loop. A full ROS 2 / Gazebo simulation lets me test control software before touching the real car, alongside an ESP32-C3 + MPU6050 telemetry link that streams motion data to a FastAPI server for live trajectory plots while testing.

ROS 2 and Gazebo simulation of the NXP Cup car's control software

GAZEBO SIM

The Gazebo simulation replaying a run, terminal output on the left. The same control software driving the real car, tested here first against a simulated track.

Recorded runs get replayed through a small analysis tool built for reviewing them after the fact: trajectory against the taped track, a handling classifier that flags oversteer/understeer against the intended line, and every raw channel broken out over time.

Recorded NXP Cup car trajectory overlaid on the practice track centerline, colored by speed and accelerometer reading

TRAJECTORY REPLAY

A full lap replayed against the track centerline. The blue line is speed, the pink line is accelerometer reading, both color-coded along the path so you can see exactly where the car sped up, braked, or leaned into a turn.
Handling analysis plot classifying the NXP Cup car's cornering as oversteer, understeer, or normal across a run

HANDLING ANALYSIS

The measured yaw rate against the Ackermann-predicted ideal, with a classifier underneath flagging oversteer (red) and understeer (orange) against the intended line. This run came back 88% normal tracking.
Time-series breakdown of the NXP Cup car's raw sensor channels across a full run: yaw, speed, motor RPM, lateral G, and temperature

RAW CHANNELS

Every channel the ESP32-C3 telemetry link streams, stacked over the same run (yaw, speed, motor RPM, lateral G, and onboard temperature), for tracing a handling issue back to the sensor data that caused it.

TELEMETRY — LIVE STEERING TRACE

MCUNXP S32K144
VISIONPIXY2 CAMERA
CONTROLDUAL PID · BLDC + STEERING
BUSCAN
SIMROS 2 / GAZEBO
TELEMETRYESP32-C3 + MPU6050 → FASTAPI