I have heard the term wrench many times whether in
- the estimated external wrench from libfranka: C++ library for Franka Robotics research robots API,
- the Modern Robotics: Mechanics, Planning, and Control textbook, or
- the MIT 6.421 Robotic Manipulation: Perception, Planning, and Control course by Russ Tedrake.
It kept showing up everywhere, and this time I finally nailed it. In this post, I will explain what a wrench is using both a textbook problem and two real experiments on a Franka Research 3.
📝Definition
RemarkThere are several ways to define a wrench (also called a spatial force). Here I follow the convention from Modern Robotics: Mechanics, Planning, and Control because its diagrams and notation make transformation easy to visualize.
Consider a linear force acting on a rigid body at a point . Once we choose a reference frame , the point’s coordinates from the origin of are , and the force vector is . This force creates a torque(or moment) about the origin of :
Just as we combine angular and linear velocity into a 6D twist, we can stack the moment and force into a single 6-dimensional wrench expressed in the frame, denoted :
© Modern Robotics
TipI love Russ Tedrake’s analogy: the twists and wrenches both pair a rotational part with a translational part. For a wrench, the rotational part is torque and the translational part is linear force.
To express the same wrench in another frame , let be the homogeneous transformation matrix of relative to . Because mechanical power is coordinate-independent, Proposition 3.27 in Modern Robotics: Mechanics, Planning, and Control shows that wrenches transform between frames using the transpose of the adjoint representation of rigid-body transformation:
and is the skew-symmetric matrix satisfying .
🗃Example
Next, let’s walk through 3 examples, one from the textbook and two on real robot hardware, to see how wrenches work in practice.
📁Textbook Example from Modern Robotics
This is the Example 3.28. from Modern Robotics: Mechanics, Planning, and Control.
© Modern Robotics
In the figure above, a robot hand with a mass of 0.5 kg holds an apple with a mass of 0.1 kg. Gravity (rounded for simple arithmetic) acts downward on the page. The link lengths are and .
We define 3 reference frames: at the force-torque sensor, at the hand’s center of mass, and at the apple’s center of mass.
💬Question What force and torque are measured by the six-axis force-torque sensor between the hand and the robot arm?
🏹Strategy There are 2 ways to find the wrench at frame :
- Since a wrench is just a 6-vector of 3 moments and 3 forces, we can compute the forces and lever-arm torques separately using basic statics.
- Or we can use the adjoint representation of rigid-body transformation (Proposition 3.27) to transform each gravitational wrench into and sum them up.
Let’s use the 2nd method. Our goal is to compute the net gravitational wrench acting on the hand-and-apple system in :
which transforms from to and from to before adding them together.
1️⃣ Write down and
Gravity acts purely at each center of mass, so neither object experiences a gravitational moment about its own center-of-mass frame. Following the axis directions in the figure, the gravitational wrench on the hand ( along ) is the column vector:
Similarly, since points downward, the gravitational wrench on the apple ( along ) is:
2️⃣ Find and
Remember that transforming a wrench from to via requires —the pose of measured in . Given and :
3️⃣ Calculate in Julia
using LinearAlgebra
skew(v) = [ 0 -v[3] v[2];
v[3] 0 -v[1];
-v[2] v[1] 0 ]
function adjoint(T)
R = T[1:3, 1:3]
p = T[1:3, 4]
return [R zeros(3, 3);
skew(p)*R R ]
end
T_hf = [1 0 0 -0.1;
0 1 0 0;
0 0 1 0;
0 0 0 1]
T_af = [1 0 0 -0.25;
0 0 1 0;
0 -1 0 0;
0 0 0 1]
Ad_T_hf = adjoint(T_hf)
Ad_T_af = adjoint(T_af)
F_h = [0, 0, 0, 0, -5, 0]
F_a = [0, 0, 0, 0, 0, 1]
# the Ad_T_hf' is the transpose of Ad_T_hf
F_f = Ad_T_hf' * F_h + Ad_T_af' * F_aRunning the script gives:
6-element Vector{Float64}:
0.0
0.0
-0.75
0.0
-6.0
0.0So the net gravitational wrench acting on the sensor frame is:
TipTo hold the hand and apple in static equilibrium, the robot arm exerts the equal and opposite wrench on the hand.
📩Manually Validating Wrench in libfranka
In the apple example, we started with known masses and predicted what a wrist sensor would read. Now let’s work from a real recording. Here, a Franka Research 3 has grasped the 3D-printed block and is holding it above an optical table. Using its joint torque sensors and internal dynamics model, the robot reports an estimated external wrench in 2 different frames:
-
O_F_ext_hat_K: the external wrench expressed in the base frame . -
K_F_ext_hat_K: the external wrench expressed in the stiffness frame .
Because the robot gives us both, we can transform into ourselves and verify our math directly against .
💬 Question Given and the robot’s pose from franka_ros2: ROS 2 integration for Franka research robots, can we compute so that ?
🏹 Strategy
Using the same adjoint wrench transformation as before (denoting and for short):
All we need from the robot state message are and .
1️⃣ Which fields should we inspect?
| Symbol | Meaning in this example | Field in franka_ros2 |
|---|---|---|
| 6D wrench about the origin, in axes | k_f_ext_hat_k.wrench | |
| Base-frame 6D wrench we want to reproduce | o_f_ext_hat_k.wrench | |
| End-effector frame pose in base frame | o_t_ee.pose | |
| Stiffness frame pose in end-effector frame | ee_t_k.pose |
Remarkis the robot base frame, is the end-effector frame, and is the stiffness frame attached to the tool.
2️⃣Read the wrench values in franka_ros2
{
"wrench": {
"force": {
"x": 1.4548066854476929,
"y": -2.1362175941467285,
"z": 1.833638072013855
},
"torque": {
"x": -0.9619402885437012,
"y": 0.5624399781227112,
"z": 0.14742685854434967
}
}
}In Modern Robotics order (), this is:
{
"wrench": {
"force": {
"x": 1.757339596748352,
"y": 1.9453562498092651,
"z": -1.7802985906600952
},
"torque": {
"x": -1.3314000368118286,
"y": 0.48174265027046204,
"z": 0.5212849378585815
}
}
}We write the ground-truth base wrench as:
3️⃣ Read the frame transformation from franka_ros2
EE_T_K :
{
"pose": {
"position": {
"x": 0,
"y": 0,
"z": 0
},
"orientation": {
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
}
}This is the identity transform (), meaning the stiffness frame coincides with the end-effector frame .
{
"pose": {
"position": {
"x": 0.46695610880851746,
"y": 0.10892454534769058,
"z": 0.07038187235593796
},
"orientation": {
"x": 0.9983684596516972,
"y": -0.04724302407225961,
"z": 0.03022007656759094,
"w": 0.010735766483374817
}
}
}Changing the frames gives
Converting the position vector and unit quaternion into an homogeneous transformation matrix and taking its inverse yields:
4️⃣ Compute the base-frame wrench in Julia
With all inputs ready, we evaluate:
at full recorded floating-point precision:
using LinearAlgebra
function quat_to_T(q; p)
w, x, y, z = q ./ norm(q)
R = [1-2(y^2+z^2) 2(x*y-z*w) 2(x*z+y*w);
2(x*y+z*w) 1-2(x^2+z^2) 2(y*z-x*w);
2(x*z-y*w) 2(y*z+x*w) 1-2(x^2+y^2)]
T = Matrix{Float64}(I, 4, 4)
T[1:3, 1:3] = R
T[1:3, 4] = p
return T
end
skew(v) = [0 -v[3] v[2]; v[3] 0 -v[1]; -v[2] v[1] 0]
function mr_adjoint(T)
R = T[1:3, 1:3]
p = T[1:3, 4]
return [R zeros(3, 3); skew(p)*R R]
end
F_k = [-0.9619402885437012, 0.5624399781227112, 0.14742685854434967,
1.4548066854476929, -2.1362175941467285, 1.833638072013855]
q_wxyz = [0.010735766483374817, 0.9983684596516972,
-0.04724302407225961, 0.03022007656759094]
p = [0.46695610880851746, 0.10892454534769058, 0.07038187235593796]
T_ok = quat_to_T(q_wxyz; p=p)
T_ko = inv(T_ok)
F_o_cal = mr_adjoint(T_ko)' * F_k
# Compare with the second representation in the same robot-state message.
F_o_recorded = [-1.3314000368118286, 0.48174265027046204, 0.5212849378585815,
1.757339596748352, 1.9453562498092651, -1.7802985906600952]
@assert isapprox(F_o_cal, F_o_recorded; rtol=1e-6)
println(round.(F_o_cal; digits=6))5️⃣ Compare our calculation with ground truth
Our calculated base-frame wrench is
which matches the recorded franka_ros2 value to 6 decimal places:
🗂Using the Wrench to Estimate Object Weight
For one more hands-on test with libfranka, I wanted to see how accurate the Franka’s joint-torque-based wrench estimate really is.
| Grasped | Released |
|---|---|
![]() | ![]() |
💬Question
When the gripper releases the block, can we estimate the block’s mass from the change in the estimate force?
✏Solution
To reduce sensor noise variance, I averaged O_F_ext_hat_K.wrench.force component by component from the MCAP logs in the robot’s base frame , where points upward:
| State | Samples | Jaw opening | Mean X | Mean Y | Mean Z |
|---|---|---|---|---|---|
| Holding | 4,000 | 28.54 mm | +0.52179 | −0.07921 | +1.52044 |
| Released | 2,000 | 50.00 mm | +0.54184 | −0.07974 | +1.20580 |
| Difference | −0.02005 | +0.00053 | +0.31464 |
TipThe documentation on the sign of
O_F_ext_hat_Kis confusing. Here’s my tl;dr way of thinking about it, with the robot base frame axes shown as follows:In short, the force in
O_F_ext_hat_Kis the force vector the robot exerts on the environment, expressed in the base frame .For example, when the weight of the block pulls the gripper downward, the robot must exert an upward force () to support it, giving .
Dividing by gravitational acceleration gives the estimated mass:
I brought the block back to my dorm and put it on the kitchen scale I use to weigh my breakfast. It read 36g. Being with () using only arm joint torque sensors, with no dedicated wrist force–torque sensor, is pretty impressive!😲


