#### Abstract

In order to guarantee the passivity of a kind of conservative system, the port Hamiltonian framework combined with a new energy tank is proposed in this paper. A time-varying impedance controller is designed based on this new framework. The time-varying impedance control method is an extension of conventional impedance control and overcomes the singularity problem that existed in the traditional form of energy tank. The validity of the controller designed in this paper is shown by numerical examples. The simulation results show that the proposed controller can not only eliminate the singularity problem but can also improve the control performance.

#### 1. Introduction

In recent years, as a result of the social needs of the robot industry, especially, robots can easily help humans work in some dangerous areas, so in the past few years, robot technologies have been developing rapidly. Robots have been used in many fields, such as medical, neurosurgery [1, 2], and orthopedic [3, 4], to help doctors complete the operation. In the exploration of the unknown environment [5, 6], the remote operating robot system is very popular because it can provide remote monitoring for the operator. Franchi et al. have studied the multirobot control technology and proposed a multirobot control method [7]. Multirobot collaborative work can improve the efficiency of environmental exploration. Shahbazi et al. [8, 9] have proposed a multimaster teleoperation control technology, which can help people practice in a real-world environment that greatly facilitates the development of technology. There are many control methods for the robot system, such as impedance control [10], bilateral control [11, 12], adaptive neural network control [13], neural network-based robot obstacle avoidance planning control [14], and dynamic hybrid control [15].

In order to deal with the relationship between the environmental force and the tracking error, the concept of time-varying impedance control was proposed [16, 17]. This time-varying impedance control method has been applied to the medical fields [18, 19]. Ferraguti et al. combined the impedance control with the concept of energy tank [20] and proposed an energy-based impedance control. Afterwards, they combined the concept of a two-layer network with this energy tank method and then had a further extension in [21].

The energy tank has a virtual storage energy structure [22], which can store the energy consumed by the system, and when the system needs energy, it can provide energy for the system. This means that the energy tank can regulate the energy of the system. In order to guarantee the stability of the time-varying impedance control system, the impedance controller is adopted with a combination of energy tanks. However, this control strategy will appear with singular problems. To alleviate this problem, it is necessary to inject a certain amount of energy into the energy tank before the system works to ensure that there is no singularity problem in the control system, but this will increase the complexity of control and worsen the performance of the system.

The port Hamiltonian system is used for analyzing energy flow and has been applied to many control systems [23, 24]. If a system can be written into a port Hamiltonian system, it means the system is a passive system. In this paper, a new type of energy tank structure is proposed and the structure of this energy tank can overcome the singularity of the traditional energy tank. Combining this new type of energy tank and port Hamiltonian form, we proposed a time-varying impedance controller based on this new framework. The proposed control method can not only solve the singularity problem in the energy tank but can also guarantee the passivity of the whole system.

The structure of this paper is as follows: in the second section, the basic knowledge of the port Hamiltonian system and impedance control is introduced, and the combination of new energy tank and port Hamiltonian form is also described. The third section analyzes the problem of the original impedance control. The fourth section presents the time-varying impedance controller equipped with new energy tank. In the fifth section, the effectiveness of the proposed controller in different circumstances is verified by simulation. The last part is the conclusions of this paper.

#### 2. Port Hamiltonian System and Impedance Control

##### 2.1. Port Hamiltonian System

The Hamiltonian system is close to the Euler-Lagrangian model, and the generalized expression of the port Hamiltonian system can be derived from the Lagrangian equation. The Lagrangian quantity is expressed by the difference between kinetic energy and potential energy, and the energy of the port Hamiltonian system is the sum of them. The port Hamiltonian system has the property of dissipation; this framework can be widely used to a lot of physical systems, and the port Hamiltonian system is expressed as follows [23]:
where is the state vector, is the Hamiltonian function that represents the total energy stored in the system, and *H* has a lower bound. is an interconnection matrix, and indicates the interconnection structure within the system. *R*(*x*) is the damping matrix, indicates the dissipation damping structure of the port, *g*(*x*) is an external interconnect matrix that represents port characteristics, is the input, and is the output. The internal structure of the port Hamiltonian system is shown in Figure 1.

Now take the derivative of energy function:

Since is an antisymmetric matrix, (2) can be transformed into the following form:

And is the port where the system exchanges information with the external environment, and the product of them represents the exchange of energy with the external environment. It can be seen from (3) that the port Hamiltonian system is a passive system for the pair . That is, if a system can be realized in the form of port Hamilton, this system is passive. The energy of the dissipated part of the system is represented by .

indicates the power dissipated by the system and represents the passive margin of the system, that is, the degree of passivity of a system. The more the energy of a system dissipates, the higher the degree of its passivity. However, the control performance and passivity are two contradictory aspects; when most of the energy is consumed, the energy used to change the state will be little, and this is not what we expect.

##### 2.2. New Energy Tank and Port Hamiltonian System

The energy tank is a virtual storage energy structure that can temporarily store the energy dissipated by the system, and when the system needs energy to change the existing state, the energy tank could provide the stored energy to the system. The energy tank can be added to a system to better complete the energy dispatch work. To equip with energy tank is to increase the performance of the system and make the system achieve a stable state.

Combining port Hamiltonian system with the energy tank, the state expression of the system becomes the following form: where is the state of the energy tank, and the total energy of the energy tank can be expressed by the following equation:

() is the power port where the energy tank can exchange energy with external, and . The parameter is used to limit the energy that can be stored in the energy tank. The energy tank is a transit station of energy; it aims at making the energy deployment better. Like a pool, too much water will overflow; for the system, too much energy may lead to system instability, so we need set a threshold to limit the storage of the energy tank.

Derivation of leads to the following equation:

When the energy in the energy tank has not reached the upper bound, let , the energy tank can store the energy consumed by the system and exchange energy through the port . When the energy in the energy tank reaches the upper bound, let , it stops absorbing the energy released by the system. Previous literature on energy tank needs to ensure to avoid singularity problem [20], and the combination of the energy tank and the port Hamiltonian system still needs to ensure . However, the new energy tank in this paper does not have an existing singularity problem; it is not necessary to initialize the energy tank at the beginning of the control to ensure that there is a suitable energy in the energy tank to avoid the occurrence of the singularity problem. The energy tank in this paper only needs to ensure the energy within a certain range.

Now define the upper bound of the energy tank, and the expression of is as follows:

is the upper limit of the energy tank, and the selection of this upper limit depends on the specific control system and certain specific requirements for system performance.

The energy stored in the tank can be used for passively implementing any desired input to the port Hamiltonian system where the tank is associated with. This can be realized by joining the port () and the port through the following interconnection:

According to (9), we can get the following relationship:

It can be seen from (10) that the energy output and inflow of the port Hamiltonian system are exactly equal to the energy stored and supplied by the energy tank. This means that no energy is generated. The overall system is kept stable through implementing the desired input in a way to preserve passivity.

##### 2.3. Impedance Control

Position control is important in robot systems. In order to make the robot follow the wishes of mankind to complete a task, position tracking is a necessary requirement. In particular, for medical robots with higher precision, it is important to make the robot move precisely according to the intended trajectory. There are many ways to control the position of the robot, such as mixed force control and impedance control [10]. Especially, impedance control is an effective method of controlling the interaction between a robot and a partially known environment. Instead of controlling either the force or the position of the end effector, the goal of impedance control is to establish a desired dynamical relationship between the motion of the robot and the force applied by the environment. A common example of impedance control is a nonlinear feedback law that makes a manipulator equivalent to a multidimensional mass-spring-damper system with desired inertia, stiffness, and damping properties [20].

The impedance control diagram is shown in Figure 2, where is the desired position, is the control force generated by the impedance controller, is the force of the external environment for the robot system, and is the position vector output of the robot system. Our goal is to make the actual position as close as possible to the desired position . The purpose of impedance control is to establish a dynamic response relationship between the desired position and contact force between the robot and the external environment. As long as the actual impedance meets the desired impedance, the robot can track the desired trajectory.

The kinetic model of the robot system with degrees of freedom can be expressed as follows: where is the positive definite inertia matrix, is the Coriolis and the centrifugal matrix, represents the gravity matrix, is the input vector, is the vector of external forces, is the robot end position in the Cartesian coordinate, . And is the joint position in the joint space, and is the Jacobian conversion matrix, which can be converted from the joint space to the Cartesian coordinate.

The goal of impedance control is to establish a tracking relationship between the location error and the external force, which can be expressed as follows: where are the desired stiffness, damping, and inertia matrices, respectively, and all of them are nonnegative matrix; indicates the tracking error. It can be seen that the impedance control is a combination of the tracking error and the external force of the environment. The proper relationship of impedance can make the robot exhibit flexible characteristics.

