Overview
Pendularm derives the mass matrix, Coriolis/centrifugal forces, and gravity load for a serial manipulator. A live servo loop uses the same runtime protocol as Project 1, with /joint_states and /joint_trajectory driving an external UI.
Use ARM_SIM_LINKS=2 or 3 to change the robot.
How the control loop works
- Read the current state and held target.
- Compute error and a clamped integral.
- Apply
τ = Kp·e + Ki·∫e + Kd·ė. - Evaluate dynamics and advance with the selected integrator.
Why four integrators?
Euler is simple but can drift. Midpoint and Verlet improve stability differently; RK4 samples the derivative several times for higher accuracy. Changing method and timestep makes numerical error visible in the arm's motion.
state → PID effort → M(q)q̈ = τ − C(q,q̇) − G(q) · integrator → next state