Integration tests without physics
You will: Test interface contracts and limit enforcement against a real ROS graph, with mock hardware.
Builds on The decision everything else rests on, Four layers of test, and what each is for and Limits come from the datasheet.
Between the fast suite and the simulator sits a layer that starts a real ROS graph — real launch files, real controllers, the real controller manager — against mock hardware. No physics, so it is deterministic. A real graph, so it catches what unit tests cannot: a node that never starts, a topic with the wrong type, an action that does not exist, a transform nobody publishes.
It checks the interface as documented, literally: the topics,
services and actions in the architecture document must exist, with
the right types; every actuated joint must appear in /joint_states;
exactly one of each node must be running.
And it holds the line on a safety finding. Early on, commanding a
joint far past its limit drove it there under the mock: on the
SO-101, with the check off, the pan reached 200° against its 110°
limit.
Neither the description's limit nor the controller config's min and
max stopped it — Gazebo had only looked safe because its physics joint
has a hard stop. Turning on enforce_command_limits made the
controller manager clamp every command below the seam. Two tests now
pin it: an out-of-limit command is clamped, and an in-limit command is
not — because a clamp that clamps everything would pass the first
test alone.
Note one thing the clamp does not do. A clamped goal still reports
SUCCEEDED. The motion went somewhere you did not ask for, and the
status says all is well. That is why Tier 5 adds a loud check above
the seam as well as this silent one below it.
On the SO-101 this layer runs 14 tests, and skips two, each with
its reason printed. With TARGET=feetech it runs the same 14
through the real hardware interface, against a simulated servo
bus, in about a minute and a half.
And a warning, found while writing this lesson. Nothing runs this
layer automatically — not make test, not CI. On this project's
first robot, when a redesign raised the arm's base by 15 mm, the
hand-computed tool height in the fast suite was updated; the copy in
this layer was not, and it failed, unnoticed, for nearly two weeks,
until the course's own verification ran make test-ros. A test layer nobody runs is not a safety net. It is
a list of things that used to be true.
In the simulation
The two limit tests, by hand. This page has no hard stops in a physics joint, like the mock; the limits hold only because the software clamps every command, as enforce_command_limits does below the seam. It is not ROS: unlike a clamped goal, a jog here says when it stopped at a limit.
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 the /joint_states view, and check all six joints are listed, as the interface contract requires.
- The out-of-limit test: hold
.onshoulder_pan(or drag its slider) well past the end. It stops at 1.9199 rad, 110°, and not at the 200° the unclamped mock reached. - The partner test: an in-limit command must arrive unchanged. Press ready and read
elbow_flexat 0.8 andwrist_flexat 0.5, exactly.
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
Run the integration layer against the SO-101.
make test-rosList what it checks.
grep -n "def test_" src/threevn_bringup/test/test_ros_integration.py src/threevn_bringup/test/test_tf_matches_kinematics.pyFind the setting the limit tests pin, in the SO-101's controller file.
grep -n -B3 -A3 "enforce_command_limits" src/threevn_bringup/config/so101_controllers.yamlRemove it — set it to
false— and run the layer again. Then put it back.make test-ros git checkout src/threevn_bringup/config/so101_controllers.yamlExpect:
test_out_of_limit_command_is_clamped_below_the_seamshould fail while its partner still passes.
make test-ros is green, and you watched it catch limit enforcement being switched off.When it goes wrong
A test in this layer fails on code nobody touched for weeks.
Why: The layer only runs when someone types make test-ros, so a change elsewhere can break it silently.
Fix: Run it before every merge that touches the robot description or the controllers — or put it in CI, which is this lesson's stretch.
The integration tests are flaky only on a busy machine.
Why: Controller activation has a wall-clock window, and a loaded machine misses it.
Fix: Run it alone. If it is still flaky, look for a wait that should be a poll.
Terms
- Integration test
- A test that runs several real components together — here a ROS graph with real controllers — rather than one in isolation.
- Interface contract
- The documented set of topics, services and actions, with their types, that clients are entitled to rely on.
Every term in the course: glossary.
Check yourself
Answer in your head first, then open it.
Why test that an in-limit command is NOT clamped?
A clamp that clamped everything — or a robot that never moved — would pass the out-of-limit test on its own. The pair proves the clamp is selective.
Why is the mock better than Gazebo for testing limit enforcement?
Gazebo clamps for its own physical reasons, so a limit test there passes whether or not the software enforces anything. The mock has no hard stops, so only the software can make the test pass.
Stretch
Put this layer in CI. Add a job to your copy of the workflows that builds the ci image, starts the mock robot and runs pytest -m ros in src/threevn_bringup. Then prove it earns its place: break the hand-computed tool height in test_tf_matches_kinematics.py on a branch and watch the job go red.
Hint
simulation-tests.yml already runs a slow layer in CI; read how it starts a robot and waits for it before copying the shape.