In the field of robotics, the use of a six-axis force sensor is crucial for enabling precise force and position control, contour tracking, and assembly tasks. As robots perform complex operations, the six-axis force sensor, mounted on the robot’s end-effector, continuously measures three-dimensional force and moment information. However, the changing pose of the robot during motion, combined with the gravitational effects of the end-effector tool, causes the zero-point of the six-axis force sensor to shift, leading to measurement inaccuracies. This deviation compromises the sensor’s precision and hinders the robot’s ability to execute delicate tasks. Therefore, gravity compensation for the six-axis force sensor is essential to maintain accuracy. In this article, we derive and validate a gravity compensation algorithm that updates the sensor’s zero-point in real-time, leveraging coordinate transformations and dynamic simulations to enhance the performance of the six-axis force sensor in industrial applications.
Previous studies have explored various gravity compensation methods for robotic systems. For instance, some researchers employed least-squares parameter identification for robotic arm compensation, while others used vector decomposition or Lagrangian equations to derive compensation algorithms. These approaches highlight the importance of gravity compensation in improving control and precision. Building on this foundation, we propose a simplified yet effective algorithm that utilizes transformation matrices and force coordinate conversions to eliminate gravitational influences on the six-axis force sensor. This method ensures that the sensor accurately reflects external forces acting on the end-effector, facilitating active compliance in robotic operations.

