This simulator closes a position loop around a motor and a geared arm. An encoder measures the angle, the controller compares it with your target and commands a motor torque, and you can disturb the loop with an opposing load torque or a biased sensor to see what feedback can and cannot fix.
• A 3D servo motor cutaway, positioned arm, angle encoder, PID controller block and disturbance load, with the target, actual and measured angles plotted against time. • Sliders for target angle (-60 to 60 degrees), proportional gain (0-12), integral gain (0-5), derivative damping (0-4), opposing load torque (0-1.5 N m) and sensor bias (-15 to 15 degrees), plus a Close feedback loop switch. • Six live readouts: actual angle, measured angle, measured control error, motor torque, angular velocity and a torque-limit-active flag. • Two presets: Proportional offset (steady measured error about Tload/Kp) and Biased feedback (measured error goes toward zero while the actual angle stays offset).
The controller sees the measured error e = theta_target - (theta + bias) and outputs u = clip(Kp e + Ki times the integral of e - Kd omega, -2, +2) N m. The arm obeys J omega-dot = u - b omega - T_load with J = 0.5 kg m2 and b = 0.4 N m s/rad. With proportional action only, an opposing load leaves a steady error of about T_load / Kp; integral action removes it, and conditional anti-windup stops the integrator growing while the torque limit is saturated.
The sensor is ideal and continuous, integration uses fixed steps, and the open-loop mode applies a fixed 0.5 N m drive. There is no gearbox backlash, no position stops and no encoder quantization. Live controls keep the running state, so you can change the setpoint mid-run. Note that with sensor bias the controller drives the measured error to zero while the real angle stays wrong, because it only sees what it measures.
Yes. If the sensor has a bias the controller drives the measured angle to the target while the real arm angle is offset by the bias. Feedback is only as good as the measurement.
With an opposing load torque the motor needs a nonzero torque to hold position, and a proportional-only controller produces torque only if there is an error. The steady error is about T_load / Kp.
The actuator cannot deliver unlimited torque, so integrating the error while saturated winds the integrator up and causes overshoot. Conditional anti-windup blocks integration that would worsen saturation.
It assumes an ideal continuous sensor and a fixed-step numerical integration, with no backlash, position stops or encoder quantization. The open loop drives with a fixed 0.5 N m torque.