Dynamics & Torque Control, step 5
Making the arm springy
Give the hand a virtual spring and damper: it yields when pushed, by exactly the amount you choose, and comes back.
Builds on Direction, distance & the dot product and Feedback: P and PD control, from the free Foundations.
Write and run this step in the simulator with ProGive way, then come back
Every controller so far fought errors as hard as it could. Near people and fragile parts you want the opposite: a hand that yields when pushed, like a spring, and returns afterwards. Impedance control lets you choose how springy it is.
A spring at the hand
Imagine a spring and a damper tying the grasp point to a rest position :
is the grasp point's position (m) and its velocity (m/s); is the stiffness (N/m), the damping (N·s/m), and the force (N) the imaginary spring and damper apply to the hand.
From a hand force to joint torques
The 3×4 Jacobian relates joint velocities to the hand's: . A force does the same work measured at the hand or at the joints, , so the torques that push the hand with force are
with still cancelling gravity. Nothing measures the push: under a steady force the hand settles where the spring balances it, , so it moves , exactly the stiffness you chose.
The wrist is held for you. The three other joints then fix the hand's position; with all four free, the arm could fold in a way that doesn't move the hand at all, and no spring at the hand would stop it.
| Call | Returns |
|---|---|
arm.jacobian(q) | , 3×4 |
arm.fk(q) | the grasp point at angles |
arm.gravity_torques(q) |
The program
It holds the hand where it starts for 5.5 s with = 600 N/m, then for 5.5 s with = 150 N/m. Each time the hand is pushed 4 N forwards for 1.2 s, then 4 N down, then jabbed. Red arrows show the pushes, and the yellow line is the virtual spring, stretched from the frame at the rest position.
Your task
Write impedance_torque(q, qd, x_des, K, D). Before and after the pushes the hand must rest within 1 mm of its start, the steady pushes must measure a stiffness within 15 % of , and after each jab the hand must be back within 2 mm within 1 s.