Skip to content
University of California, Davis Mechanical and Aerospace Engineering
ARMS Laboratory
EME154 · Interactive Lab

Follow the command. Finish the move.

A sampled position controller sends velocity commands to an inner drive.

Paused.

Position versus time

Following error

Build the velocity command

P = Kp e · I = Ki Σ(e Δt) · D = Kd (eᵢ − eᵢ₋₁)/Δt. Each contribution has units of mm/s.

Model assumptions

Xr is a constant-speed ramp capped at the endpoint. The controller computes e = Xr − Xc and outputs velocity, not force. With ideal velocity tracking and stable, unsaturated P control, constant-speed following error approaches speed/Kp. When the reference stops, P error decays toward zero.

Switch only after XGO = 0 and |e| < INPX. The gain-only option uses Kp_inpsn = 0. A finite drive lag can cause coasting after switching and movement outside tolerance. “In position” records the latched event, not a guarantee of remaining in the band.

This draft uses explicit current-reference indexing. The equivalent error update is eᵢ = eᵢ₋₁ + ΔXrᵢ − ΔXcᵢ. The next reference increment can equivalently be prepared at the end of the previous interrupt.

Between interrupts the command is held constant. The inner drive follows τ dv/dt + v = VELX, with exact interval propagation; τ = 0 gives ideal velocity tracking. Sampling is uniform. The encoder is ideal, with no quantization, counter wrap, noise, or delay. There is no simulated CPU execution time or jitter.

The derivative acts on error and is unfiltered. Integration uses the current error and conditional anti-windup at the velocity limit. Saturation, derivative transients, large gains, and long sample intervals can change behavior. These illustrative values are not tuned equipment settings. Runs include five seconds after the reference reaches its endpoint; settling is not guaranteed in that window.