A lawnmower coverage controller rebuilt from coupled PD into a TURN and DRIVE state machine. Proof that control structure, not gain tuning, was the fix.
TYPE
Simulation · ROS 2 Jazzy + Turtlesim
RESULT
Avg cross-track error 0.760 to 0.027
THE FIX
Structure, not gain tuning
The final trajectory: eleven straight, evenly spaced rows over all 22 waypoints.Cross-track error held under 0.1 units for the entire run, against a 0.5 requirement.Velocity profiles showing the TURN and DRIVE decoupling: zero linear velocity while turning, zero angular drift on straights.
Overview
The provided coupled PD controller drew spirals: 0.76 average cross-track error no matter the gains. The diagnosis was structural, so the fix was structural: a TURN and DRIVE state machine that rotates in place before every segment and never steers while turning.
Design & Build
Controller: A finite state machine alternating pure rotation and pure translation, with signed cross-track error computed by vector projection with numerical guards.
Waypoints: The generator was rewritten to produce orthogonal rows with vertical step downs at the edges instead of diagonal transitions.
Instrumentation: A custom ROS 2 performance metrics message, the assignment's extra credit item.
Challenges
Recognizing that no amount of PD tuning fixes a controller that couples heading and translation through every segment change.
Result
Average cross-track error cut 96.5 percent, from 0.760 to 0.027 units, maximum from about 2.0 to 0.10, across all 22 waypoints.