ProjekinAja. Robotics Stage 3 · Dynamics Control Lesson 3.3
● Stage 3 · Lesson 3.3

Actuator Models and the Sim-to-Real Dynamics Gap

The equation of motion assumes ideal actuators — real motors saturate, have backlash, and respond to voltage not torque; ignoring this produces controllers that work in simulation and oscillate in hardware.

⏱ ~22 min read ⚙ Actuator physics 🚨 Failure-mode critical

🎯 By the end you'll understand

The DC motor electrical and mechanical model — from voltage to current to torque to shaft speed. How gear ratios transform both torque and inertia (and why the inertia scaling is the surprising part). Torque saturation as the most common unmodelled nonlinearity in robot controllers. Gear backlash, joint compliance, and Coulomb friction as the next tier of unmodelled effects. Why simulation uses ideal actuators and what that costs you in hardware. And why integrator windup during actuator saturation is not optional to address — it is the mechanism behind most first-deployment controller failures.

KEY INSIGHTThe equation of motion does not include a motor

The Lagrangian gives you τ = M(q)q̈ + C(q,q̇)q̇ + g(q). Nowhere in that equation does it say "and the motor saturates at 2.4 N·m." That missing constraint is responsible for more failed hardware deployments than any control algorithm bug.

Stages 3.1 and 3.2 derived the equation of motion for a rigid-body system from first principles. That derivation is exact — for a perfectly rigid body driven by a perfectly ideal force source that delivers any torque requested, instantaneously, without limit. Real actuators are none of those things. A brushless DC motor responds to a voltage command, not a torque command. It saturates. It has a first-order electrical lag. When you put a gearbox on it, the reflected inertia changes, sometimes dramatically. When you run a PID controller that commands torques the motor cannot deliver, the integrator keeps accumulating error — and when the saturation ends, that accumulated error drives an overshoot that can destabilize the system.

🔑 The sim-to-real gap in one sentence

Simulation assumes the actuator delivers exactly what the controller requests. Hardware does not. Every mechanism by which hardware diverges from that assumption — saturation, lag, backlash, friction, reflected inertia — is a component of the sim-to-real dynamics gap. Closing this gap requires modelling the actuator explicitly, not hoping the controller is robust enough to absorb the discrepancy.

HOW IT WORKSDC motor model: voltage → current → torque → speed

A brushless DC motor (BLDC) or DC motor with encoder is the standard actuator in mobile robotics and lightweight arms. The physics is well understood and has a clean model. Let's build it from scratch.

ELECTRICAL V supply R L −Kₑω i(t) τ = Kₜ·i MECHANICAL J rotor b ω shaft speed Gearbox ratio N:1 τ_out = N·τ ω_out = ω/N back-EMF feedback: Kₑω
DC motor model: a voltage source drives current through winding resistance R and inductance L; back-EMF (Kₑω) opposes the source; the resulting current i produces torque τ = Kₜ·i which drives the rotor inertia J against viscous friction b, producing shaft speed ω. A gearbox scales torque up and speed down by ratio N.

The governing equations, derived from Kirchhoff's voltage law (electrical) and Newton's second law (mechanical):

DomainEquationPhysical meaning
Electrical L·(di/dt) = V − R·i − Kₑ·ω Supply voltage drives current; winding resistance and back-EMF oppose it; inductance creates a lag.
Mechanical J·(dω/dt) = Kₜ·i − b·ω − τ_load Motor torque (Kₜ·i) accelerates rotor against viscous friction and any load torque.
Coupling Kₑ = Kₜ (SI units) Torque constant and back-EMF constant are equal in SI. In practice, datasheets use different units — be careful.

