Concept Car — autonomous driving function private repo
Two-wheeled electric vehicle that drives a closed course untethered. Plant model and control law developed in Simulink, sequencing as a Stateflow chart, deployed as generated embedded C on a SAMD21.
Motor characterised by measured sweep, dead band included, rather than datasheet values
Route as a state machine with relative targets, so one four-state cycle closes any polygon
Verification retrofitted as CI: static analysis plus a requirements traceability gate
Simulink
Stateflow
MATLAB
Embedded C
PID
Jenkins
The route is a state machine, not a script. A Stateflow chart issues velocity and rotation commands, waits on guards computed from encoder feedback, and advances — read directly out of the model, not redrawn from memory. Verification is the same idea applied to testing: three stages, each removing one simulation, so a failure stays attributable to a layer.
square-course loop — chart, action language, and resulting pathanimated — one lap, 12 s
State names, entry and during actions, and guard conditions are read directly out of the Simulink model. The car is stationary during the pauses and rotates in place during the turn — v = 0 in both.
MiL → PiL → run-on-boardanimated — 9 s
The value of the ladder is diagnostic: behaviour that survives the first two stages and fails on the third is a physical-world problem, not a control-law problem. On this build: model and processor stages passed; the untethered run left the course, a wheel-encoder dead-reckoning limit rather than a controls failure.