Skip to main content
NewEpisode 3a is out: Carry the conversation onWatch →

This part is for members

Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.

Keep watching the free parts
Sensors · 12c

Multi-turn 3: from counts to the joint output

Up to 12b every position was in motor counts (box 6); a joint moves its output behind a gearbox, and the host works in joint units. Running example: 12b's wb40st (131,072 counts a turn) behind a 10:1 gearbox with no output encoder; a host writes the ratio at 522 ms. Seven stops: the control resolution (the KTM59xx gives 2^24 counts a turn and its header divides by 128 to get 131,072; the wb40st divides by 1); the ratio as two integers, Reduction_ratio_num / _den, plus a float copy and its inverse (CANopen 0x6091 puts the motor revolutions in the denominator, which looks swapped → episode 23); motor to joint with PosUnitMotorToLoad: conver_den_div_num divides twice and rounds down, so rest at 39,228 reads 3,922 and −9 reads −1; joint to motor with PosUnitLoadToMotor: target 131,072 × 10 = 1,310,720 and profile velocity 60 × 10 = 600 motor rpm; holding at 1,310,720 the motor wobbles a few counts and the host reads 131,071 on 32% of ticks, which Position_window 100 swallows; speed is float × Reduction_ratio_inv, never rounded. A real bug: the speed limit Max_profile_velocity is worked out at boot with ratio 1 as 6000 and the ratio setters never redo it, so 1000 joint rpm is accepted and the motor trips overspeed (error bit 6) at 1,223 ms; fixed on the fork's branch fix/gear-ratio-speed-limit (patched run: 1000 is refused). Your turn: ratio 7:3, target 30,000.

Up next12d · Multi-turn 4: the second encoder behind the gearbox→