Three things in this model will matter enormously for control design. First: the motor responds to voltage, not torque. Your controller computes a desired torque, but the driver converts it to a voltage. The current follows with a lag set by L/R (the electrical time constant, typically 1–5 ms for small motors). Second: the back-EMF Kₑ·ω is a natural speed governor — as speed increases, back-EMF grows, reducing the current and thus the torque. This is why unloaded motors reach a finite no-load speed. Third: the model is linear in i and ω, which makes it tractable for control design — but only until the motor hits its current (and thus torque) limit.

💡 The electrical time constant is usually fast enough to ignore — until it isn't

For a motor with L = 0.5 mH and R = 0.5 Ω, the electrical time constant τ_e = L/R = 1 ms. A 100 Hz velocity control loop runs at 10 ms period. The electrical dynamics are 10× faster — it is reasonable to approximate the motor as instantly delivering whatever current the driver commands. But for high-bandwidth force control (> 500 Hz), or when the control loop frequency approaches 1/τ_e, the lag becomes significant. Ignoring it produces a controller that looks stable on paper and rings in hardware.

The mechanical time constant τ_m = J·R/(Kₜ·Kₑ) tells you how quickly the motor accelerates from rest to near no-load speed. For a small robot joint motor (J ≈ 0.1 kg·cm², R = 0.5 Ω, Kₜ = 0.02 N·m/A, Kₑ = 0.02 V·s/rad), τ_m = J·R/(Kₜ·Kₑ) = (1×10⁻⁵ × 0.5)/(0.02 × 0.02) ≈ 12.5 ms. This is the timescale your velocity controller must respect — command changes faster than τ_m will be partially absorbed, not tracked.

CORE CONCEPTGear ratio and reflected inertia: the inertia multiplication you didn't expect

Almost every robot joint uses a gearbox. The intuitive reason is torque amplification: a motor that produces 0.1 N·m through a 100:1 gearbox delivers 10 N·m at the output shaft (minus losses). Speed decreases by the same factor: 1000 rpm at the motor becomes 10 rpm at the output. That's the useful part that everyone teaches.

The part that bites you in practice is reflected inertia. When the output shaft moves, the gear train forces the motor to move too — through the gear ratio. The kinetic energy stored in the motor rotor, as seen from the output shaft, is:

📖 Reflected inertia formula

If the motor rotor has inertia J_m and the gearbox ratio is N (motor-to-output), the inertia reflected to the output shaft is:

J_reflected = N² · J_m

The total inertia the controller sees at the output = J_link + N²·J_m, where J_link is the mechanical link inertia. At high gear ratios, the motor rotor dominates the inertia budget — often by a factor of 10 or more.

