rclpy. You give them a callable to publish with and a cache to
read from, so they work in a plain test with no ROS installed.
ROS2FollowerAdapter
JointRanges
required
How far each joint travels, in your topic’s own units. This is what converts
those values to the wire and back. See below.
callable
required
Called with
{joint: value} every time a command is applied. Wire it to your
publisher.cache
Where the adapter reads current joint positions from. Fill it from your
subscription callback. Leave it out to run open-loop.
float
default:"0.5"
How old a topic sample may be before it counts as stale.
int
default:"100"
The loop rate, and the rate announced to the leader.
str
default:"ros2"
A name for this machine, used in logs and the recording.
ROS2LeaderAdapter
ranges and latest, with no sink, since a leader never writes.
float
default:"0.0"
Ignore movements smaller than this, so a controller sitting still does not
send noise.
Joint ranges
Give it the travel of each joint, in whatever units your topics already carry.On an SO-101 you can read these from the calibration instead of typing them.
See SO-101.
Wiring it up
sink is called with the values to publish, and latest is where you put what
you receive.
run() here and no thread of
the SDK’s own.
Behaviour
read_joints() never raises. If the topic goes quiet it falls back to the last
value it wrote, then to a neutral pose, rather than failing.
torque_enable() does nothing. The bridge holds the arm by going quiet and
letting your driver’s own watchdog take over, since it has no power control of
its own.
Related
Follower
The base class these subclass, and everything they inherit.
ROS 2
The bridge node these two feed, and every parameter it takes.