Robotics · control
A gantry that missed its deadlines
A two-axis gantry kept arriving late to trajectory goals, and its path bent into an L.
- trajectory controller
- hardware interface
- firmware
- steppers
1/f
every setpoint in one control period
- ros2_control
- Joint Trajectory Controller
- C++
- Arduino
- Stepper motors
Problem
A stepper-driven gantry with asymmetric X and Y axes was controlled through ros2_control's Joint Trajectory Controller. Goals arrived late, and the two axes did not finish together, so the tool traced an L instead of a straight line.
Investigation
The Joint Trajectory Controller interpolates each goal into setpoints at the controller frequency, each meant to be reached within one control period. The microcontroller firmware did not execute each setpoint within that period, so timing error accumulated along the trajectory. A per-axis step-delay scaling, added earlier to make the shorter axis wait for the longer one, compounded the error instead of fixing it.
Root cause
The firmware did not finish each setpoint within one control period, so timing error accumulated; step-delay scaling made it worse.
Fix
Moved step timing into the microcontroller so every setpoint executes in exactly one control period, and dropped the scaling.
Outcome
Both axes reach every setpoint on schedule, so goals arrive on time and the tool moves in a straight line.
- → Accumulating timing error eliminated by per-period setpoint execution
- → Axis synchronisation without speed-scaling workarounds