servo_control
Generic closed-loop PID electromechanical actuator simulator (RK4) with torque saturation, anti-windup, viscous damping, and load torque: computes rise time, 2% settling time, percent overshoot, steady-state error, peak torque, and mechanical energy. Writes response.csv and plot.png.
- Field
- Dynamics and control
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.05 s
Compiled from source: run sh packs/install.sh once before admitting it.
A real run
- rise time
- 0.103 s
- settling (2 %)
- 0.177 s
- overshoot
- 1.7e-05 %
- damping ratio
- 0.98
Known answers it must pass
r0001critically damped PD (J=1, kp=100, kd=20 -> wn=10, zeta=1.0): 0% overshoot, exact settlingpassed
closed_loop_wn_rad_s10 ± 1e-0910lockedunder 0.01 % of the tolerance usedclosed_loop_zeta1 ± 1e-091lockedunder 0.01 % of the tolerance usedovershoot_pct0 ± 1e-060lockedunder 0.01 % of the tolerance usedsteady_state_error_rad0 ± 1e-054.32842e-08locked0.43 % of the tolerance usedr0002underdamped PD (zeta=0.5) matches exact analytical overshoot exp(-pi/sqrt(3)) = 16.303%passed
closed_loop_zeta0.5 ± 1e-090.5lockedunder 0.01 % of the tolerance usedovershoot_pct16.3033 ± 0.0516.3033locked0.087 % of the tolerance used
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
inertia_kg_m2 | kg m^2 | 0.005 | |
viscous_damping_Nm_s_per_rad | N m s/rad | 0.01 | |
kp | 1 | 5.0 | |
ki | 1 | 0.0 | |
kd | 1 | 0.3 | |
max_torque_Nm | N m | 1000.0 | |
load_torque_Nm | N m | 0.0 | |
target_rad | rad | 1.0 | |
duration_s | s | 2.0 | |
dt_s | s | 0.0005 |
Readings
| Name | Unit | Meaning |
|---|---|---|
final_position_rad | rad | |
steady_state_error_rad | rad | |
overshoot_pct | % | |
rise_time_s | s | |
settling_time_2pct_s | s | |
peak_torque_Nm | N m | |
saturation_pct | % | |
mechanical_energy_J | J | |
closed_loop_wn_rad_s | rad/s | |
closed_loop_zeta | 1 | |
response.csv | ||
plot.png |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.