Theme
Tier 5 · lesson 1 of 9 · 25 min

The servo is the driver

You will: Understand why the control loop stays on the host, and why the SO-101 needs no microcontroller of its own.

Builds on The decision everything else rests on.

Every hobby-robot tutorial reaches for a microcontroller, and it is worth knowing why this arm does not need one. Each STS3215 is already a small computer: it runs its own position loop, reads its own magnetic encoder, and answers on a shared serial bus when it is spoken to by id. The thing a microcontroller would do — turn a position into a motor signal — is done inside every servo.

So the host runs everything else. The 50 Hz control loop, the controllers, limits, logging and every decision stay on the computer running ROS, and the hardware interface, FeetechSystemInterface, is a thin adapter. Once per cycle it sends one packet asking all six servos for their position, speed, load, voltage and temperature, collects six replies, and sends one packet with six new goal positions. There is no firmware of ours on the other end to keep in step with it.

The numbers decide the split. One cycle is a 14-byte request, six 14-byte replies and a 26-byte write: 124 bytes. At 1 Mbaud, with ten bits on the wire per byte, that is about 1.2 ms of a 20 ms cycle, before each servo's small delay in replying. The bus has room to spare; anything that would need a much faster loop — current control, a force-limited grip — is the servo's job, not the host's.

What the interface is responsible for is short, and every item on it is a decision about the physical arm: refuse to start if a servo the description names is not there; never move the arm on activation, so the first goal is wherever the arm already is; turn a joint's radians into a servo's counts using the profile's calibration; report a bus that stops answering as an error the controller manager acts on; and pass on what the servos measure about themselves.

It talks to a transport, not a serial port, so all of that runs against a simulated bus of six STS3215s, behind a TCP port. The same class runs unchanged over a USB serial adapter. TCP is also how a Mac will reach the real adapter, because Docker on macOS cannot pass a USB device into a container; the host-side bridge for that does not exist yet.

In the simulation

The bytes this lesson counts, live. The inspector's servo bus view builds the packet FeetechSystemInterface writes every cycle, from the same profile.

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.

In this lesson

  1. Open Inspect, then servo bus. Count the write. It is 26 bytes, for six servos.
  2. Home the arm with h or the home button, and read the goals. Every joint at zero is the profile's zero_count, 2048.
  3. Jog only wrist_flex. Press 4, then . a few times, and watch which bytes change.
  4. Take shoulder_pan to its upper limit and read its count.

Do it

  1. Read what the interface is responsible for. It is the only code that is different when the arm is real.

    sed -n 16,45p src/threevn_hardware/include/threevn_hardware/feetech_system_interface.hpp
    
  2. Start six simulated servos. Leave this terminal running.

    make fake-bus
    

    Expect: fake Feetech bus: 6 servos (ids 1,2,3,4,5,6) on 127.0.0.1:6560.

  3. In a second terminal, run the arm against them through the real hardware interface.

    make robot BUS=fake
    

    Expect: 6 servos answering on 127.0.0.1:6560 (tcp), then the three controllers configured and activated. The bus terminal says host connected.

  4. In a third terminal, look at the hardware side of the seam.

    make shell
    ros2 control list_hardware_components
    ros2 control list_hardware_interfaces | grep -E "effort|temperature"
    

    Expect: plugin name: threevn_hardware/FeetechSystemInterface, state: ... active, read/write rate: 50 Hz. Then an effort and a temperature state interface per joint: what each servo reports about itself, which neither the mock nor Gazebo's servo has.

  5. From the host, run a scenario through it.

    make scenario NAME=home
    

    Expect: PASS. The same scenario as on the mock and in Gazebo, now through the plugin that will drive the real arm, with six simulated servos behind it.

  6. Stop the arm with Ctrl-C in its terminal, then the bus with Ctrl-C in its own.

    Expect: The arm's log ends with Successful 'deactivate' of hardware 'so101_follower'. On the real arm that is the moment the servos let go.

You will know it worked when: list_hardware_components names FeetechSystemInterface at 50 Hz, and home passes through it against the simulated bus.

When it goes wrong

make robot BUS=fake dies at once with exit code -6.

Why: The line above it says why. cannot connect to 127.0.0.1:6560: Connection refused means no bus is running; the controller manager then aborts, because the hardware could not be configured.

Fix: Start make fake-bus in another terminal first, and wait for its 6 servos line.

The bus was running, and after make stop it is gone.

Why: make stop stops everything this workspace runs, and the simulated bus is one of those programs.

Fix: Start make fake-bus again. Stop the arm with Ctrl-C in its terminal when you want the bus to stay up.

A second make robot BUS=fake gets no answers from a bus that is clearly running.

Why: The simulated bus serves one host at a time, as a real bus has one adapter. An earlier stack may still hold it.

Fix: Ctrl-C the earlier stack, or make stop and start the bus again.

Terms

Host-side control loop
Running the control loop on the computer that runs ROS, with the hardware below it doing only what must be done in real time. Here the servos close their own position loops.
Bus servo
A servo with its own controller and an id, sharing one serial line with others. It is addressed, not wired to a pin, and it answers with what it measures.
Sync read
One instruction that asks several servos for the same registers; each answers in turn, in the order asked. How six servos are read in one exchange.

Every term in the course: glossary.

Check yourself

Answer in your head first, then open it.

Why does the SO-101 need no microcontroller between the computer and the motors?

Each servo closes its own position loop and speaks a serial protocol. The computer can address all six on one bus directly, so there is nothing left for a microcontroller to do.

One cycle moves 124 bytes. At 1 Mbaud, how much of a 50 Hz cycle is that?

1240 bits, about 1.2 ms of the 20 ms cycle, plus each servo's short reply delay. The bus is far from the limit; the loop rate is decided by the controllers, not the wire.

Why is the first goal after activation wherever the arm already is, and not home?

The arm could have been left anywhere, or moved by hand while it was off. A first goal of home would drive it there at full speed the instant torque comes on.

Stretch

Find the test that proves activation does not move the arm. Read what it sets up and what it checks, then describe what would happen on the bench if that test were deleted and the bug it guards against came back.

Hint

TEST(Activate, DoesNotMoveTheArm) in src/threevn_hardware/test/test_feetech_system_interface.cpp.

Going deeper