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 · 12b

Multi-turn 2: which turn it is on after power-up

In 12a, box 6 = init_pos_p + turns counted + count. The turns counted live in RAM and are gone at power-off; the turns from before can only come back through init_pos_p, which MotorCtlSmStateInit loads once at power-up: the driver's turns × counts per turn. Running example: the board's default wb40st (Tamagawa, 131,072 counts a turn) stops at 3.3 turns and is power-cycled: the real board build reads count 39,321 and turns 0, so box 6 is 0.3 of a turn: three turns gone, no error. Down the call chain: all five drivers write a_multi_raw = 0, the Tamagawa driver only asks for the angle (CF_ID_0, never CF_ID_1 / CF_ID_5, which read the turns), all six motor headers set the turn counter's size to 0, and the SIL returns 0 too. The turn rules in EncoderDataProcess never run on Y01; one of them runs before the direction mirror instead of after, fixed on the fork's branch fix/multi-turn-sign-after-dir. The cost: the motor still runs (the angle needs only the count), but when the host asks for absolute 0 the rotor turns back just 0.3 of a turn and stops at a true 3.0 turns while reporting 0; relative moves are unharmed. Who can put it back: init_pos_p is not in flash and only a host can write it over MAVLink (episode 32); homing's offset (episode 25) is measured from box 6, so it is wrong after a power-up in another turn (worked out from the code); the load-side TODO → 12d. Your turn: stopped at 5.9 turns.

Up next12c · Multi-turn 3: from counts to the joint output→