The input vector can be obtained from (11) and (12)

The impedance control method used here is a passive control method with the power port (). The energy expression of the robot system using impedance control is

Take the derivative of (14) to analyze the energy change of the robot system under impedance control.

The expected impedance (13) is brought into (15); then we have

Since , we can get , which implies the following passivity condition:

From (17), we can see that the total energy of the system at time which subtracts the energy at the initial moment is less than the input energy. In other words, the robot system with impedance control is a passive system for the power port (), that is, the system is a stable system.

#### 3. Problem Statement

From (12), we can see that the expected impedance relationship is a fixed relationship, but the robot environment is often complex and varied, such as exploratory robot; it may be in the collision-free search or blocked by vegetation and rocks, the change of external environment is very large, and it is clear that this fixed impedance relationship cannot meet our needs. The following analysis shows the time-varying impedance control method.

When the inertia matrix, the damping matrix, and the stiffness matrix in the impedance control are both time-varying matrices, the expression of the impedance control becomes the following form:

The expression of the total energy of the robot system becomes

And then

From (21), it does not guarantee the passivity of system (18) with power port (), because the time-varying component is added to the coefficient matrix in the impedance control, that is, the system may be unstable.

Compared with traditional impedance control, time-varying impedance control can improve its adaptability to complex environmental forces, but this may lead to the instability of the system.

In the next section, we will analyze the time-varying impedance control in the port Hamiltonian system with a new energy tank. We could guarantee the system passivity when using impedance control after adding the new energy tank.

#### 4. Controller Design

If the coefficient matrix in the impedance control is time-varying, it becomes more difficulty to guarantee the passivity and then the stability of the system. Then, the purpose of our control is to deal with this difficulty and ensure the stability of the system under time-varying impedance control.

The time-varying impedance introduces the time-varying components in the coefficient matrix and now separates the time-varying parts of the three matrices. where , and are the constant matrices of the inertia matrix, the damping matrix, and the stiffness matrix, and they are all symmetric matrices, and , are time-varying parts.

Define the total energy expression of the system as follows: where , and the expression of system state can be represented as

Now, we introduce the concept of energy tank into the robot system. The energy tank is a virtual energy storage implement. After adding the energy tank, it can guarantee passivity by storing the energy dissipated by the controlled system. The states of the impedance control system are augmented with the state of the energy tank, and then the extended dynamics is where represents the state of the energy tank and the total energy of the energy tank is . The introduction of the energy tank is to deal with the time-varying parts of the impedance control. In order to achieve the better control effect, we need to set the upper and lower limits for the energy tank. and are expressed as follows: where and represent the upper and lower bounds of the energy tank, and this range is chosen based on different robot systems and different control requirements. When the energy of the tank stores beyond the limits, we set (the energy tank stores too much energy or the energy in the energy tank is only a little to support the energy required for the state change) the port of energy exchange between the energy tank and the external environment will be closed.

The total energy expression of the robot system after adding the energy tank is as follows:

The expected impedance is changed as

According to (28) and (11), the control force can be obtained.

The state equation of the system can be rewritten as the following form: where . It means that the time-varying impedance control system can be written as the form of a port Hamiltonian system. Considering (29), the time derivative of can be computed as follows:

And according to (20),

, we have , that is,

And therefore, which proves passivity.

It shows that after adding the new energy tank, the robot impedance control system has realized the passivity and can adapt to the addition time-varying parts. The corresponding simulation illustration is shown in the next section.

#### 5. Simulation

Consider the kinetic model of (11) with the following parameters:

According to (27), set the expected parameters as , respectively, and the desired trajectory is , assuming that the robot is doing free movement, which is.

For this kind of system with time-varying impedance parts, when using conventional impedance control method, the simulation results are shown as follows:

Figure 3 shows the desired position (red dotted line) and the tracking position (green solid line) by conventional impedance control. From Figure 3, we can see that the general impedance control for this time-varying relationship is unable to get good performance, and the entire tracking trajectory has been completely divergent. From the energy perspective, the reason for the divergence of the system is that the energy flow in the system changes greatly and cannot be managed with the time-varying parameters.

From Figure 4, it can be seen that the energy curve is also divergent, which means for the time-varying impedance relationship, the conventional impedance control is unable to meet the control requirements.

