rclpy. You hand them a function to publish through and an
object to read from, and they take care of the session, safety and correlation.
ROS2FollowerAdapter
Runs on the machine with the robot.callable
required
Called with
{joint: value} whenever a command is applied. Publish from it.object
Where the adapter reads the arm’s current position. Your subscription fills
it. Leave it out to run without feedback.
float
default:"0.5"
How old a reading 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 recordings.
ROS2LeaderAdapter
Runs on the machine with the controller. Sameranges 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
How far each joint travels, in whatever units your topics already carry. This is what turns your values into something the other machine can read, and back.On an SO-101 you can read these from the calibration instead of typing them.
See SO-101.
Example
A follower node in full. Your subscription hands the arm’s position to the adapter, and the adapter hands commands back to your publisher.run() here.
Latest is a small object of your own with two methods, put(values) and
get() -> (values, age_seconds). The runnable example below has one you can
copy.
Runnable example
This node in full, about a hundred lines, ready to run.
read_joints() never raises. If the topic goes quiet it falls back to the
last value it wrote, so a silent driver cannot take your node down.Related
Follower
The base class these subclass, and everything they inherit.
ROS 2
The bridge node these two feed, and every parameter it takes.