## 2 Materials and Methods
### Interaction Control
#### 2.1.1 Admittance Control  
In most interaction scenarios, the manipulator is required to have compliant behavior along specified workspace directions. Impedance control is usually adopted to achieve this goal with the idea to assign mass-spring-damper dynamics to the end-effector. In general, the impedance control scheme is designed so as to output joint accelerations, which are then used to retrieve torques through inverse dynamics. It follows that it cannot be used with position-controlled robots and _admittance control_ is used instead. It is characterized by an inner position control loop and an outer force loop, so that interaction and motion controls are decoupled. A modified workspace position reference, computed through the impedance control law, is generated, joint positions are retrieved through inverse kinematics and then sent to the robot position controller [30]. Let us consider a desired workspace task \(\mathbf{x}_{d}\in\mathbb{R}^{m}\) to be executed by a robotic arm with \(n\) joints and, for the sake of simplicity, neglect the orientation in the operational space assuming it to be fixed, with no torques generated at the end-effector, so that only the forces \(\mathbf{f}\in\mathbb{R}^{3}\) are taken into account. The relation, through a generalized mechanical impedance, between the vector of contact forces and the position error \(\tilde{\mathbf{z}}\in\mathbb{R}^{3}\) is given by the equation  
\[\mathbf{M}_{d}\tilde{\mathbf{z}}+\mathbf{K}_{D}\tilde{\mathbf{z}}+\mathbf{K}_ {P}\tilde{\mathbf{z}}=-\tilde{\mathbf{f}}, \tag{1}\]  
where the position error is computed as the difference between the desired reference and the commanded one \(\tilde{\mathbf{z}}=\mathbf{x}_{d}-\mathbf{x}_{c}\), while \(\mathbf{M}_{d}\), \(\mathbf{K}_{P}\), \(\mathbf{K}_{D}\), respectively, are the diagonal mass, stiffness, and damping matrices of appropriate dimensions, used to specify the dynamic behavior in the task space. The term \(\tilde{\mathbf{f}}=\mathbf{f}_{d}-\mathbf{f}_{e}\) is the force tracking error, where \(\mathbf{f}_{d}\) is the desired force and \(\mathbf{f}_{e}\) is the contact force applied by the manipulator on the environment. The latter is equal and opposite to the force measured by a force/torque sensor mounted at the robot's end-effector. At the steady state, (1) becomes  
\[\tilde{\mathbf{f}}=\mathbf{K}_{P}(\mathbf{x}_{c}-\mathbf{x}_{d}), \tag{2}\]while, making the hypothesis of elastic environment, the force applied by the manipulator can be expressed as \(\mathbf{f}_{e}=\mathbf{K}_{e}(\mathbf{x}_{c}-\mathbf{x}_{e})\), where \(\mathbf{K}_{e}\) and \(\mathbf{x}_{e}\) are the stiffness and the rest position of the environment, respectively. It follows that  
\[\mathbf{\hat{f}}=\mathbf{f}_{d}-\mathbf{K}_{e}(\mathbf{x}_{c}-\mathbf{x}_{e}). \tag{3}\]  
Obtaining \(\mathbf{x}_{c}\) from (3) and plugging it into (2), it can be derived that, as shown in [29; 31], the force error at the steady state \(\mathbf{\hat{f}}_{\mathrm{ss}}\) is  
\[\mathbf{\hat{f}}_{\mathrm{ss}}=\frac{\mathbf{K}_{P}}{\mathbf{K}_{P}+\mathbf{K }_{e}}[\mathbf{f}_{d}+\mathbf{K}_{e}(\mathbf{x}_{e}-\mathbf{x}_{d})]. \tag{4}\]  
From this equation, it can be observed that only by perfectly knowing the environment it is possible to have a zero force error, by carefully selecting \(\mathbf{K}_{P}\) and \(\mathbf{x}_{d}\). Otherwise, when the environment is unknown, the force reference is not reached and the error is subject to the imposed compliance. If one wants to control the contact force, variable impedance schemes can be used [27; 28; 29; 30; 31]. Computing \(\mathbf{\hat{z}}\) from (1) yields:  
\[\mathbf{\hat{z}}=\mathbf{M}_{d}^{-1}[-\mathbf{\hat{f}}-\mathbf{K}_{D}\mathbf{ \hat{z}}-\mathbf{K}_{P}\mathbf{\hat{z}}]. \tag{5}\]  
The control scheme is represented in Figure 2. This also is the implementation adopted in [29; 30].