## 4 Analysis of Inner Motion Loops
### The Stiffness Matrix  
In force control, the interaction forces may cause deviation of the end-effector from the nominal trajectory. There are two different reasons. First, the external forces produce mechanical deformation of the gears. Second, the external forces induce a deviation of the motors from their reference path. The first case depends on the mechanical robustness of the robot. The second case depends on the controller. The mechanical deformations occur in joint space. Regarding the controller, it can be implemented in both joint and cartesian space. The effect on the error will be different in the two cases. The joint stiffness matrix is defined as the relation between the deformation of the joints and the applied torque,  
\[\tau=K_{q}\Delta q, \tag{11}\]  
where \(\tau\) is the vector of motor torques, \(K_{q}\) is the diagonal stiffness matrix, and \(\Delta q\) is the vector of differences between actual joint and reference positions. The force control tasks are programmed in the cartesian space. Thus, for a good performance, it is crucial that the robot deviates from the nominal cartesian trajectory as little as possible. The cartesian  
Figure 2: Block schemes of operational space control (**a**) with Jacobian inverse and (**b**) with Jacobian transpose. stiffness matrix describes the relationship between the deformations and the force in all the cartesian directions. It is highly recommended to have higher stiffness in order to avoid errors. The opposite phenomenon of stiffness is called compliance. The robot cartesian stiffness matrix, \(K_{x}\), was first introduced in [PERSON], [PERSON] [36] as  
\[K_{x}=\mathbf{\gamma}^{-T}(q)\big{(}K_{q}\big{)}\mathbf{J}^{-1}(\mathbf{q}), \tag{12}\]  
where \(\mathbf{J}(\mathbf{q})^{-T}\) and \(\mathbf{J}(\mathbf{q})^{-1}\) are the Jacobian transpose and Jacobian inverse, respectively. Next equation relates the cartesian position deviations and the external force vector,  
\[\mathbf{f}=\mathbf{K}_{x}\mathbf{\Delta}\mathbf{x}. \tag{13}\]  
It should be noted that the Jacobian matrix of the robot depends on its position and, therefore, the cartesian stiffness matrix, too. In reference [37], researchers introduced the conservative congruence transformation--Equation (14)--giving an improved version of the cartesian stiffness matrix,  
\[\mathbf{K}_{x}=\mathbf{J}^{-T}(\mathbf{q})\big{(}K_{q}-K_{g}\big{)}\mathbf{J}^{-1}(\mathbf{q}), \tag{14}\]  
where \(\mathbf{K}_{g}=\left[\frac{\partial\mathbf{J}^{T}}{\partial\mathbf{q}_{h}\mathbf{f}}\right]\) is the additional stiffness term, caused by the variation of the Jacobian matrix and the external force vector. The part of the stiffness due to the mechanical deformation of the gears is called passive stiffness. It is always expressed in cartesian space. In this study, it is referred as joint stiffness. The part due to the deviations of the motors is called active stiffness and can be modified by the adequate adjustment of the controller. It can be expressed in cartesian or joint space, depending on the way the control is made. The works of [PERSON] [36] and [PERSON] and [PERSON] [37] were made for classical, rigid robots. These robots usually have only one position sensor per motor. It is located on the motor side and not in the link because the measured position has a higher resolution. It is assumed that the position of the motor and the link are equivalent. It is considered that there is no deformation of the gears, which may be corrected by the position control. However, in force control tasks, the deformations cannot be neglected. On the other hand, the robots with elastic joints usually have two position sensors (encoders) [38]. The first encoder is on the motor side, and the second one is on the link side, as shown in Figure 3.  
Figure 3: The joint module of the Light WeightRobot III, adapted from Institute of Robotics and Mechatronics of German Aerospace Center (Deutsches Zentrum für Luft-und Raumfahrt-DLR) [38].