Two arms, one motion: leader and follower
You will: Drive the follower arm from a leader arm moved by hand, and measure how far behind it runs.
Builds on Drive it yourself and Find zero, and which way is positive.
The SO-101 is designed as a pair. The follower is the arm this course drives. The leader is a second, lighter arm with the same joints, whose servos are geared to be pushed by hand: you move it, and the follower copies. It is how most demonstrations for robot learning are recorded, and it is the next lesson's data source.
In this stack it is one more client of the same interface. A node reads the leader's six positions off its own bus and sends them to the follower's trajectory controller, the topic the keyboard teleop uses. Nothing below the seam changes, and the follower does not know whether its targets come from a keyboard, a script or a hand.
Three things make it interesting. Calibration twice: each arm has its own zeros and directions, and a leader read through the follower's calibration moves the follower somewhere else. Lag: every target crosses a bus, a node and a controller, and the follower runs behind the leader by an amount worth measuring, because a demonstration recorded with lag teaches the lag. Limits: a hand can push the leader faster and further than the follower may go, so the follower's limits decide, not the leader's.
Before either arm exists, both can be rehearsed: two simulated buses, one for each. The leader's bus has a simulated hand on it, a servo swung back and forth while limp, and the reader only reads it. What the rehearsal measures is the software's share of the lag: a bus read, the node, the controller, the driver, a bus write and a simulated servo. A real pair adds gears, USB adapters and real servos, and nobody has measured that yet; it waits on the physical leader arm.
In the simulation
There is one arm here, so you are the leader: Record captures what your hand does, and Replay is the follower copying it. The servo bus view shows the goal counts the follower would be sent. With a real leader arm, the Lab page's Leader panel reads it over Web Serial and the sim copies it; arm the follower in its Arm panel and it copies the sim. The page is kinematic, a drawing with no physics. The stack's own leader reader, rehearsed on two simulated buses, is in the steps below; the lag between two physical arms is not measured yet.
Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.
The SO-101 loads as you reach it.
make drive keysIn this lesson
- Open Inspect, then servo bus, and swing
shoulder_panto its upper limit. Its goal reads 3300. A leader pushed further than this is clipped here; the follower's limits decide. - Press Record, move the arm by hand through a few joints, and press Record again to stop.
- Press Replay and watch the arm copy the motion you made.
Joints · SO-101 follower
1–5 joint · , . jog · [ ] jaw · - + step · h home · f frames
the keys of make drive
The buttons do what the keys do: hold one to repeat.
Limits from the description; speed capped at 1.7434 rad/s, the servo's datasheet derated. Poses from the profile.
Inspector
Code
The repository's own code behind what you do here appears once you move the arm.
Do it
Read the leader's calibration. It is its own block in the profile, beside the follower's, and labelled assumed like the follower's.
sed -n '/^leader:/,/^control:/p' src/threevn_robot_description/config/so101_follower.yamlExpect:
provenance: assumed,rate_hz: 30, and six joints with ids 1 to 6, eachzero_count: 2048, direction: 1until the calibration session measures them.Start the follower's simulated bus. Leave it running.
make fake-busExpect:
fake Feetech bus: 6 servos (ids 1,2,3,4,5,6) on 127.0.0.1:6560.In a second terminal, the follower, driven through its real hardware interface over that bus.
make robot BUS=fakeExpect: Three controllers active, as in the protocol lesson.
In a third, the leader's bus, on its own port, with a hand on
shoulder_panswinging it 600 counts each way every 4 seconds.make fake-bus BUS_PORT=6561 HAND=1:600:4Expect:
a hand moves servo 1, 600 counts each way every 4.0 s, then the six servos on 6561.In a fourth, the leader reader. Watch the follower in RViz with
make watchif you like.make leaderExpect:
reading the leader at 127.0.0.1:6561, 30 Hz, servos [1, 2, 3, 4, 5, 6].In a fifth, measure how far behind the leader the follower runs.
make leader-lagExpect:
the leader swung 105 deg,follower behind the leader by 90 ms(120 ms on a second run), with under 3 degrees of error left at that delay against about 6 to 8 if it were not behind; thenok. That is the software chain on fake buses.Now push the leader past where the follower may go: stop the leader's bus and the reader, start the bus again with
HAND=1:1500:4, thenmake leader.make fake-bus BUS_PORT=6561 HAND=1:1500:4Expect: The reader warns
shoulder_pan: the leader is at +2.19 rad, past the follower's limit; sending +1.92. The follower's limit decides.make leader-lagnow fails, honestly: the follower is no longer copying the leader, by design.Run the reader's tests, which need no bus.
make shell cd /ws/src/threevn_control python3 -m pytest test/test_feetech.py -qExpect:
11 passed: packets worked out by hand, a corrupted reply refused, the calibration applied, and no way in the module to write to a servo.
make leader drives the follower and make leader-lag reports the follower copying the leader about a tenth of a second behind; a leader pushed past a limit is clipped, with a warning. The lag between two physical arms is still to be measured.When it goes wrong
make leader keeps warning leader not read: no position from servo(s) [...].
Why: Nothing on the leader's port, or a leader bus missing a servo.
Fix: make fake-bus BUS_PORT=6561 ... first, or LEADER=host:port for wherever the leader's bus really is.
The follower moves the opposite way to the leader, or sits at an offset from it.
Why: The leader read through the wrong calibration. Each arm's zeros and directions are its own.
Fix: Correct the profile's leader: block, never the code; on a real pair, measure it in the calibration session.
make leader-lag says the leader hardly moved.
Why: No hand on the leader's bus, and the reader never moves a servo itself.
Fix: HAND=1:600:4 on the leader's make fake-bus, or a real hand on a real leader.
Terms
- Leader arm
- A hand-moved arm whose joint positions are read and sent to another arm as targets. The SO-101's is geared to be back-driven easily.
- Follower arm
- The arm that copies a leader. The one that does the work.
Every term in the course: glossary.
Check yourself
Answer in your head first, then open it.
Why can the leader reader not enable torque on the leader's servos?
A leader is limp so a hand can move it. A reader that could lock its servos could lock a student's hand in place, so the module that talks to the leader's bus has no write instruction at all.
What does the 90 to 120 ms measured here leave out?
Everything physical. Two fake buses measure a bus read, the node, the controller, the driver, a bus write and a simulated servo. Real servos, gears and USB adapters add their own, which waits on the physical pair.
The leader is pushed past the follower's limit. Who wins, and why does the lag check then fail?
The follower's limit, read from its description. The follower stops at the limit while the leader goes on, so it is no longer copying, and a check that compares the two says so.
Stretch
Find the reader's rate in the profile, halve it, and measure the lag again. Explain the change from what one tick of the reader costs.
Hint
rate_hz in the leader: block; a target is sent once per tick, and the trajectory it sends ends two ticks ahead.