Joint Wrench Sensor#
The joint wrench sensor reports incoming joint reaction wrenches for selected
articulation bodies. It exposes force [N] and torque [N·m] buffers separately,
with entries ordered by the sensor’s body_names.
The default convention is incoming_joint_frame, which expresses each wrench
in the child-side joint frame at the child-side joint anchor.
The sensor is configured on an articulation prim and can then be used directly
or through manager terms such as body_incoming_wrench().
For example, the Ant environment adds a joint wrench sensor to the scene:
# robot
robot = ANT_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
# sensors
joint_wrench = JointWrenchSensorCfg(prim_path="{ENV_REGEX_NS}/Robot")
The same environment uses SceneEntityCfg to select
the reported foot bodies for an observation term:
feet_body_forces = ObsTerm(
func=mdp.body_incoming_wrench,
scale=0.1,
params={
"sensor_cfg": SceneEntityCfg(
"joint_wrench",
body_names=["front_left_foot", "front_right_foot", "left_back_foot", "right_back_foot"],
)
},
)
Direct access to the sensor data follows the usual scene lookup pattern.
joint_wrench = scene["joint_wrench"]
foot_ids, _ = joint_wrench.find_bodies([".*foot"])
force = joint_wrench.data.force.torch[:, foot_ids]
torque = joint_wrench.data.torque.torch[:, foot_ids]
wrench = torch.cat((force, torque), dim=-1)
The resulting wrench tensor has shape (num_envs, num_selected_bodies, 6)
and stores the force components followed by the torque components for each
selected body.