# Modeling and Compensation of Motion Errors for 6-DOF Robotic Manipulators
## 3 Trajectory Compensation Based on Stiffness Modeling
### Construction of the Jacobian Matrix  
The Jacobian matrix was mainly employed in the velocity/static mapping between the manipulator end and the joint. In essence, it is a partial differential matrix. The number of rows represents the free degree of space (X, Y, Z, \(\alpha\), \(\beta\), and \(\gamma\)), and the number of columns represents the number of physical rotational axes of the robot. The Jacobian matrix \(J(q)\) can be regarded as the linear relationship between the joint velocity and the manipulator space velocity or the linear relationship between the joint variable and the end deformation, which can be obtained as follows:  
\[\left[\begin{array}{c}v\\ \omega\end{array}\right]=\left[\begin{array}{cccc}J_{11}&J_{22}&\dots&J_{ ln}\\ J_{a1}&J_{a2}&\dots&J_{an}\end{array}\right]\left[\begin{array}{c}q_{1}\\ q_{2}\\ \vdots\\ q_{n}\end{array}\right] \tag{3}\]  
where \(v\) represents the linear velocity of the end of the manipulator and \(\omega\) represents the angular velocity of the end. Therefore, the linear velocity \(v\) and angular velocity \(\omega\) of the robotic end can be expressed in terms of the joint velocity \(q_{i}\):  
\[\left\{\begin{array}{c}v=J_{1i}q_{1}+J_{2i}q_{2}+\dots+J_{ln}q_{n}\\ \omega=J_{a1}q_{1}+J_{a2}q_{2}+\dots+J_{an}q_{n}\end{array}\right. \tag{4}\]  
where \(J_{li}\) and \(J_{ai}\) represent the linear velocity and angular velocity, respectively, of the end caused by the unit joint velocity of joint \(i\).  
The Jacobian matrix connects the joint velocity with the end Cartesian velocity:  
\[J(q)\dot{q}=\left[\begin{array}{c}v\\ \omega\end{array}\right] \tag{5}\]  
where \(v\) and \(w\) are the linear velocity and angular velocity, respectively, and \(q\) is the joint velocity vector. Since velocity can be taken as the differential motion per unit time, the Jacobian matrix can also be considered as the transformation matrix between the differential motion in joint space and the differential motion in operating space, namely,  
\[J(q)dq=\left[\begin{array}{c}d\\ \delta\end{array}\right] \tag{6}\]  
where \(d\) and \(\delta\) are the differential movement and rotation at the end, respectively, and \(dq\) is the joint differential motion vector.  
For joint \(i\), the angular velocity \(\omega\) at the end is  
\[\omega=\sum_{i=1}^{n}(\bar{\varepsilon}_{i}z_{i})\dot{q}_{i} \tag{7}\]  
where \(q_{i}\) represents the angle of the joint, \(z_{i}\) is the representation of the \(z\)-axis unit vector of frame \(\{i\}\) in the base frame \(\{0\}\), \(n\) is the number of joints of the manipulator, and \(\varepsilon\) is a coefficient, which will be explained in Equation (8).  
The linear velocity \(v\) generated by joint \(i\) at the end is  
\[v=\sum_{i=1}^{n}\left[\varepsilon_{i}z_{i}+\overline{\varepsilon}_{i}\left(z_{i} \times p_{in}^{0}\right)\right]q_{i} \tag{8}\]  
where \(\overline{\varepsilon}_{i}=1-\varepsilon_{i}\); if joint \(i\) is revolute, \(\varepsilon=0\), and if joint \(i\) is prismatic, \(\varepsilon=1\) (the joints of the manipulator in this paper are all revolute). \(p_{in}^{0}\) represents the position vector of the end origin relative to the coordinate system \(\{i\}\) in the base system \(\{0\}\), namely,  
\[p_{in}^{0}={}_{i}^{0}R*p_{in} \tag{9}\]  
Therefore, for joint \(i\) of the rotation, the \(i\)-th column of the Jacobian matrix is  
\[J_{i}=\left[\begin{array}{c}z_{i}\times p_{in}^{0}\\ z_{i}\end{array}\right]=\left[\begin{array}{c}z_{i}\times\binom{0}{i}R*p_{in} \\ z_{i}\end{array}\right] \tag{10}\]  
where \({}^{0}R\) represents the rotation matrix of joint \(0\) transformed to joint \(i\).  
The Jacobian matrix of the manipulator can be calculated according to the formulas in this section.