Improved impedance/admittance switching controller for the interaction with a variable stiffness environment

Hybrid impedance/admittance control aims to provide an adaptive behavior to the manipulator in order to interact with the surrounding environment. In fact, impedance control is suitable for stiff environments, while admittance control is suitable for soft environments/free motion. Hybrid impedance/admittance control, indeed, allows modulating the control actions to exploit the combination of such behaviors. While some work has addressed the proposed topic, there are still some open issues to be solved. In particular, the proposed contribution aims: (i) to satisfy the continuity of the interaction force in the switching from impedance to admittance control when a feedforward velocity term is present; and (ii) to adapt the switching parameters to improve the performance of the hybrid control framework to better exploit the properties of both impedance and admittance controllers. The proposed approach was compared in simulation with the standard hybrid impedance/admittance control in order to show the improved performance. A Franka EMIKA panda robot was used as a reference robotic platform to provide a realistic simulation.


Context
Compliant control [1] has been widely employed to establish a stable and controlled interaction between a robot and the surrounding environment. While different implementations and approaches can be found in the state-of-the-art to deal with different applications [2][3][4] , impedance and admittance controllers [5] are the most investigated strategies to deal with (partially) unknown environments [6][7][8] . While impedance control is suitable to control the interaction between the robot and a stiff environment, admittance control performs better when the robot interacts with a soft environment [9] . Indeed, a control framework capable of combining both controllers would improve the interaction control performance. It would allow switching between the right behavior for the interaction control considering soft environments (or free motion phases, in which the environment stiffness can be considered null) and for the interaction control considering stiff environments. Even though the modulation of such control behaviors has been addressed by the variable impedance control (i.e., to tune the controller parameters to deal with different environments/task phases [10,11] ), hybrid control frameworks have also been developed to combine the capabilities of both impedance and admittance controllers. In the following, the state-of-the-art hybrid controllers are analyzed to highlight the related open issues.

Related works
The complementary performance of impedance and admittance controllers is qualitatively shown in Figure 1. A hybrid controller that combines the behaviors of both impedance and admittance control would result in improved interaction control performance and would allow implementing a generalized interaction controller capable of dealing with any interaction environment.
Ott et al. [12] summarized the hybrid control framework in [12,13] , which enhances the performance of interaction control in the whole spectrum of environment stiffness values. The proposed approach consists of applying the impedance and admittance controllers alternatively by exploiting a switching mechanism defined by a switching period parameter (which is the time the impedance control and the admittance control are alternatively applied to the robot controller) and by a duty cycle parameter ∈ [0, 1] (that determines the portion of assigned to the impedance and the admittance controllers, (1 − ) and , respectively). Simulated and experimental results were provided for a one-degree-of-freedom (DoF) robot. Successively, Cavenago et al. [14] and Mei et al. [15] applied the hybrid control framework on a simulated 2 DoF robot. Cavenago et al. [14] introduced a neural network (NN) for the choice of , considering as an input to the NN the robot position and velocity and the external forces, while Mei et al. [15] introduced a damping term into the model of the environment. In addition, the optimal duty cycle parameter is identified as a function of the environmental stiffness and damping parameters. This showed how the optimal is not associated with the external stiffness in a unique way. Izadbakhsh et al. [16] proposed an adaptive impedance controller using function approximation techniques where the system uncertainties are represented as basis functions and the aim is to converge to target impedance parameters with lower computational requirements. Other approaches have been proposed for the definition of a hybrid controller, such as the event-based hybrid controller by Yang et al. [17] or the Maxwell model-based controller proposed by Fu et al. [18] . However, the performance achieved by such approaches is not comparable to the ones achieved by the switching logic-based approaches. This paper aims to modify the approach of Ott et al. [13] in order to further improve its performance. In particular, considering the approaches in [13][14][15] , the inertia parameters of the models considered for the robot simulation were of the order of 1 kg. Moreover, the 2 DoF controlled robot in [14,15] moved in the neighborhood of its equilibrium position, i.e., where the inertia matrix M (q) of the robot can be considered as constant. However, the inertia parameter affects the definition of the switching parameter and the duty cycle . Indeed, the adaptation of such parameters as a function of the robot inertia needs to be considered in order to optimize the performance of the hybrid controller (i.e., the combined behavior of impedance and admittance controllers). In addition, the improvement of the switching conditions (from impedance to admittance control) can be ad-

