Test it with two parsers, not one
You will: Check a description with independent tools, and know which bugs only raw XML reveals.
Builds on A test suite people actually run.
The description is checked by two parsers written by different people
in different languages: urdf_parser_py, in Python, which the unit
tests use, and check_urdf, the C++ reference parser that ships with
ROS. They have different leniencies, so a disagreement between them is
itself a finding.
Some bugs are invisible to any parser, though, and the best example
is a duplicated link name. urdf_parser_py builds a dictionary keyed
by name, so the second link silently replaces the first and the parsed
tree looks perfectly healthy. The duplicate only exists before
parsing. So that check reads the raw XML.
This is not hypothetical. On this project's first robot, mounting an
arm on a mobile base brought two links called imu_link into one
description: not a parse error, just a quiet loss of one of them. A
test now asserts both survive.
One more principle is easy to violate without noticing. Every test
gets its description from the same function, describe(), with the
same arguments that ros2 launch uses at runtime. A test that built
its URDF some other way would be testing itself — a description nobody
runs.
Here is the honest part. make lint runs check_urdf on every
profile named threevn_*.yaml, and the duplicate-name test is
parametrised over the same set, so the SO-101's overlay is skipped by
both. That is a gap. This lesson has you run the second parser by hand
and look at the gap, rather than pretend it is closed.
In the simulation
This page reads upstream's URDF with a parser of its own, written for the site and neither urdf_parser_py nor check_urdf. Where its numbers agree with the ones tf2_echo prints from the running description, that is a third independent reading agreeing.
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
- Open Inspect, then its tf view.
- Send the arm to
ready. The tool should read about x 0.279, z 0.095: the same astf2_echoon the real stack. - Drag
shoulder_panto its lower limit. The page found that stop in the same<limit>linecheck_urdfreads. - Switch to /joint_states and read
shoulder_pan, −1.9199. One number, two readers, the same answer.
Joints · SO-101 follower
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
See why the automatic check skips this robot.
grep -n "threevn_\*" scripts/check_description.shExpect: The loop globs
threevn_*.yaml. The SO-101's profile is named so that it does not match, because its description is not built from this project's xacro.Run the C++ parser on all three of the SO-101's targets, inside the container.
make shell for t in mock gz feetech; do ros2 run threevn_robot_description describe so101_follower --target $t > /tmp/so101_$t.urdf check_urdf /tmp/so101_$t.urdf > /dev/null && echo "ok $t" || echo "FAIL $t" doneExpect:
okformock,gzandfeetech.Check for duplicate link names in the raw XML, the way the suite's duplicate-name test does.
grep -o '<link name="[^"]*"' /tmp/so101_gz.urdf | sort | uniq -dExpect: No output: no name appears twice. A parsed model could not have told you, because it keeps only one link per name.
Confirm the launch files and the tests describe the robot the same way.
grep -n "describe(" src/threevn_robot_description/launch/view_robot.launch.py src/threevn_sim/launch/sim.launch.py src/threevn_bringup/launch/robot.launch.pyExpect: The viewer, the simulator and the real-hardware launch all call
describe(). The SO-101's tests call the same function, so they check the description that actually runs.
check_urdf accepts the SO-101 on all three targets, no link name is duplicated, and you can say which automatic checks do not cover this robot yet and why.When it goes wrong
make lint passes and you assume the SO-101 was checked.
Why: The script globs threevn_*.yaml, and a green run only covers what it ran.
Fix: Read the per-profile lines it prints. The SO-101 is not among them until the script learns about vendor arms.
describe fails, and every check_urdf line says FAIL.
Why: The upstream description has not been fetched into vendor/, so there was nothing to check.
Fix: Run make so101-fetch on the host, then try again.
Terms
- Independent oracle
- A second, separately written implementation used to check the first. Agreement means something; disagreement is a finding.
- One function every test uses to build its input, so all tests check the artefact that actually runs.
Every term in the course: glossary.
Check yourself
Answer in your head first, then open it.
Why does a parsed-model check miss a duplicated link name?
The parser stores links in a dictionary keyed by name, so the second silently overwrites the first. After parsing there is only one — and the tree looks fine.
What is wrong with a test that builds its URDF with slightly different arguments from the launch file?
It checks a description nobody runs. It can pass while the real one is broken.
Stretch
Sketch the change that would put the SO-101 into make lint: how check_description.sh should find vendor arms, which targets it should expand for each, and what it should do when the upstream description has not been fetched, as on a fresh CI runner.
Hint
describe.py has a targets() function, and test_so101_profile.py shows one way to handle a missing description without hiding it.