# Input-to-State Stability of Variable Impedance Control for Robotic Manipulator
## 4 Simulation  
In order to illustrate the characteristics of the proposed sufficient conditions for the ISS, a two-link manipulator was simulated by using the MATLAB 2017a. In the simulation, the update rule of \(\dot{K}(t)\) satisfying both Equations (12) and (13) was used in order to accomplish the ISS. From the Equation (24), it is noted that \(\left\|\dot{H}(q)\right\|\) can be upper bounded by the joint velocity with some proportional constant\(\zeta>0\), _i.e._, \(\left\|\dot{H}(q)\right\|\leq\zeta\|\dot{q}\|\), and \(K(t)\) and \(D\) are the design parameters. Now, assume \(\alpha=0.75\) within \(0<\alpha<1\) and \(\zeta=1\), then the minimum of \(K(t)\) can be chosen as follows:  
\[\|0.125K(t)+D\|_{l}\ \geq 0.5\|\dot{q}\|. \tag{38}\]  
The design procedures for simulation are suggested as follows:  
1. Select the initial stiffness matrix \(K(0)\) and the damping matrix \(D\), respectively. Equation (13) or Equation (37) should be considered.
2. Confirm whether both the time-varying stiffness \(K(t)\) and its time derivative \(\dot{K}(t)\) can satisfy Equation (12). In this simulation, the proposed update rule of Equation (26) is used.
3. Obtain \(\dot{H}(q)\) from \(\dot{H}(q)=C(q,\dot{q})+C^{T}(q,\dot{q})\).  
In the simulation, we set the initial gains,  
\[K(0)=\begin{bmatrix}180&0\\ 0&120\end{bmatrix}\quad\text{and}\qquad D=\begin{bmatrix}20&0\\ 0&20\end{bmatrix}. \tag{39}\]  
Furthermore, the mass and length of each link are set by 1 kg and 0.5 m, respectively. Figure 2 shows the snapshots of the simulation result according to the time progress. The manipulator starts to move toward a given target position \((x_{d},y_{d})=(0.0,0.2)\), and then the target position was changed into another position of \((x_{d},y_{d})=(0.0,0.6)\) at the instant of 1 s. The simulator does not require any trajectory generation method because the proposed method was based on the set-point regulation. To show the effect of time-varying stiffness matrix \(K(t)\) according to the proposed update rule, the x-axis external force was applied to the end-effector with 50 N amplitude. It was applied to the end-effector backward and forward directions alternatively with a 0.25 s duration. The simulation was conducted for 2 s.  
Figure 3 shows the data plots during the simulation suggested in Figure 2. The behavior of the robotic manipulator was evaluated in the viewpoint of the Lyapunov function and the sufficient conditions suggested in Equations (12) and (13) as main contributions. The Lyapunov function composed of total energy could not go to zero (equilibrium) as observed in Figure 3a when the external force was applied. In Figure 3a, we should notice that the Lyapunov function value was changed suddenly at the instant of 1 s because the target was then exchanged from \((0.0,0.2)\) to \((0.0,0.6)\). However, we could confirm that its time derivative remains negative as shown in Figure 3b, in spite of abrupt target change. Also, the proposed sufficient conditions were satisfied all the time as shown in Figure 3c,d. Also, x-directional 50 N force was applied to the end-effector of the robotic manipulator as shown in Figure 3e. These external joint torques suggested in Figure 3f were obtained from the external force by using Equation (7). As a result, the joint position and velocity errors remain as shown in Figure 3g,h. In other words, we could know that the system error states remain inside the energy boundary caused by the external joint torques. Further, we could know that the closed-loop control system is maintained to be ISS, even if the stiffness matrix \(K(t)\) varies. The next section deals with six-degrees-of-freedom (6-DoFs) robotic manipulator as a further example.