Environment Stiffness
Performance Ideal hybrid control Admittance ctrl. Impedance ctrl. dressed in order to guarantee the continuity (i.e., the smoothness) of the interaction force. The main goal of the proposed paper is to address these issues.

Paper Contribution
Based on the discussion provided in the previous section, the main goals of the proposed paper are as follows: (i) Satisfy the continuity of the interaction force in switching from impedance to admittance control when a feedforward velocity term is present. (ii) Adapt the switching parameters to improve the performance of the hybrid control framework, thus better exploiting the properties of both impedance and admittance controllers.
While Aim (i) is addressed by the definition of proper initialization conditions at the switching time from impedance to admittance control taking into account a feedforward velocity term; Aim (ii) is addressed by adapting the switching parameters on the basis of the resulting robot inertia parameter (for the adaptation of the switching parameter ) and the environment stiffness parameter (for the adaptation of the duty cycle ).
The implemented methodologies were evaluated in simulation in Matlab, making use of a Franka EMIKA panda robot as a reference robotic platform, comparing the achieved results with respect to the standard method, which uses fixed and an adaptation law for as Ott et al. [13] , to demonstrate the improved performance (i.e., improved performance of the combined impedance/admittance controllers during interaction with a variable stiffness environment).

Paper outline
The paper is structured as it follows. Section 2 describes the hybrid controller of Ott et al. [13] , together with the low-level controller (i.e., impedance and admittance controllers). Section 3 introduces the modified hybrid control framework in order to deal with the discussed open issues of the state-of-the-art. Section 4 shows the achieved results of the proposed modified hybrid controller with respect to the one using fixed and an adaptation law for as in Ott et al. [13] . Section 5 states the conclusions of the paper.

HYBRID IMPEDANCE-ADMITTANCE CONTROLLER
Impedance and admittance controllers are two well-known strategies that are used to assign a specified dynamic behavior to a robot interacting with the surrounding environment. Both controllers aim to impose a target dynamic behavior on the controlled manipulator, as described by the following expression [19] : where M is the diagonal inertia matrix, D is the diagonal damping matrix, K is the diagonal stiffness matrix, e = x − x 0 (with x the measured end-effector pose and x 0 the setpoint), and F is the external interaction wrench acting on the robot. x is defined as the set of coordinates x satisfying Equation (1).
While impedance control is exploited in the interaction with stiff environments, admittance control is exploited in the interaction with soft environments (or in the case of free-motion tasks). Hybrid controllers, therefore, aim to combine the performance of both strategies to unify their behaviors into one control strategy, suitable for all interaction conditions.
In the following, the definition of impedance and admittance controllers is recalled, together with the definition of the hybrid controller.

Robot dynamics modeling and control design
To design the impedance and admittance controllers, the robot dynamics can be modeled as follows [19] : where q, q, and q are, respectively, the joint position, velocity, and acceleration vectors, M(q) is the inertia matrix, C(q, q) is the Coriolis and centrifugal matrix, G(q) is the gravitational vector, and is the joint friction torques vector. represents the external interaction projected in the joint space (i.e., external interaction torques).
is the control torque vector, which is computed based on the impedance (i.e., ) or the admittance (i.e., ) control strategy, in addition to the following robot dynamics compensation term : where F is defined as the impedance (i.e., F ) or the admittance (i.e., F ) control force.

Impedance control
The Cartesian impedance control can be defined as it follows [19] : M (q) and C (q, q) are defined as in Equation (5) and in Equation (6), respectively: where J defines the Jacobian matrix and † its pseudo-inverse. The impedance control torque is then defined as follows:

Admittance control
The admittance control generates a position reference x to be tracked by an inner position controller based on the following target dynamics [19] , slightly modifying the controller in Equation (1): where e = x − x 0 is the tracking error of the admittance controller. The computed position reference x is then sent to the inner position controller to perform the tracking of the position error x − x , providing the admittance control wrench F : where K and K are the inner position control gain matrices andẽ = x − x = x − (x 0 + e ). The admittance control torque is then defined as follows:

