Servo Motor Control Simulator — PD Position Loop, Torque Limit & Load Disturbance Interactive

Interactive servo-control laboratory: command an angle, tune proportional and derivative gains, set a torque limit and apply load torque.

← Robotics Labs
About this tool — how it works & FAQOpen ▾Close ▴

About the Servo Motor Control Simulator

This simulator closes a position loop around a rotary actuator. A controller compares the commanded angle with the measured output angle and applies a clamped motor torque. You tune the gains, inertia, torque limit and load to see overshoot, settling, saturation and steady-state offset for yourself.

What the simulator shows

• A cutaway actuator rig with motor and stator, a reduction gear pair, an output shaft with angle pointer, a feedback encoder and a load brake with torque indicator. • Controls for position command (-120° to 120°), proportional gain (0.2-2 N·m/rad), derivative gain (0-0.4 N·m·s/rad), output inertia (0.01-0.08 kg·m²), torque limit (0.2-1 N·m) and load torque applied after 2 s (-0.3 to 0.3 N·m). • Readouts for output angle, position error, angular velocity, applied torque, the active command and a torque-saturation flag. • A check box that alternates the command every 6 s, and experiments such as a well-damped 90° move and a load-induced offset.

The control law

Torque is τ = clamp(Kp(θcmd - θ) - Kd ω, ±τmax) and the output follows J dω/dt = τ - bω - τload, with b = 0.02 N·m·s/rad. Raising Kp stiffens the response but can cause overshoot, while Kd adds damping. A steady load needs a steady torque, and with proportional control alone that torque comes from a permanent error: the lab notes that about 0.25 rad (14.3°) of error is needed to hold the example load. When the requested torque exceeds the limit it is clipped, which limits acceleration regardless of gain.

Model boundaries

The model is a single output-side inertia with an ideal encoder, PD control and viscous damping. The gear ratio is illustrative, and there is no electrical winding model, backlash, stiction or hard stops. Dynamics are integrated with substeps of at most 2 ms.

Frequently asked questions

What does the derivative gain do in a servo loop?

The derivative term opposes velocity, acting like added damping. Increasing Kd reduces overshoot and oscillation, while setting it to zero leaves only the proportional spring-like action.

Why does the output settle away from the command under load?

With only proportional and derivative action, holding a constant load torque requires a steady controller torque, and that requires a steady error. The lab's load-offset experiment shows roughly 14.3° of error for the example load.

What happens when torque saturates?

The torque command is clipped to the limit, so the actuator cannot accelerate any harder no matter how high the gains are. The saturation flag turns on, and large steps look like constant-acceleration ramps before the loop takes over.

Does this model a real servo drive?

It is a teaching model of the position loop only, without current loops, winding electrical dynamics, backlash or friction. It is useful for understanding gain, damping and saturation, not for tuning a specific drive.

Related tools & guides