Why does N² matter so much? Consider a 50:1 gearbox with a motor rotor inertia of 1 g·cm² and a link inertia of 100 g·cm². The reflected motor inertia is 50² × 1 = 2,500 g·cm² — 25× the link. The effective inertia the controller sees is dominated by the motor, not the arm. If you designed your controller using only the link inertia (a common mistake when working from a CAD model that didn't include the motor model), your inertia estimate is off by a factor of 26. That controller will oscillate.

The flip side: a high gear ratio also multiplies friction and stiffness. Gear friction is torque-direction-dependent (it can be higher in backdrivability than forward drive), and high-ratio worm gears are not backdrivable at all — relevant when you want joints to hold position under gravity without power.

ParameterMotor sideOutput side (ratio N)Scales as
Torqueτ_mN · τ_m (minus losses)N
Speedω_mω_m / N1/N
Inertia (reflected)J_mN² · J_mN²
Friction (reflected)b_mN² · b_mN²
Stiffness (reflected)k_mN² · k_mN²

HOW IT WORKSSaturation, backlash, and friction: the real nonlinearities

The linear motor model breaks down in three important ways in practice. Each introduces a nonlinearity that the equation of motion does not capture.

1

Torque saturation — the most common unmodelled nonlinearity

Every motor has a continuous current rating (set by thermal limits) and a peak current rating (set by driver and winding limits). Current maps to torque via Kₜ. When the controller commands a torque beyond the motor's capability, the motor delivers the saturated value — not the commanded value. The controller doesn't know this happened unless there is explicit feedback. If the controller includes an integrator (PID, for instance), the integrator continues accumulating the error between commanded and delivered torque. This is integrator windup. When the saturation condition eventually ends (the commanded torque drops back into the achievable range), the accumulated integrator value drives a large overshoot. In velocity control, this looks like: the robot accelerates hard, hits the target velocity, but doesn't stop accelerating — it overshoots significantly before recovering. In practice it is the most common cause of "the simulation was smooth but the robot oscillated on first test."

2

Gear backlash and joint compliance

Real gears have clearance between mating teeth — backlash. When the motor reverses direction, it must take up this clearance before torque is transmitted. Backlash creates a dead zone in the position control loop: for small reversals, the motor moves but the output shaft doesn't. Typical spur gearboxes have 0.5–2° of backlash; harmonic drives are close to zero, which is why they dominate in high-precision arms. Joint compliance (spring-like flexibility in the gear train or structure) creates a different problem: the joint position measured at the motor (from the encoder) differs from the actual link angle. Controllers designed assuming rigid joints will excite the compliance resonance — typically 50–200 Hz — and oscillate. Series Elastic Actuators (SEAs) intentionally introduce a known spring and measure its deflection, turning compliance from a bug into a feature for force control.

3

Friction models: Coulomb, viscous, and Stribeck

The motor model includes viscous friction (b·ω), which is linear in speed. Real friction has a Coulomb component (constant magnitude, opposing motion direction — a sign discontinuity at zero) and a Stribeck effect (friction is higher at very low speeds than at moderate speeds, creating a dip as velocity increases from zero). These nonlinearities make precise slow-speed control hard: the Coulomb term creates a velocity dead zone (the motor doesn't move until torque exceeds static friction), and the Stribeck dip can cause stick-slip oscillation. Model-based friction compensation (estimating and feedforwarding the Coulomb and viscous terms) is standard practice in high-performance arm control, but requires careful identification of the friction parameters per joint.

SEE ITMotor saturation demo — integrator windup and anti-windup

Configure the motor and controller parameters below. The simulation runs a ramp velocity reference — the controller tries to track it with a PID velocity loop. Watch what happens when the commanded torque exceeds the motor limit (saturation): the integrator winds up, and when the ramp levels off, the accumulated integral drives an overshoot. Toggle anti-windup and see it disappear. Change the gear ratio and observe reflected inertia changing the transient response.

⚙ Interactive · Motor saturation and integrator windup

Worst choice: high gear ratio + no anti-windup. See exactly why that's wrong.

20:1
2.0 N·m
1.5
Anti-windup
Ramp profile
Reflected inertia: 400 × J_rotor
N² = 400; link inertia ratio: 4.0×
Reference velocity
Actual velocity
Commanded torque
Actual torque (saturated)
Integrator windup accumulation
Integrator (with anti-windup)
Select parameters and observe — the worst outcome is anti-windup OFF + aggressive ramp.

The key observation is the phase relationship between saturation and overshoot. When the motor saturates (red actual torque line peels away from the dashed gold commanded line), the velocity tracks below reference. The integrator keeps integrating that error. When the ramp levels off and the commanded torque drops into range, the accumulated integral immediately drives the motor to deliver extra torque — past the new reference velocity. Without anti-windup, this overshoot can be 30–80% of the target velocity depending on how long and how deep the saturation was. Anti-windup (implemented as integrator clamping: freeze the integrator whenever the output is saturated) eliminates the accumulation entirely — the system reaches the target cleanly.

🔑 Anti-windup is not optional

In every ROS 2 PID velocity controller for a robot with hardware torque limits — which is every robot — anti-windup must be enabled. The default PID parameters in many ROS 2 packages disable it. This is a sensible default for simulation (no saturation) and a dangerous one for hardware. Make anti-windup the first thing you verify when moving a PID controller from simulation to hardware.

CORE CONCEPTThe sim-to-real dynamics gap: what simulation gets wrong

The term "sim-to-real gap" is used loosely across robotics. In perception it means domain shift (simulated camera images look different from real ones). In dynamics it has a specific meaning: the discrepancy between the torques your controller thinks it is applying and the torques the hardware actually delivers.

Here is what a standard robotics simulator (Gazebo, MuJoCo, Isaac Sim) does with your controller's torque command:

✓

What simulation gives you (ideal actuator model)

The simulated joint receives τ_commanded and applies it instantly and exactly. No current limit. No electrical lag. No backlash. No Coulomb friction (unless you explicitly add a friction model). The joint moves according to τ = J·α (pure inertia + whatever friction model you configure). This is physically accurate for an infinitely powerful, infinitely fast actuator with perfect gearing. It is not accurate for a real motor.

✗

What hardware gives you (real actuator model)

The motor receives a voltage command. After an electrical lag (τ_e = L/R, 1–5 ms), current rises. Current is clamped to the driver's current limit. Torque equals Kₜ × clamped current. The gear train introduces backlash and multiplies the rotor inertia by N². Friction has a Coulomb component that creates a velocity dead zone. Total result: τ_delivered ≠ τ_commanded, with the discrepancy being worst during acceleration, deceleration, and direction reversal.

The minimum model gap — even ignoring backlash, compliance, and friction — is the combination of: (1) first-order lag on torque delivery, and (2) torque limit (saturation). A controller that never saturates in simulation (because the simulated actuator delivers any torque) will saturate immediately in hardware when it tries to track aggressive references. This is the mechanism behind most "it worked perfectly in Gazebo" field failures.

Effect SIMULATION HARDWARE Impact if ignored
Torque delivery Instantaneous, exact First-order lag (1–5 ms), current-limited Controller rings at high bandwidth
Torque saturation None (ideal) Hard limit at rated current × Kₜ Integrator windup → overshoot on hardware
Gear backlash Zero (unless modelled) 0.5–2° for spur gears Position oscillation around target
Coulomb friction Zero (unless modelled) Sign-discontinuous at zero speed Stick-slip at low velocity, dead zone
Reflected inertia If URDF includes motor inertia Always N² × J_rotor Wrong inertia → wrong gains → instability

The practical engineering response is not to write a perfect actuator model (though that helps). It is to design controllers that are robust to the gap: lower bandwidth (so electrical lag doesn't matter), explicit saturation handling (anti-windup), conservative velocity limits (so you never command torques that require saturation), and friction feedforward from identified parameters. The goal is a controller that degrades gracefully when its actuator model is wrong, not one that requires the model to be perfect.

💡 Simulate the actuator, not just the plant

Most robotics simulators let you add a first-order actuator model (a lag filter on the torque command) and a saturation block between your controller and the simulated joint. In Gazebo + ROS 2, this is straightforward to add in the hardware_interface or in a custom controller plugin. Doing so shrinks the sim-to-real gap dramatically — your controller must deal with saturation in simulation, so anti-windup is tested before the first hardware run. The cost is a slightly more complex simulation setup; the benefit is that "works in simulation" actually predicts "works in hardware."

FOLLOWBOTActuator model for FollowBot's arm and wheel drive

FollowBot has two distinct actuator subsystems, and the sim-to-real gap presents differently in each. This is where the dynamics derivation from Lessons 3.1 and 3.2 meets the hardware that must execute it.

Wheel drive motors

FollowBot's differential drive uses two brushless DC motors with integrated encoders, driven by a 3-phase ESC through a 20:1 planetary gearbox. Key parameters (representative values for a FollowBot-class platform):

ParameterValueDesign consequence
Motor Kₜ0.022 N·m/ARated current 10 A → continuous torque 0.22 N·m at motor
Gear ratio N20:1Output torque: 4.4 N·m continuous; reflected inertia: 400 × J_rotor
Rotor inertia J_m0.08 g·cm²Reflected: 32 g·cm² — comparable to wheel+axle inertia (≈ 40 g·cm²)
Peak current30 A (1 s burst)Peak torque 0.66 N·m motor → 13.2 N·m output; used for starting/stopping
Electrical τ~2 msVelocity control at 100 Hz (10 ms period) is safe; 500 Hz would see lag
Backlash< 0.1° (planetary)Negligible for velocity control; relevant for precise position hold

For the PID velocity controller (introduced in Lesson 3.4), the key fact is: continuous torque limit at the output shaft is 4.4 N·m. If the controller commands an acceleration requiring more than this — for instance, a sudden velocity step from 0 to 1.0 m/s — the motor saturates for the first ~80 ms of the acceleration. Anti-windup must be enabled with a clamping threshold matching this limit. Without it, the first stop-and-go movement in the lab will overshoot and the robot will collide with something.

6-DOF arm joints

FollowBot's arm uses servo motors with integrated gear trains at 100:1 to 200:1 ratios (shoulder and elbow joints) and 50:1 (wrist). The sim-to-real gap is larger here because:

⚠ High gear ratios magnify the reflected inertia problem

At 100:1, N² = 10,000. A rotor inertia of 0.05 g·cm² reflects to 500 g·cm² at the output. If your arm link inertia is 200 g·cm² (from the URDF CAD model), your actual total inertia is 700 g·cm² — 3.5× what the model predicted. Controller gains designed for 200 g·cm² will produce oscillations on hardware. Always include motor inertia in your URDF inertial tags, and verify the total reflected inertia against hardware measurements (using a ramp test: measure the commanded torque and angular acceleration during a free-motion sweep to compute J_eff = τ/α).

The Stage 3 milestone for FollowBot's arm — PID velocity controller tuned to a quantitative settling-time spec using Ziegler-Nichols then refined via root locus (Lesson 3.4), with feedforward from inverse dynamics reducing tracking error — depends on getting the actuator model right first. A Ziegler-Nichols tuning procedure run with the wrong effective inertia will produce gains that are correct for the simulation model and wrong for the hardware. Run it on hardware with correctly identified J_eff. The inverse dynamics feedforward (τ_ff = M(q)q̈_desired + C(q,q̇)q̇ + g(q)) is computed from the full dynamics model — and that model includes the motor reflected inertia, not just the link inertia. Leaving the motor out of M(q) makes the feedforward systematically under-compensate inertial forces, leaving residual tracking error that the PID feedback must correct — exactly the scenario where saturation and windup become dangerous.

anti_windup_pid.pyrclpy · velocity PID with anti-windup
class AntiWindupPID:
    """Velocity PID with integrator clamping (anti-windup)."""
    def __init__(self, Kp, Ki, Kd, tau_limit):
        self.Kp = Kp; self.Ki = Ki; self.Kd = Kd
        self.tau_limit = tau_limit   # N·m, output shaft torque limit
        self._integral = 0.0
        self._prev_error = 0.0

    def update(self, error, dt):
        if dt <= 0: return 0.0
        derivative = (error - self._prev_error) / dt
        self._prev_error = error
        # Tentative output (before clamping)
        p_term = self.Kp * error
        d_term = self.Kd * derivative
        tentative = p_term + self.Ki * self._integral + d_term
        # Anti-windup: only integrate if output is NOT saturated
        saturated = abs(tentative) >= self.tau_limit
        if not saturated:
            self._integral += error * dt   # accumulate only in linear region
        tau_cmd = self.Kp * error + self.Ki * self._integral + d_term
        return max(-self.tau_limit, min(self.tau_limit, tau_cmd))

    def reset(self):
        self._integral = 0.0; self._prev_error = 0.0

The anti-windup logic is on lines 16–17: the integrator only accumulates when the tentative output is not saturated. When the motor saturates (tentative >= tau_limit), the integrator freezes. When saturation ends, the integrator resumes from where it was — without the accumulated error that would cause overshoot. This is the clamping form of anti-windup, the simplest and most common. More sophisticated forms (back-calculation, observer-based) exist for plants where clamping causes discontinuities, but for velocity control on a robot joint, clamping is adequate.

WEAKNESSWhere this bites in practice

✗ Using simulated PID gains directly on hardware

In simulation, the actuator is ideal — any torque is delivered instantly. The PID gains that produce a critically damped response in simulation will almost always produce oscillation or overshoot in hardware, because the real system has a torque limit that forces saturation on the first transient, plus an electrical lag that the simulation didn't model. The correct workflow: tune in simulation to get a starting point, then retune on hardware using a conservative (lower-gain) starting point and increasing gains systematically. Never run the simulated gains on hardware as the first test — verify on a low-speed, constrained motion first.

✗ Including only link inertia in the dynamics model

A common URDF error is modelling only the links' mass and inertia from CAD, leaving the motor inertia out of the <inertial> tags. At high gear ratios (50:1 and above, common in arm joints), the reflected motor inertia N²·J_m can dwarf the link inertia. The resulting dynamics model is systematically wrong — the effective mass matrix M(q) underestimates inertia by a factor of 2–10 depending on joint configuration. Inverse dynamics feedforward will under-compensate, and any model-based controller (LQR in Lesson 3.8, for instance) will use incorrect state matrices. Always measure J_eff on hardware with a ramp test and compare to your model. Discrepancies above 20% indicate missing motor inertia in the model.

✗ Treating backlash as negligible for position control

For velocity control, 1° of backlash is usually negligible — the velocity loop doesn't care about small position dead zones. For position control (holding a joint at a precise angle), backlash creates a fundamental resolution limit: the position can oscillate within the backlash zone without the controller knowing, because the encoder (on the motor side of the gearbox) reports no motion while the output link is rattling in the dead zone. This produces a characteristic symptom: position controller shows converged error but the physical link oscillates at a small amplitude. The fix is either output-side encoders (reading position after the gearbox) or harmonic drives (near-zero backlash) — not increasing PID gains, which makes the oscillation worse.

KEY INSIGHTHow it connects

Actuator models sit at the boundary between the equation of motion (which tells you what torques you need) and the control algorithm (which tells you how to compute them). Getting this boundary right is not a detail — it is the primary reason why robotics requires both a theory course and a hardware course, and why the best control algorithms fail when the actuator model is wrong.

GLOSSARYKey terms introduced

Back-EMF (back electromotive force)
Voltage induced in a motor winding by its own rotation, proportional to shaft speed (Kₑ·ω). Opposes the supply voltage and naturally limits the no-load speed. The back-EMF constant Kₑ equals the torque constant Kₜ in SI units.
Torque constant Kₜ
The proportionality between motor current and output torque: τ = Kₜ·i. Units: N·m/A. Determined by the motor's winding and magnet design. Higher Kₜ means more torque per amp but lower no-load speed for the same supply voltage.
Reflected inertia
The effective inertia contribution of the motor rotor as seen from the output shaft of a gearbox, equal to N²·J_m where N is the gear ratio and J_m is the rotor inertia. Scales as the square of the gear ratio, dominating the inertia budget at high ratios.
Torque saturation
The condition in which a commanded motor torque exceeds the hardware limit set by the driver's current rating. The motor delivers the clamped maximum; the controller's error continues to grow uncorrected.
Integrator windup
Accumulation of large values in a PID integrator while the actuator is saturated, because the error persists but cannot be corrected. When saturation ends, the accumulated integral drives an overshoot. Mitigated by anti-windup (integrator clamping or back-calculation).
Anti-windup
A control technique that prevents or mitigates integrator windup. The simplest form (clamping) freezes the integrator whenever the controller output is saturated, preventing further accumulation of error.
Coulomb friction
Friction that is constant in magnitude and opposed to the direction of motion — a sign discontinuity at zero velocity. Creates a velocity dead zone: the actuator won't move until the applied torque exceeds the static friction level.
Sim-to-real dynamics gap
The discrepancy between a controller's behavior in simulation (using an ideal actuator model) and its behavior on hardware (using a real actuator with lag, saturation, backlash, and friction). Closing this gap requires explicit actuator modelling and robust controller design.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1A motor with gear ratio N = 50:1 and rotor inertia J_m = 0.1 g·cm² is attached to a link with inertia J_link = 100 g·cm². What is the total effective inertia at the output shaft, and by how much does ignoring the motor underestimate it?›

Reflected motor inertia = N² × J_m = 50² × 0.1 = 250 g·cm². Total effective inertia = J_link + J_reflected = 100 + 250 = 350 g·cm². Ignoring the motor gives 100 g·cm², which is 3.5× too small. A controller designed with J_eff = 100 g·cm² will have gains that are effectively 3.5× too aggressive for the real system — the closed-loop bandwidth will be higher than designed, potentially unstable, or at minimum with poor transient performance. This is why motor inertia must be in the URDF inertial model, especially for joints with high gear ratios.

2Describe the mechanism by which integrator windup causes overshoot after a saturating command ends. What exactly is the "windup" that has accumulated?›

During saturation, the motor delivers the maximum torque τ_max, but the controller commanded τ_cmd > τ_max. The velocity error (reference - actual) is positive and nonzero because the commanded velocity is not being reached. The integrator in the PID controller adds this positive error to its accumulated sum each timestep. After many saturated timesteps, the integral term I = Ki × Σ(error × dt) is large. When the saturating condition ends (commanded velocity drops to a reachable level), the motor is now capable of delivering full torque — and the controller's total output includes the large accumulated integral term. This drives the motor hard even when the error is already small or zero, causing the actual velocity to overshoot the reference. The "windup" is literally the excess accumulated in the integral register while the actuator was stuck at its limit.

3Your velocity controller works well in Gazebo (smooth tracking, no overshoot) but oscillates badly in hardware. Before touching any PID gains, what two simulation vs. hardware discrepancies should you check first, and how?›

First, check for torque saturation: log the commanded torque (or equivalently the current setpoint sent to the motor driver) during the oscillation. If it clips at the hardware limit during any part of the motion, you have saturation. Verify anti-windup is enabled in your controller. Second, check effective inertia: run a free-motion ramp test (command a constant torque, measure α = dω/dt, compute J_eff = τ/α). Compare to your model. If J_eff is 2× or more larger than modelled, the motor's reflected inertia is missing from the model — add it and retune. Only after ruling out both saturation and wrong inertia should you start adjusting PID gains, because gains tuned against a wrong plant model will continue to fail even if they temporarily suppress oscillation.

4Why does gear backlash that is negligible for velocity control become a serious problem for position control? What hardware change solves it, and what software change does not?›

In velocity control, the controller cares about speed — a 1° dead zone in the gear mesh causes a brief zero-torque interval on direction reversal, which the velocity loop absorbs as a small transient. In position control, the target is a specific angle. Backlash means the output link can move within a 1° (or more) dead zone without the motor-side encoder detecting any motion. The position controller sees zero error (the encoder reports the target position) while the physical output oscillates within the backlash zone — the controller cannot distinguish "at target" from "rattling inside backlash." Increasing PID gains does not fix this; it makes the oscillation more energetic. The correct hardware fix is output-side encoders (measuring angle after the gearbox) or replacing spur gears with harmonic drives (near-zero backlash). The software workaround is a hold-zone deadband around the target, accepting positional error up to the backlash magnitude — not ideal but better than oscillation.

Next: PID control — derivation, tuning, and when it fails →