Hybrid impedance/admittance control
The hybrid impedance/admittance control can be implemented on the basis of the approach proposed by Ott et al. [12] , so that it would be possible to exploit the combined performance of both control schema to deal with a wide range of interaction environment stiffnesses. The proposed hybrid controller continuously switches between impedance and admittance control. For this purpose, the switching period and the duty cycle ∈ [0, 1] parameters are introduced as control variables. The control force F is, therefore, computed according to the following strategy: where is an integer taking values 0, 1, .... In Equation (11), F and F are computed, respectively, as described in Sections 2.2 and 2.3. As approaches 0, F is equivalent to the impedance control action, while, as approaches 1, F is equivalent to the admittance control action with periodic resetting. The hybrid impedance/admittance control framework is schematized in Figure 2.
While the hybrid impedance/admittance control proposed by Ott et al. [13] provides a useful control framework to combine the impedance control and admittance control performance, the following main open issues are still present in the state-of-the-art: (i) the switching law to ensure continuity in the switching from impedance to admittance control does not include a feed-forward velocity term; and (ii) the performance of the hybrid impedance/admittance control framework (i.e., the resulting combined impedance/admittance behavior) can be improved by adapting the switching parameters that were considered constant by Ott et al. [13] . In the following section, these open issues are tackled to improve the hybrid impedance/admittance control framework.

ADAPTIVE SWITCHING PARAMETERS
In this section, two main improvements are proposed for the hybrid impedance/admittance controller proposed in [13] : (i) proper initialization of e ( ) and e ( ) while switching from impedance control to admittance control at time ; and (ii) adaptation of the switching period and the duty cycle ∈ [0, 1] parameters. In the following, these improvements are described for a single degree of freedom (DoF) , since both impedance and admittance controllers allow decoupling the controlled robot Cartesian DoFs.

Proper initialization of the admittance controller
To guarantee the continuity of the interaction force while switching from impedance control to admittance control within the hybrid controller, the proper initialization of e ( ) and e ( ) in Equation (9) has to be performed. In this section, three different methods are proposed to solve the mentioned issue: (i) the algebraic switching method; (ii) the differential switching method; and (iii) the iterative switching method.

Algebraic switching method
To guarantee the continuity of the interaction force while switching from impedance control to admittance control, the following equality has to be satisfied: ) − , ( − ( 0, + , ( ))). By isolating , ( ) from Equation (12), it is possible to obtain the following expression: By differentiating Equation (13) , ( ) and , ( ) can be computed by solving the algebraic Equations (13) and (14). The term , ( ) appearing in Equation (14) is unknown, and it is therefore approximated with the numerical derivative of , ( ). Such computation is reasonable for small values of . Of the proposed methods, this is the one requiring the lowest computational power.

Differential switching method
By isolating , ( ) from Equation (12), it is possible to compute it as follows: By taking its time derivative, it is possible to compute , ( ):  Equations (15) and (16) can be integrated while impedance control is activated, in order to compute , ( ) and , ( ) at the required switching time . This proposed methodology is affected by numerical uncertainties, and it is the one requiring the highest computational power.