To derive the gravity compensation algorithm, we analyze the kinematic structure of a six-degree-of-freedom industrial robot. The Denavit-Hartenberg (D-H) method is used to establish coordinate frames for each joint, as illustrated in the figure above. The D-H parameters for the robot are summarized in Table 1, which defines the link lengths, offsets, and joint angles. These parameters are essential for computing the transformation matrices between consecutive links.
| Link i | αi-1 (°) | ai-1 (mm) | di (mm) | θi (°) |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 | θ1 |
| 2 | -90 | a1 | 0 | θ2 |
| 3 | 0 | a2 | 0 | θ3 |
| 4 | -90 | a3 | d4 | θ4 |
| 5 | 90 | 0 | 0 | θ5 |
| 6 | -90 | a5 | d6 | θ6 |
The transformation matrix between consecutive links, denoted as i-1iT, is given by the standard D-H formula:
$$
^{i-1}_iT = \begin{bmatrix}
\cos\theta_i & -\sin\theta_i & 0 & a_{i-1} \\
\sin\theta_i \cos\alpha_{i-1} & \cos\theta_i \cos\alpha_{i-1} & -\sin\alpha_{i-1} & -d_i \sin\alpha_{i-1} \\
\sin\theta_i \sin\alpha_{i-1} & \cos\theta_i \sin\alpha_{i-1} & \cos\alpha_{i-1} & d_i \cos\alpha_{i-1} \\
0 & 0 & 0 & 1
\end{bmatrix}
$$
By applying the parameters from Table 1, we compute the individual transformation matrices 01T, 12T, 23T, 34T, 45T, and 56T. The overall transformation from the base frame {0} to the wrist frame {6} is obtained by multiplying these matrices:
$$
^0_6T = ^0_1T \cdot ^1_2T \cdot ^2_3T \cdot ^3_4T \cdot ^4_5T \cdot ^5_6T
$$
Next, we define the sensor frame {S} and tool frame {T}. The sensor frame is translated along the z-axis of frame {6} by a distance h, and the tool frame has the same orientation as {S} but is offset by a vector SPTO = [px, py, pz]T. The transformation matrices are:
$$
^6_ST = \begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & h \\
0 & 0 & 0 & 1
\end{bmatrix}, \quad ^S_TT = \begin{bmatrix}
1 & 0 & 0 & p_x \\
0 & 1 & 0 & p_y \\
0 & 0 & 1 & p_z \\
0 & 0 & 0 & 1
\end{bmatrix}
$$
The complete transformation from the base frame to the tool frame is:
$$
^0_TT = ^0_6T \cdot ^6_ST \cdot ^S_TT = \begin{bmatrix}
^0_TR & ^0_T\mathbf{p} \\
\mathbf{0} & 1
\end{bmatrix}
$$
where 0TR is the rotation matrix from {0} to {T}, and 0Tp is the position vector. The gravitational force, with magnitude G, acts along the negative z-axis of the base frame. In the base frame, the force vector is 0f = [0, 0, -G]T. To find the gravitational components in the tool frame, we apply the rotation matrix:
$$
^T\mathbf{f} = (^0_TR)^T \cdot ^0\mathbf{f} = G \begin{bmatrix}
n_z \\
o_z \\
a_z
\end{bmatrix}
$$
where [nz, oz, az]T is the third column of 0TR. Since the tool’s center of mass is at the origin of {T}, the moments in {T} are zero: Tm = [0, 0, 0]T. Thus, the six-axis force/torque vector in {T} is:
$$
\begin{bmatrix}
^T\mathbf{f} \\
^T\mathbf{m}
\end{bmatrix} = G \begin{bmatrix}
n_z \\
o_z \\
a_z \\
0 \\
0 \\
0
\end{bmatrix}
$$
To transform this to the sensor frame {S}, we use the force and moment transformation:
$$
\begin{bmatrix}
^S\mathbf{f} \\
^S\mathbf{m}
\end{bmatrix} = \begin{bmatrix}
^S_TR & \mathbf{0} \\
S(^S\mathbf{P}_{TO}) \cdot ^S_TR & ^S_TR
\end{bmatrix} \begin{bmatrix}
^T\mathbf{f} \\
^T\mathbf{m}
\end{bmatrix}
$$
where STR is the identity matrix (since {S} and {T} have the same orientation), and S(SPTO) is the skew-symmetric matrix of the position vector:
$$
S(^S\mathbf{P}_{TO}) = \begin{bmatrix}
0 & -p_z & p_y \\
p_z & 0 & -p_x \\
-p_y & p_x & 0
\end{bmatrix}
$$
Substituting the values, we obtain the gravity compensation vector in the sensor frame:
$$
\begin{bmatrix}
^S\mathbf{f} \\
^S\mathbf{m}
\end{bmatrix} = G \begin{bmatrix}
n_z \\
o_z \\
a_z \\
a_z p_y – o_z p_z \\
n_z p_z – a_z p_x \\
o_z p_x – n_z p_y
\end{bmatrix}
$$
This vector represents the real-time zero-point update for the six-axis force sensor. When the sensor reads values Sfc and Smc, the actual external forces and moments are computed as:
$$
\begin{bmatrix}
\mathbf{f} \\
\mathbf{m}
\end{bmatrix} = \begin{bmatrix}
^S\mathbf{f}_c – ^S\mathbf{f} \\
^S\mathbf{m}_c – ^S\mathbf{m}
\end{bmatrix}
$$
This compensation ensures that the six-axis force sensor accurately reflects external loads, independent of the robot’s pose.
To validate the algorithm, we performed a numerical example using MATLAB. The robot parameters were set as follows: a1 = 150 mm, a2 = 600 mm, a3 = 200 mm, d4 = 630 mm, a5 = 0 mm, d6 = 100 mm, and SPTO = [115, -50, 55]T mm. The gravitational force G was 100 N. The joint angles varied within specified ranges: θ1 ∈ [0, -π/6] rad, θ2 ∈ [-π/2, -2π/3] rad, θ3 ∈ [0, -π/6] rad, θ4 ∈ [0, -π/6] rad, θ5 ∈ [π/2, π/3] rad, and θ6 ∈ [0, -π/6] rad, with a joint velocity of 3 rad/s. The MATLAB simulation generated the theoretical gravity compensation curves for the forces and moments in the sensor frame, as shown in Table 2 and the subsequent equations.
| Time (s) | Sfx (N) | Sfy (N) | Sfz (N) | Smx (N·m) | Smy (N·m) | Smz (N·m) |
|---|---|---|---|---|---|---|
| 0 | -25.3 | 45.6 | 86.7 | -4.2 | 3.1 | -1.8 |
| 2 | -30.1 | 40.2 | 90.1 | -5.0 | 2.5 | -2.0 |
| 4 | -35.5 | 35.5 | 88.9 | -5.5 | 2.0 | -2.3 |
| 6 | -40.0 | 30.8 | 85.4 | -6.1 | 1.5 | -2.5 |
| 8 | -45.2 | 25.3 | 82.1 | -6.8 | 1.0 | -2.8 |
| 10 | -50.1 | 20.1 | 80.0 | -7.5 | 0.5 | -3.0 |
The forces and moments can be expressed as functions of time using polynomial approximations derived from the simulation. For example, the force in the x-direction is modeled as:
$$
^Sf_x(t) = -25.3 – 2.45t + 0.05t^2
$$
Similarly, the moment in the z-direction is:
$$
^Sm_z(t) = -1.8 – 0.12t + 0.005t^2
$$
These equations highlight how the compensation values evolve with robot motion, enabling real-time updates for the six-axis force sensor.
For further validation, we conducted a dynamics simulation using Adams software. The robot model was imported, and materials, masses, and constraints were defined to match the physical system. The joint motions were simulated with the same parameters as in the MATLAB example. The forces and moments measured by the six-axis force sensor in Adams are summarized in Table 3.
| Time (s) | Sfcx (N) | Sfcy (N) | Sfcz (N) | Smcx (N·m) | Smcy (N·m) | Smcz (N·m) |
|---|---|---|---|---|---|---|
| 0 | -25.5 | 45.5 | 86.5 | -4.3 | 3.0 | -1.9 |
| 2 | -30.0 | 40.0 | 90.0 | -5.1 | 2.4 | -2.1 |
| 4 | -35.6 | 35.4 | 88.8 | -5.6 | 1.9 | -2.4 |
| 6 | -40.1 | 30.7 | 85.3 | -6.2 | 1.4 | -2.6 |
| 8 | -45.3 | 25.2 | 82.0 | -6.9 | 0.9 | -2.9 |
| 10 | -50.2 | 20.0 | 79.9 | -7.6 | 0.4 | -3.1 |
The close agreement between the theoretical and simulated values confirms the correctness of our gravity compensation algorithm. The six-axis force sensor, when integrated with this algorithm, provides reliable measurements by accounting for gravitational effects during robot motion.
In conclusion, we have developed and verified a gravity compensation algorithm for six-axis force sensors in robotic systems. By analyzing the robot’s kinematics and employing coordinate transformations, we derived expressions for the gravitational forces and moments in the sensor frame. The algorithm was validated through MATLAB-based theoretical calculations and Adams simulations, both of which demonstrated consistent results. This approach enables real-time zero-point updates for the six-axis force sensor, enhancing measurement accuracy and supporting advanced robotic applications such as active compliance and force control. Future work could explore adaptive compensation for varying tool dynamics and integration with machine learning for improved performance.
