Kinematics
Some observation terms need to know where the links of the robot are: the orientation of the pelvis when the IMU sits on the torso, or the position of a hand. Instead of every term loading the robot description and tracking the joints on its own, the framework offers one shared model.
kinematics:
enabled: true
joints: [] # empty: every movable joint not in excluded_joints
excluded_joints: [] # joints locked at zero; not with joints
What it is
Kinematics is a Pinocchio model of the
whole robot, built from the robot description (URDF). Given the joint positions and
velocities it computes, for every link:
its pose relative to the root link of the URDF, or relative to any other link;
its velocity.
The model has a fixed base: it knows how the links are placed relative to each other, not where the robot is in the world. The world is brought in by the IMU: two helpers combine an IMU measurement with the model to answer what would this IMU measure if it were mounted on that other link?
world_orientation(frame, imu_frame, imu_orientation)The orientation of a link in the world.
world_angular_velocity(frame, imu_frame, gyroscope)The angular velocity of a link relative to the world, expressed in the link’s own axes, with the motion of the joints between the IMU and that link accounted for.
frame and imu_frame are indices returned by frame(link), looked up once while
configuring.
Who feeds it
When enabled, the joints of the model are registered as state entries
(<joint>/position and <joint>/velocity), so the controller claims those that no input
source provides as state interfaces and the node expects them from an input source. The host updates the model from
those entries: the controller on every update, the node on every tick, once every joint
position and velocity has been received.
If only some joints have a state, either list them in joints or list the others in
excluded_joints, whichever is shorter; set one, not both. Joints left out are locked at
zero: the links past them are placed as if the joint were at zero, so only exclude joints
whose links no policy reads, or that really stay at zero.
Who reads it
Policy plugins receive the model in their configuration context (ctx.kinematics). They
look up the links they need once, while configuring, and read poses during the cycle.
SafetyCheck plugins receive the host model the same way; input sources and executors get
none.
Other code can read it too, through PolicyController::kinematics(). Reading and updating
are protected by a real-time mutex: the update never waits (if a reader holds the lock, that
one update is skipped and the next one catches up), and a reader only holds the lock for the
time of a copy.
One model or two
A policy step must read frames that belong to the joint state it is reading. When the step
runs in the control loop that is automatic. With async_inference the step runs in
another thread on a snapshot of the state, while the control loop moves on. The framework
then keeps two models:
A term therefore never has to think about threads: the model it was given always matches the state it is given.
Current limitations
No position or linear velocity of the base in the world. That needs a state estimator.
Joints must be revolute, continuous or prismatic. Lock the others by adding them to
excluded_joints(or by leaving them out ofjoints).