Adaptive switching logic
The switching logic is defined by the following two parameters: the switching period and the duty cycle . As shown in [13] , such parameters affect the performance of the hybrid impedance/admittance controller. In particular, based on the equivalent inertia of the controlled robot along the direction , the switching parameters have to be adapted in order to maximize the performance of the hybrid controller. As shown in Figure 5 (considering the DoF) for the Franka EMIKA panda robot (i.e., the robot used for the simulation results analysis in Section 4), the equivalent inertia M (q) Equation (5) of the controlled robot (analysis performed exploiting the modeled robot dynamics in [20] ) varies in a wide range based on the robot configuration. Indeed, to improve the performance of the hybrid controller, such an inertia variation has to be considered for the adaptation of the switching parameters. To support the above discussion, the modification of the achieved hybrid control performance can be seen in Figure 6a, 6b, 6c for the the algebraic, differential, and iterative switching method, respectively, on the basis of the imposed value for the switching parameter , where the environmental stiffness behaves as shown in Figure 6d. The robot interacts with the target environment along the vertical direction, moving the setpoint down from its initial positioning of 0.05 m. As shown in the figure, the switching parameter value allows modulating the impedance/admittance combined behavior. For low values of , the controller behaves very similarly to the impedance controller even if = 0.5, for which an intermediate behavior is desirable. As increases, the hybrid controller behaves as the admittance controller. In addition, when increases too much, some undesirable oscillations are introduced. Therefore, the optimization of the switching parameter would allow improving the hybrid controller performance. In addition, the adaptation of the duty cycle parameter can be performed. As shown in [13,14] , the duty cycle can be adapted on the basis of the environment stiffness parameter. Indeed, this paper proposes a strategy to adapt such a parameter in order to improve the performance of the hybrid controller.
In the following, the adaptation of both the switching period and the duty cycle are tackled to improve the hybrid control performance.

Variable switching period
To tune the switching period on the basis of the inertia value along a specified Cartesian DoF , the following adaptation strategy has been defined: where 0, is the nominal value for the switching parameter, given a nominal inertia 0, , while is the current inertia value resulting from Equation (5) along a specified DoF . is the parameter tuning the adaptation strategy in Equation (17). To tune the parameter, simulations can be exploited, as in Ott et al. [13] . By introducing the performance index for the hybrid controller with a given value of the duty cycle , where | , and | , are the performance for the pure impedance and admittance, respectively, as defined below in Equation (20), the following cost function can be defined for the optimization of , for a given interaction environment , where By simulating the interaction with different environments (i.e., having different stiffness) and values of the duty cycle , it is possible to define the global cost function and the partial ones , w.r.t the chosen environmental stiffness, as follows: To evaluate the cost function , a nominal inertia 0, = 1 kg and a nominal switching parameter 0, = 20 ms as considered by Ott et al. [13] , having the hybrid controller in interaction with soft, medium, and stiff environments with stiffness values of 10, 300, and 3200 N/m, respectively, were considered. Figure 7 shows the cost functions and , for a specified value of the inertia parameter , and varying the parameter. Figure 8a, 8b, 8c shows which value of is the best when the system interacts with soft, medium,  and stiff environments, respectively, for several values of inertia (i.e., making it possible to highlight the optimized parameter for every environment for the considered values of , as in Figure 8d). Figure 9 collects the minimums of the cost functions highlighted in Figure 8a,8b, 8c,8d. It is then possible to optimize the value of such that Equation (17) approximates the behavior of in Figure 9. The optimized value of is 0.68 (taking into consideration the target inertia range, in this case from +50% to −20% w.r.t. 0, ). It follows that, if the inertia varies with respect to its nominal value, the value of will increase with the law defined in Equation (17).
It has to be noted that the optimized value of depends on the nominal parameters 0, and , together with the considered range of variation for . Therefore, changing, e.g., the range of variation for , a new optimization has to be performed.

Variable duty cycle
The adaptation of the duty cycle parameter can be performed on the basis of the environmental stiffness parameters as it follows: This means that, when interacting with a soft environment (i.e., = 0), the controller is imposed to behave as the admittance controller; when interacting with a stiff environment (i.e., = 1), the controller is imposed to behave as the impedance controller; and when interacting with a medium environment, the duty cycle is adapted based on the defined relation in Equation (22), on the basis of the value of the interaction environment stiffness , , and considering the stiffness range for the medium environment within the values , and , . The choice of such parameters converts the adaptation law described by Ott et al. [13] and shown in Figure 10 into the one shown in Figure 11. The adaptation law proposed by Ott et al. [13] evaluates after every switching period . If the environmental stiffness varies a considerable amount in between the times at which is evaluated, there is a high probability of applying an inadequate control action. The new law will evaluate every time the controller switches from impedance to admittance control, and vice versa. The introduction of such an additional evaluation mitigates the mentioned risk of applying an inadequate control action due to the variation of the stiffness environment. This becomes particularly useful when increases according to Equation (17).