The following simulation is obtained by using the new controller presented in this paper, and the result are as follows:

Figure 5 shows the desired position (red dotted line) and the tracking position (green solid line) by the impedance control proposed in this paper. The figure shows that the time-varying impedance control based on the new energy tank can track the desired position without divergence and shows good tracking performance.

The state of the energy tank is shown in Figure 6; we can see that during the simulation period, the state of the energy tank has been changing continuously, which indicates that the port of the energy tank has continuous energy flow and outflow. The introduction of the energy tank can manage the energy flow better, which means that the control performance can be enhanced while ensuring the stability of the system.

The state expression for the previous energy tank is in the following form:

From (36), it can be seen that in order to make the energy tank work, we must ensure that the state of the energy is tank , which will increase the complexity of the control. To overcome this shortcoming, a new energy tank is proposed in this paper. The following simulations compare the control effects based on different energy tanks.

Figure 7 illustrates the desired position (red dotted line), the tracking position by impedance control proposed in this paper (green solid line);, and the tracking position by impedance control based on (36) (blue solid line). It can be seen that the control curve of the controller proposed by (36) has more fluctuations.

Figure 8 shows the tracking error caused by the conventional method (34) (green dotted line) and caused by our new method (29) (red solid line). It can be seen that the overall error of the controller proposed in this paper is smaller than that of the original controller.

Figure 9 shows the energy changes of the energy tank, where Figure 9(a) is the energy tank of the previous type, and Figure 9(b) is the one proposed in this paper. It can be seen that the energy storage changes of the two energy tanks are not the same type, and the energy tank proposed in this paper is more regularly.

**(a)**

**(b)**

Now, consider the case of ; when the robot suddenly enters into a new environment, the contact force will change suddenly. We will use the step signal to simulate this situation. The position tracking curves are shown in Figure 10 and the tracking errors are shown in Figure 11.

In Figure 10, the desired trajectory is plotted in red dotted line, the tracking trajectory by impedance control proposed in this paper is expressed in green solid line, and the blue solid line shows the tracking result obtained from the conventional impedance control.

In Figure 11, the red solid curve is the tracking error of the new energy tank and the green dotted curve is the conventional energy tank.

Figures 10 and 11 show that due to the sudden introduction of external forces, the control precision of the two kinds of controllers has different degrees of decline, but the control effect based on the new energy tank is still better than the conventional one. That means the controller proposed in this paper has better ability to adapt the changing external environment.

The energy changes in the two energy tanks are shown in Figure 12, where Figure 12(a) is the tank proposed in this paper and Figure 12(b) is the conventional one.

**(a)**

**(b)**

It is known that the force of the real environment is often complex and varied, so we consider a random external force as the simulation of external forces to test the performance of controller based on our new energy tank.

The random external force is shown in Figure 13, and the trajectory of control systems is shown in Figure 14, where the desired trajectory is plotted in red dotted line, the tracking trajectory by our new impedance control is plotted in green solid line, and the conventional control result is plotted by blue solid line. It can be seen that both control methods are robust and can track the desired trajectory in the face of random external force but the control effect of the controller based on the new energy tank proposed in this paper is better than that of the conventional one.

In the case of random external forces, the tracking errors of the two control methods are shown in Figure 15, where the red solid curve is the tracking error of the new energy tank and the green dotted curve is the tracking error of the conventional energy tank. Compared with Figure 11, it can be seen that the tracking errors only have slightly increased. It indicates that the energy tank-based impedance controller has strong ability to adapt the time-varying random external forces.

#### 6. Conclusions

In this paper, the time-varying impedance control based on a new energy tank is combined with the port Hamiltonian system and then rewritten in the form of port Hamiltonian system. This new energy tank-based impedance control method can not only meet the time-dependent expectation relationship between external force and tracking error but can also avoid the singularity problem in the conventional type of energy tank. For the control system proposed in this paper, the robot system with energy tank is designed as the port Hamiltonian system, that is to say, the whole control system is a passive system, which ensures the stability of the control system. The simulation results show that the controller proposed in this paper has better position tracking in the face of different types of external forces than the conventional one.

#### Data Availability

The processed data used to support the findings of this study are included within the article.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported in part by Shanghai Key Laboratory of Power Station Technology and Shanghai Science Technology Commission no. 14ZR1414800.