Remark 1.The environment stiffness parameter
, estimation can be performed as described by the authors of [21,22] . Remark 2.The stability of the controller can be addressed following the work in [12,13] .  Figure 10. Adaptation law for in [13] .

RESULTS
In this section, the results achieved by the proposed improved hybrid impedance/admittance controller are discussed, comparing them with the standard methodology where is fixed and the adaptation law for is as in [13] . A simulation study was performed employing a reference robotic platform, a Franka EMIKA panda robot. Matlab was used as a simulation platform, making use of the robot modeled dynamics in [20] .

Task description
To evaluate the performance of the improved hybrid controller, an interaction task along the vertical Cartesian direction was considered. The Franka EMIKA panda robot torque controller was simulated as for the real robot, i.e., with a control frequency of 1 kHz. A variable stiffness environment was simulated, with an environment stiffness , varying as in Figure 12. The robot moves its setpoint down from its initial positioning of 0.10 m in Δ 1 = 1s. Then, it moves forward horizontally 0.20 m in Δ 2 = 1s, and it maintains its position for Δ 3 = 3s.

Control parameters definition
The parameters for the impedance controller were chosen as follows: The diagonal elements of the matrix D were computed as follows: The parameters of the admittance controller were imposed as follows: The values used in Equation (17) were imposed as in the following: 0, = 8 kg, 0, = 100 ms, and = 0.68. The values used for the adaptation law of in Equation (22) were imposed as in the following: N/m and , = 300 N/m.

Results evaluation
The performance obtained when applying the hybrid control with the algebraic, differential, and iterative switching methods can be seen in Figure 13a, 13c, 13e, respectively, considering fixed and variable . In addition, Figure 13b, 13d, 13f shows the resulting interaction force along the Cartesian DoF . Figure 14 shows the applied values for the variable . Specifically, this figure refers to the values obtained when the algebraic switching method is applied (similar results are achieved for the other methodologies in Section 3.1). Figure 15 shows the value of , (q) along the simulation upon which is computed. Figure 16a shows the values assumed by when the adaptation strategy of [13] is used, while Figure 16b shows the values obtained with the proposed adaptation strategy in Equation (22). It is possible to observe how varies more often in the proposed adaptation strategy, assuming additional intermediate levels.
When the environmental stiffness is not within the range for the medium environment (hence, within the values , and , ), the pure impedance or admittance controllers will be applied. This is also visible in Figure 16b, at the beginning and at the end of the simulation, where assumes the values of 1 and 0, respectively, for a longer time in comparison to strategy proposed by Ott et al. [13] .

CONCLUSIONS AND FUTURE WORK
This paper addresses two open issues present in state-of-the-art (i.e., satisfying the continuity of the interaction force in the switching from impedance to admittance control when a feedforward velocity term is present and adapting the switching parameters to improve the performance of the hybrid control framework, better exploiting the properties of both impedance and admittance controllers) to improve the hybrid impedance/admittance control performance in the execution of interaction tasks. The modified methodology' s performance (i.e., to verify the improved combined impedance/admittance behavior) was evaluated in simulation, comparing the achieved results with those obtained with the standard method that used and     adaptation law for as Ott et al. [13] , making use of a Franka EMIKA panda robot as a reference robotic platform. The obtained results show the improved mixing impedance/admittance performance of the modified  [13] .  hybrid controller.
Future work is devoted to the design of a hybrid impedance/admittance controller exploiting AI techniques to additionally implement motion/force control capabilities (such as in Xu et al. [23,24] ). Furthermore, AI techniques will be applied to improve the switching strategy, together with embedding the online estimation of both the robot and the environment modeling into the hybrid control framework.

Authors' contributions
Made substantial contributions to conception and design of the study and performed data analysis and interpretation: Roveda L, Formenti A Performed data acquisition, as well as provided administrative, technical, and material support: Formenti A, Roveda L, Shahid AA, Piga D, Bucca G Paper writing: Roveda L, Formenti A, Shahid AA Supervision: Piga D, Bucca G

Availability of data and materials
Not applicable.

Financial support and sponsorship
The work has been developed within the project ASSASSINN, funded from H2020 CleanSky 2 under grant agreement n. 886977.