5.1 Introduction

With development of industry society, robot manipulators are required to be more flexible and intelligent, to satisfy the increasing personalized and customized production requirement [1]. Compared to non-redundant manipulators, redundant ones show more flexibility due to its more DOFs that exceed the required number to accomplish the given task [2]. On the other hand, position control scheme on robots would show lower performance for some complicated tasks [3]. For example, the control methods that only considers position usually ignore the contact-force between robot and workpieces, with high safety challenge, resulting from the excessive system stiffness would bring the unpredictable responses [4]. Therefore, control of contact force between redundant robots and workpieces should be considered.

In the light of different robot structure and control signals, until now, a number of methods have been proposed. Imitating the muscle-tendon tissue of animal joints, compliance units such as series elastic actuators (SEA), variable stiffness actuators and so on, are introduced into the robots. In [5], Pan et al. proposed a compliance controller for SEA-based systems, achieving torque output control. As to the interaction between the robot and workpieces, Hogan proposes a basic idea of impedance control, in which the robot and environment usually bear as an impedance and admittance, respectively [6]. Generally speaking, the contact force and relative movement of the robot and workpieces can be described as a combination of mass-spring-damper systems. Therefore, the contact force can be controlled by designing motion commands indirectly. Another representative approach is hybrid position-force control, the controller is usually designed in the torque loop of the joint space, in which both contact forces and movement of the robot are modelled based on dynamic analysis. Then the controller can be described as a combination of control efforts which achieve position and force control respectively [7]. Similar research can be found in literature such as [8,9,10,11,12,13].

During the operation, the robot may collide with the environment because the manipulator usually needs to keep in touch with the workpiece. In addition, the working space of the robot is limited [14]. For example, in a production line with multiple manipulators, each robot is in a fixed position. In order to avoid interference, the working space of the robot is limited by hardware (fences, obstacles, [emph], etc.) or software constraints (pre planned space). In the case of human-computer cooperation, the robot shall not collide with people. Therefore, it is very important to avoid obstacles in the process of operation. In current reports, the desired trajectory is usually obtained by offline programming, which is limited by the efficiency of programming. In order to achieve real-time obstacle avoidance control, the artificial potential field method has been widely used. The basic idea is that when an obstacle repels the robot, the target acts as an attractive pole, and then the robot will be controlled to converge to the target without colliding with the obstacle [15]. In [16], a modified method is proposed, which describes the obstacles by different geometrical forms, both theoretical conduction and experimental tests validate the proposed method. Considering the local minimum problem that may caused by multi-link structures, in [17], a two minima is introduced to construct potential field, such that a dual attraction between links enables faster maneuvers comparing with traditional methods. Other improvements to artificial potential field method can be found in [18, 19]. A series of pseudo-inverse methods are constructed for redundant manipulators in [20], in which the control efforts consists of a minimum-norm particular solution and homogeneous solutions, and the collision can be avoided by calculating a escape velocity as homogeneous solutions. By understanding the limited workspace, the obstacle avoidance can be described in forms of inequalities, which opens a new way in realtime collision avoidance. In [21], the robot is regarded as the sum of several links, and the distances between the robot and obstacle is obtained by calculating distances between points and links. Then Guo [22] improves the method by modifying obstacle avoidance MVN scheme, and simulation results show that the modified control strategy can suppress the discontinuity of angular velocities effectively.

To solve the problem of robot compliance control, the controller should be designed according to the required command and system characteristics. That is to say, robots must follow constraints to achieve compliance control, while ensuring unequal constraints to avoid obstacles. Obviously, the control problem involves several constraints, including equal constraints and unequal constraints. By using the idea of constraint optimization, the control problem with multiple constraints can be well dealt with. In recent years, the application of recurrent neural network in robot control has been studied extensively, and it shows the great efficiency of real-time processing [23,24,25,26,27]. In those literatures, analysis in dual space and a convex projection are introduced to handle inequality constraints.

Recently, taking advantage of parallel computing, neural networks are used to solve the constraint-optimization, and have shown great efficiency in real-time processing. In [28, 29], controllers are established in joint velocity/acceleration level, to fulfill kinematic tracking problem for robot manipulators. In [30], tracking problem with model uncertainties is considered, and an adaptive RNN based controller is proposed for a 6DOF robot Jaco\(_2\). Discussions on multiple robot systems, parallel manipulators, time-delay systems using RNN can be found in [30,31,32,33].

Based on the above observations, a RNN based collision-free compliance control strategy is proposed for redundant manipulators. The remainder of this chapter is organized as follows. In Chap. 2, the control objective including the position-force control as well as collision avoidance is pointed out, and then rewritten as a QP problem. In Chap. 3, the RNN based controller is proposed, and the stability of the system is also analyzed. A number of numerical experiments on a 4-DOF redundant manipulator including model uncertainties and narrow workspace are carried out in Chap. 4, to further verify effectiveness of the proposed control strategy. Chapter 5 concludes the chapter. The contributions of this chapter are summarized as below

  • To the best of the author\('\)s knowledge, there is few research on compliance control using recurrent neural networks, the study in this chapter is of great significance in enriching the theoretical frame of RNN.

  • The proposed controller is capable of handling compliance control, as well as avoiding obstacles in realtime, which does make sense in industrial applications, besides, physical constraints are also guaranteed.

  • Comparing to traditional neural-network-based controllers used in robotics, not only control errors but model information is considered, therefore, the proposed RNN has a simple structure, and the global convergence can be ensured.

5.2 Problem Formulation

5.2.1 Robot Kinematics and Impedance Control

Without loss of generality, we consider series robot manipulators with redundant DOFs, and the joints are assumed as rotational joints. Let \(\theta \in \mathbb {R}^n\) be the vector of joint angles, the description of the end-effector in the cartesian space is

$$\begin{aligned} x=f(\theta ), \end{aligned}$$
(5.1)

where \(x\in \mathbb {R}^m\) is the coordination of the end-effector. In the velocity level, the forward kinematic model can be formulated as

$$\begin{aligned} \dot{x}=J(\theta )\dot{\theta }, \end{aligned}$$
(5.2)

in which \(J(\theta )=\partial x/\partial \theta \) is Jacobian matrix. As to redundant manipulators, \(J\in \mathbb {R}^{m\times n}\), \(rank(J)<n\).

In industrial applications, position control based operation mode has many limitations: due to the lack of compliance, pure kinematic control methods may cause unexpected consequences, especially when the robot is in contact with the environment. To enhance the compliance and achieve precise control of contact force, according to impedance control technology, the interaction between robot and environment can be described as a damper-spring system [34].

$$\begin{aligned} F=K_p\varDelta x+K_d\text{ d }(\varDelta x)/\text{ d }t, \end{aligned}$$
(5.3)

where \(K_p\) and \(K_d\) are interaction coefficients, and \(\varDelta x=x-x_{\text{ d }}\) is the difference between the actual response x and desired trajectory \(x_{\text{ d }}\). By referring to Eqs. (5.2) and (5.3), we have

$$\begin{aligned} \dot{x}=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }}. \end{aligned}$$
(5.4)

When the real values of \(K_p\) and \(K_d\) are known, F can be obtained by adjusting the velocity \(\dot{x}\) of the end-effector according to Eq. (5.4).

5.2.2 Obstacle Avoidance Scheme

In the process of robot force control, there is a risk of collision as the robot may contact with workpieces. Besides, robot manipulators usually work in a limited workspace restricted by fences, which are used to isolated robots from humans or other robots. This problem could be even more acute in tasks which require collaboration of multiple robots. Therefore, obstacle avoidance problem must be taken into consideration. When collision does not happens, the distance between robot and obstacles keeps positive. By describing the robot and obstacles as two separated sets, namely \(S_A=\{A_1,\ldots ,A_a\}\), \(S_B=\{B_1,\ldots ,B_b\}\), where \(A_i,i=1,\cdots ,a\) and \(B_j,j=1,\cdots ,b\) are points on the robot and obstacles, respectively. Then the sufficient and necessary condition of obstacle avoidance problem is that the intersection of A and B is an empty set. That is to say, for any point pair \(A_i\) on the robot and \(B_j\) on the obstacle, the distance between \(A_i\) and \(B_j\) is always positive, i.e., \(||A_iB_j||_2^2>0\), for all \(i=1,\ldots ,a\), \(j=1,\cdots ,b\), where \(||\bullet ||_2^2\) is the Euclidean norm of vector \(A_iB_j\). For sake of safety, let \(d>0\) be a proper value describing the minimum distance between robot and obstacles, the collision can be avoided b ensuring \(||A_iB_j||_2^2\ge d\).

Remark 5.1

In fact, both \(S_A\) and \(S_B\) consist of infinite points. However, by evenly selecting representative points from the robot link and obstacles, \(S_A\) and \(S_B\) can be simplified significantly. Besides, the safety distance d can be appropriately increased. Despite that this treatment will sacrifice some workspace of the robot (the inequality \(||A_iB_j||_2^2\ge d\) would consider some areas that collisions do not happen, due to a bigger d is considered), this sacrifice is meaningful: the number of inequality constraints can be reduced greatly, which is helpful for constraint description and solution.

In real applications, the key points of the robot manipulator is easy to select. Cylindrical envelopes are usually used to describe the robotic links, then the key points can be selected on the axes of the cylinders uniformly, and the distance between those points can be defined the same as the radius of the cylinder. As to the obstacles with irregular shapes, the key points can be selected based on image processing techniques, such as edge detection, corrosion, etc.

5.2.3 Problem Reformulation in QP Type

From the above description, the purpose of this chapter is to build a collision-free force controller for redundant manipulators, to achieve precise force control along a predefined trajectory, in the sense that \(F\rightarrow F_{\text{ d }}\), \(x\rightarrow x_{\text{ d }}\), and \(||A_iB_j||_2^2\ge d\) for all \(i=1,\cdots ,a\), \(j=1,\ldots ,b\).

As to a redundant manipulator, there exist redundant DOFs, which can be used to enhance the flexibility of the robot. When the robot gets close to the obstacles, the robot must avoid the obstacle without affecting the contact force and tracking errors. In addition, when there is no risk of collision, the robot may work in an economic way, by minimizing the joint velocities, energy consumption can be reduced effectively. Therefore, by defining an objective function as \(||\dot{\theta }||_2^2\), the control objective can be summarized as

$$\begin{aligned} \text {min}~~~~&||\dot{\theta }||_2^2,\end{aligned}$$
(5.5a)
$$\begin{aligned} s.t.~~~~&x=x_{\text{ d }},\end{aligned}$$
(5.5b)
$$\begin{aligned}&F=F_{\text{ d }},\end{aligned}$$
(5.5c)
$$\begin{aligned}&||A_iB_j||_2^2\ge d, \end{aligned}$$
(5.5d)

where \(||\dot{\theta }||_2^2\) is the Euclidean norm of \(\dot{\theta }\). It is noteworthy that in actual industrial applications, the robot is also limited by its own physical structures. For instance, the joint angles are limited in a fixed range, and the upper/lower bounds of joint velocities are also constrained due to actuator saturation. By combing Eq. (5.4), the control objective rewrites as

$$\begin{aligned} \text {min}~~~~&||\dot{\theta }||_2^2,\end{aligned}$$
(5.6a)
$$\begin{aligned} s.t.~~~~&J\dot{\theta }=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }},\end{aligned}$$
(5.6b)
$$\begin{aligned}&||A_iB_j||_2^2\ge d,\end{aligned}$$
(5.6c)
$$\begin{aligned}&\theta ^{-}\le \theta \le \theta ^{+},\end{aligned}$$
(5.6d)
$$\begin{aligned}&\dot{\theta }^{-}\le \dot{\theta }\le \dot{\theta }^{+}, \end{aligned}$$
(5.6e)

with \(\theta ^{-}\), \(\theta ^{+}\), \(\dot{\theta }^{-}\), \(\dot{\theta }^{+}\) being the upper/lower bounds of joint angles and velocities, respectively. However, the optimization problem is described in different levels, i.e., joint speed level or joint angle level, which remains challenging to solve Eq. (5.6) directly. Therefore, we will rewrite this formula in velocity level. As to the key points \(A_i\) on the robot, let \(x_{Ai}\) be the coordination of \(A_i\) in the cartesian space, both \(x_{Ai}\) and \(\dot{x}_{Ai}\) are available:

$$\begin{aligned}&x_{Ai}=f_{Ai}(\theta ),\end{aligned}$$
(5.7a)
$$\begin{aligned}&\dot{x}_{Ai}=J_{Ai}\dot{\theta }, \end{aligned}$$
(5.7b)

where \(f_{Ai}(\bullet )\) is the forward kinematics of point \(A_i\), and \(J_{Ai}\) is the corresponding Jacobian matrix from \(A_i\) to joint space. Let us consider the following equality

$$\begin{aligned} \dfrac{\text{ d }}{\text{ d }t}(||A_iB_j||_2^2)=k(||A_iB_j||_2^2-d), \end{aligned}$$
(5.8)

in which k is a positive constant. It is obviously that the equilibrium point of Eq. (5.8) is \(||A_iB_j||_2^2=d\). By letting \(\dfrac{\text{ d }}{\text{ d }t}(||A_iB_j||_2^2)\ge 0\), the inequality (5.5d) can be readily guaranteed. Taking the time-derivative of \(||A_iB_j||_2^2\) yields

$$\begin{aligned} \dfrac{\text {d}}{\text {d}t}(||B_j A_i||_{2}^{2})=&\dfrac{\text {d}}{\text {dt}}(\sqrt{(A_i-B_j)^{\text {T}}(A_{i}-B_{j})})\nonumber \\ =&\dfrac{1}{||B_j A_i||_2^2}(A_i-B_j)^{\text {T}}(\dot{A}_i-\dot{B}_j)\nonumber \\ =&\overrightarrow{|B_j A_i|}^{\text{ T }}J_{Ai}(\theta )\dot{\theta }-\overrightarrow{|B_j A_i|}^{\text{ T }}\dot{B}_j, \end{aligned}$$
(5.9)

where \(\overrightarrow{|B_j A_i|}=(A_i-B_j)^{\text{ T }}/||\dot{\theta }||_2^2\) is a unit vector from \(B_j\) to \(A_i\), and \(\dot{B}_j\) is the velocity of key point \(B_j\) on the obstacles. By Eqs. (5.9) and (5.6c), the inequality description of obstacle avoidance strategy is

$$\begin{aligned} \overrightarrow{|B_j A_i|}^{\text{ T }}J_{Ai}(\theta )\dot{\theta }\ge k(||A_iB_j||_2^2-d)+\overrightarrow{|B_j A_i|}^{\text{ T }}\dot{B}_j, \end{aligned}$$
(5.10)

Remark 5.2

In this part, we have shown the basic idea of obstacle avoidance scheme in velocity level, whose equilibrium point is described in Eq. (5.8). It is notable that the right-hand side of Eq. (5.8) is only a common form to realize obstacle avoidance. Generally speaking, the right-hand side of Eq. (5.8) may have different forms, such as \(k(||A_iB_j||_2^2-d)\), \(k(||A_iB_j||_2^2-d)^3\), etc. From Eq. (5.10), the value of the response velocity to avoid obstacles is related to the two parts, the first part is the difference between the actual and safety distance, the other part depends on the movement of the obstacles.

In terms of the physical constraints of joint angles, according to escape velocity method, inequalities (5.6d) and (5.6e) can be uniformly described as \(\text {max}(\alpha (\theta ^{-}-\theta ),\dot{\theta }^{-})\le \dot{\theta }\le \text {min}(\dot{\theta }^{+},\alpha (\theta ^{+}-\theta ))\). So far, the position-force control problem together with obstacle avoidance strategy in velocity level is as below

$$\begin{aligned} \text {min}~~~~&||\dot{\theta }||_2^2,\end{aligned}$$
(5.11a)
$$\begin{aligned} s.t.~~~~&J\dot{\theta }=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }},\end{aligned}$$
(5.11b)
$$\begin{aligned}&\text {max}(\alpha (\theta ^{-}-\theta ),\dot{\theta }^{-})\le \dot{\theta }\le \text {min}(\dot{\theta }^{+},\alpha (\theta ^{+}-\theta )),\end{aligned}$$
(5.11c)
$$\begin{aligned}&J_{o}\dot{\theta }\le B. \end{aligned}$$
(5.11d)

where (5.11c) is a rewritten inequality considering (5.6d) and (5.6e) based on escape velocity scheme , \(J_o=[\underbrace{\overrightarrow{|B_1 A_1|}^{\text{ T }}J_{A1};\cdots ;\overrightarrow{|B_b A_1|}^{\text{ T }}J_{Ab}}_{b},\cdots ,\underbrace{\overrightarrow{|B_1 A_a|}^{\text{ T }}J_{Aa}^{\text{ T }};\cdots ;\overrightarrow{|B_b A_a|}^{\text{ T }}J_{Ab}}_{b}]\in \mathbb {R}^{ab\times n}\) is the concatenated form of \(J_{Ai}\) considering all pairs between \(A_i\) and \(B_j\), \(B=[B_{11},\cdots ,B_{1b},\cdots ,B_{a1},\cdots ,B_{ab}]^{\text{ T }}\in \mathbb {R}^{ab}\) is the vector of upper-bounds, in which \(-k(||A_iB_j||_2^2-d)-\overrightarrow{|B_j A_i|}^{\text{ T }}\dot{B}_j\). From the definition of \(J_o\), B, inequality (5.11d) in equivalent to \(\overrightarrow{|B_1 A_1|}^{\text{ T }}J_{A1}(\theta )\dot{\theta }\ge k(||A_1B_1||_2^2-d)+\overrightarrow{|B_1 A_1|}^{\text{ T }}\dot{B}_1\),... \(\overrightarrow{|B_b A_a|}^{\text{ T }}J_{Aa}(\theta )\dot{\theta }\ge k(||A_aB_b||_2^2-d)+\overrightarrow{|B_b A_a|}^{\text{ T }}\dot{B}_b\), which is the cascading form of the inequality description (5.10) for all points pairs \(A_iB_j\), i.e., if (5.11d) holds, the obstacle avoidance can be achieved. It is notable that a larger number of key points do help to describe the information of the obstacle more clearly, but it would lead to a computational burden, since the number of inequality constraints also increases. Therefore, the distance of the key points on the obstacle can be selected similar to those of the manipulator.

5.3 RNN Based Controller Design

In previous parts, we have transform the compliance control as well as obstacle avoidance problem into a constraint-optimization one. However, because that the QP problem described in Eq. (5.11) contains equality and inequality constraints, moreover, both Eq. (5.11b, d) are nonlinear, it is difficult to solve directly, especially in industrial applications in realtime. Based on the parallel computation ability, an RNN is established to solve Eq. (5.11) online, and the stability of the closed-loop system is also discussed.

5.3.1 RNN Design

In terms with the QP problem Eq. (5.11), although the analytical solution can be hardly obtained, by defining a Lagrange function as

$$\begin{aligned} L=||\dot{\theta }||_2^2+\lambda _1^{\text{ T }}(K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }}-J(\theta )\dot{\theta })+\lambda _2^{\text{ T }}(J_{o}\dot{\theta }-B), \end{aligned}$$
(5.12)

where \(\lambda _1\) and \(\lambda _2\) are state variables, respectively. According to Karush-Kuhn-Tucker (KKT) conditions, the inherent solution of Eq. (5.11) satisfies

$$\begin{aligned}&\dot{\theta }=P_{\varOmega }(\dot{\theta }-\dfrac{\partial L}{\partial \dot{\theta }}),\end{aligned}$$
(5.13a)
$$\begin{aligned}&J\dot{\theta }=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }},\end{aligned}$$
(5.13b)
$$\begin{aligned}&\lambda _2=(\lambda _2+J_o\dot{\theta }-B)^+, \end{aligned}$$
(5.13c)

where \(P_{\varOmega }(x)=\text {argmin}_{y\in \varOmega }||y-x||\) is a projection operator of \(\dot{\theta }\) to convex \(\varOmega \), and \(\varOmega =\{\dot{\theta }\in \mathbb {R}^n|\text {max}(\alpha (\theta ^{-}-\theta ),\dot{\theta }^{-})\le \dot{\theta }\le \text {min}(\dot{\theta }^{+},\alpha (\theta ^{+}-\theta ))\}\). In Eq. (5.13c), the operation function \((\bullet )^+\) is defined as a mapping to the non-negative space. Equation(5.13c) can be rewritten as

$$\begin{aligned} \left\{ \begin{array}{ll} \lambda _2>0~~~~~\text {if}~~~J_{o}\dot{\theta }=B,\\ \lambda _2=0~~~~~\text {if}~~~J_{o}\dot{\theta }\le B, \end{array}\right. \end{aligned}$$
(5.14)

When \(J_{o}\dot{\theta }\le B\), the inequality Eq. (5.11d) holds, then \(\lambda _2\) stays zero. Instead, if the inequality reaches a critical state, \(\lambda _2\) becomes positive to ensure \(J_{o}\dot{\theta }=B\). In order to obtain the inherent solution in real time, a recurrent neural network is built as follows

$$\begin{aligned} \varepsilon \ddot{\theta }&=-\dot{\theta }+P_{\varOmega }(\dot{\theta }-\dot{\theta }/||\dot{\theta }||_2^2+J^{\text{ T }}\lambda _1-J_o^{\text{ T }}\lambda _2),\end{aligned}$$
(5.15a)
$$\begin{aligned} \varepsilon \dot{\lambda }_1&=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }}-J(\theta )\dot{\theta },\end{aligned}$$
(5.15b)
$$\begin{aligned} \varepsilon \dot{\lambda }_2&=-\lambda _2+(\lambda _2+J_o\dot{\theta }-B)^{+}, \end{aligned}$$
(5.15c)

with \(\varepsilon \) being a positive constant scaling the convergence of Eq. (5.15).

The proposed RNN based algorithm is shown in Algorithm 5.3.1. Based on escape velocity method, the convex set of joint speed can be obtained based on the positive constant \(\alpha \) and physical constraints \(\theta ^-\), \(\theta ^+\), \(\dot{\theta }^-\), \(\dot{\theta }^-\). After initializing state variables \(\lambda _1\) and \(\lambda _2\), the reference velocity can be obtained based on the desired command and actual responses according to Eq. (5.4) then the output of RNN (which is also the control command) can be calculated based on Eq. (5.15a), at the same time, both \(\lambda _1\) and \(\lambda _2\) can be updated according to Eqs. (5.15b) and (5.15c).

figure a

In real applications, the nonlinear system can be hardly approximated completely. Therefore, the approximate error is inevitable, which would influence the performance of the proposed controller. However, the approximate error is a small value of higher order, and the influence can be suppressed based on the negative feedback scheme in the outer-loop, as shown in Eq. (5.4).

Remark 5.3

The output dynamics of the proposed RNN is given in Eq. (5.15a), in which the projection operator \(P_{\varOmega }(\bullet )\) plays an important rule in handling physical constraints Eq. (5.11c), the updating of \(\dot{\theta }\) depends on three parts: the first part \(-\dot{\theta }/||\dot{\theta }||_2^2\) in used to optimize the objective function \(||\dot{\theta }||_2^2\), and the second item \(J^{\text{ T }}\lambda _1\) guarantees the equality constraint Eq. (5.11b) by adjusting the dual state variable \(\lambda _1\) according to Eq. (5.15b), and the last item \(-J_o^{\text{ T }}\lambda _2\) ensures the inequality constraint Eq. (5.11d). The RNN consists of three kinds of nodes, namely, \(\ddot{\theta }\), \(\lambda _1\) and \(\lambda _2\), with the number of neurons being \(n+ab+m\).

It is remarkable that the proposed controller is based on the information of system models such as J, \(J_o\), \(K_p\), etc., which is helpful to reduce computational cost. As to the constraint-optimization problem Eq. (5.11), the main challenge is to solve it in real-time, since the parameters in constraints Eqs. (5.11b) and (5.11d) are time varying. From Eq. (5.15), the control effort is obtained by calculating its updating law, which is based on the historical data and model information, i.e., it is no longer necessary to solve the solution of Eq. (5.11) as every step, and the computational cost is thus reduced. In the following section, we will also show the convergence of the RNN based controller.

In this chapter, we mainly concern the obstacle avoidance problem in force control tasks. It is notable that force control is mainly based on the idea of impedance control theory, which is similar to existing methods in [35, 36]. The main challenge of the proposed control scheme lies in the limitation of sampling ability of cameras, which are used to capture the obstacles. To handle the measurement noise or disturbances, a larger safety distance d can be introduced to ensure the performance of obstacle avoidance.

5.3.2 Stability Analysis

Lemma 1

(Convergence for a class of neural networks) [37] A dynamic neural network is said to converge to its equilibrium point if it satisfies

$$\begin{aligned} \kappa \dot{x}=-\dot{x}+P_S(x-\varrho F(x)), \end{aligned}$$
(5.16)

where \(\kappa >0\) and \(\varrho >0\) are constant parameters, and \(P_S=\text {argmin}_{y\in S}||y-x||\) is a projection operator to closed set S.

Definition 1

For a given function \(F(\bullet )\) which is continuously differentiable, with its gradient defined as \(\nabla F\), if \(\nabla F+\nabla F^{\text{ T }}\) is positive semi-definite, \(F(\bullet )\) is called a monotone function.

About the stability of the closed-loop system, we offer the following theorem.

Theorem 1

Given the collision-free position-force controller based on a recurrent neural network, the RNN will converge to the inherent solution (optimal solution) of Eq. (5.11), and the stability of the closed-loop system is also ensured.

Proof

Define a vector \(\xi \) as \(\xi =[\dot{\theta };\lambda _1;\lambda _2]\in \mathbb {R}^{n+m+ab}\), according to Eq.(5.15), the time derivative of \(\xi \) satisfies

$$\begin{aligned} \varepsilon \dot{\xi }=-\xi +P_{\bar{\varOmega }}[\xi -F(\xi )], \end{aligned}$$
(5.17)

in which \(\varepsilon >0\), and \(F(\xi )=[F_1(\xi ),F_2(\xi ),F_3(\xi )]^{\text{ T }}\), where \(F_1=\dot{\theta }/||\dot{\theta }||_2^2-J^{\text{ T }}\lambda _1+J_o^{\text{ T }}\lambda _2\), \(F_2=J\dot{\theta }-K_d^{-1}F+K_pK_d^{-1}\varDelta x-\dot{x}_{\text{ d }}\), \(F_3=-J_o\dot{\theta }+B\). By calculating the gradient of \(F(\xi )\), we have

$$\begin{aligned} \nabla F(\xi )=\begin{bmatrix} I/||\dot{\theta }||_2^2&{}&{}-J^{\text{ T }}&{}&{}J_o^{\text{ T }}\\ J&{}&{}0&{}&{}0\\ -J_o^{\text{ T }}&{}&{}0&{}&{}0 \end{bmatrix}. \end{aligned}$$
(5.18)

It is obviously that \(\nabla F(\xi )\) is positive definite. According to Definition 1, \(F(\xi )\) is a monotone function. From the description of (5.17), the projection operator \(P_S\) can be formulated as \(P_S=[P_{\varOmega };P_{R};P_{\Lambda }]\), in which \(P_{\varOmega }\) is defined in (5.13a), \(P_{R}\) can be regarded as a projection operator of \(\lambda _1\) to R, with the upper and lower bounds being \(\pm \infty \), and \(P_{\Lambda }=(\bullet )^+\) is a special projection operator to closed set \(\mathbb {R}_+^{ab}\). Therefore, \(P_S\) is a projection operator to closed set \([\varOmega ;\mathbb {R}^m;\mathbb {R}_+^{ab}]\). Based on Lemma 5.1, the proposed neural network (5.15) is stable and will globally converge to the optimal solution of (5.11).

Notable that the equality constraint (5.11b) describes the impedance controller, and the convergence can be found in [38]. Similarly, the establishment of inequality constraint enables obstacle avoidance during the whole process. The proof is completed. \(\Box \)

Remark 5.4

It is remarkable that the original impedance controller described in (5.11b) bears similar with traditional methods in [39] the main contribution of the proposed controller is that the controller can not only realize the force control, but also realize the obstacle avoidance, besides, the control strategy is capable of handling inequality constraints, including joint angles and velocities.

5.4 Numerical Results

In this part, a series of numerical simulations are carried out to verify the effectiveness of the proposed control scheme. First, the pure force control experiment is carried out to show the effectiveness of the force controller, and then the control scheme is further verified by testing the system response after the introduction of obstacles. Then, we examine the control performance in more general cases, including model uncertainty and multiple obstacles.

5.4.1 Simulation Settings

First of all, the planar robot used in the simulation is the same as the previous chapters. It is worth noting that in the force control task, the final actuator needs to keep contact with the workpiece, so it is necessary to distinguish between necessary contact and unnecessary collision. In this chapter, the proposed controller can handle this problem by properly selecting key points. As a result, the final effector is not considered critical in order to be in contact with an obstacle (or external environment). In order to avoid obstacles, the set of key points of the robot is defined as \({A_1,\cdots ,A_7}\), in which \(A_1\), \(A_3\), \(A_5\) and \(A_7\) locate at the center of the links, and \(A_2\), \(A_4\) and \(A_6\) are defined to be at J2, J3 and J4. The lower and upper bounds of joint angles and joint velocities are defined as \(\theta _i^-=-3\)rad, \(\theta _i^+=3\)rad, \(\dot{\theta }_i^-=-1\)rad/s, \(\dot{\theta }_i^+=1\)rad/s for \(i=1\dots 4\), respectively. The safety margin is selected as 0.01m. The coefficients describing the contact force are selected as \(K_d=50\), \(K_p=5000\). For simplicity, let \(b_0=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }}\).

Fig. 5.1
figure 1

Numerical results of compliance control without obstacles. a is the robot\('\)s tracking path and the corresponding joint configurations. b is the profile of position error along the free-motion direction. c is the profile of contact force. d is the profile of \(||\dot{\theta }||_2^2\)

5.4.2 Force Control Without Obstacles

First of all, an ideal case where there is no obstacles in the workspace is considered, and the parameters \(K_d\) and \(K_p\) are assumed to be known. The robot is wished to offer a constant contact force on a given plane. The contact force is set to be 20 N, while the direction of contact force is aligned with the y-axis of the tool coordination system. In this example, the y-axis of is \([1,-1]^{\text{ T }}\) in the base coordination. The pre-defined path on the contact plane is \(x_{\text{ d }}=[0.4+0.1cos(0.5t),0.5+0.1cos(0.5t)]\). The initial state of the robot system is set as \(\theta _0=[1.57,-0.628,-0.524,-0.524]^{\text{ T }}\)rad, \(\dot{\theta }_0=[0,0,0,0]^{\text{ T }}\)rad/s. The control gains of the proposed RNN controller are \(\alpha =8\),\(\varepsilon =0.02\), respectively. Numerical results are shown in Fig. 5.1. The tracking error along the contact plane is given in Fig. 5.1b, the transient is about 1 s. At the beginning stage, since the end-effector is not in contact with the surface, the contact force stays zero before 0.5 s. As the end-effector approaches the surface, the contact force converges to 20 N, showing the convergence of both positional and force errors. The Euclidean norm of joint velocities (which is also output of the established RNN) is shown in Fig. 5.1d, \(||\dot{\theta }||\) changes periodically, with the same cycle as the expected trajectory. The time history of the end-effector\('\)s motion trajectory and the corresponding joint configurations are shown in Fig. 5.1a, in which the red arrow indicates the direction of the contact force, and the blue arrow shows the direction of the end-effector\('\)s free-motion. All in all, the proposed controller can achieve the position-force control precisely.

Fig. 5.2
figure 2

Control performance of the proposed controller while avoiding a wall obstacle. a is the robot\('\)s tracking path and the corresponding joint configurations. b is the profile of position error along the free-motion direction. c is the profile of contact force. d is the profile of joint angles, r is the profile of joint velocities. f is the profile of the closest distance to the obstacle of each key points \(A_i,i=1,\cdots ,7\)

Fig. 5.3
figure 3

Simulation results of the established RNN while avoiding a wall obstacle. a is the profile of \(\lambda _1\). b is the profile of \(\lambda _2\). c is the profile of \(||J\dot{\theta }-b_0||_2^2\). d is the profiles of the desired and reference trajectory along x-axis. e is the profiles of the desired and reference trajectory along y-axis. f is the profiles of the objective function of the proposed controller and JPMI based method

5.4.3 Force Control with Single Obstacles

In this chapter, a stick obstacle is introduced into the workspace, which is defined as \(x=-0.05\) m. The initial states and expected values of \(x_{\text{ d }}\), \(F_{\text{ d }}\) are the same as Chap. 5.4.2.

Remark 5.5

In Eq. (5.10), we have shown the basic idea of calculating the distance between the robot and obstacles, i.e., by abstracting key points form the robot and obstacles, the distances can be the robot and obstacle can be described approximately at a set of point-to-point distances. In this example, the distance can be obtained in a simpler way. However, the obstacle avoidance strategy is essentially consistent with Eq. (5.10).

Simulation results are given in Figs. 5.2 and  5.3. The output of RNN is shown in Fig. 5.2e, when simulation begins, \(\dot{\theta }\) reaches its maximum value, driving the end-effector to move towards the desired path. And then the robot slows down quickly (after \(t\approx 0.5\)s), the robot move smoothly, as a result, the position error successfully converges to 0, and simultaneously, the contact force converges to 20 N. It is notable that at \(t=1.2\) s, the key point \(A_2\) of the robot gets close to the obstacle, as shown in Fig. 5.2f. Based on the obstacle avoidance strategy Eq. (5.15c), the state variable \(\lambda _2(2)\) becomes positive, and then the output of the RNN varies with \(\lambda _2\) (Fig. 5.3b). Correspondingly, an error (about \(1\times 10^{-3}\)m) occurs in the positional tracking, and so as the contact force (force error is about 2N). However, the RNN converges to the new equilibrium point(since the equilibrium point would change when the inequality constraint works), and both \(e_x\) and \(e_f\) converges to 0. By comparing Figs. 5.2a and  5.1a, after introducing the obstacle, the robot is capable of adjusting its joint configuration to avoid the obstacle. The distances between the key points \(A_1-A_7\) to the obstacle are shown in Fig. 5.2d, a minimum value of about 0.01m is ensured during the whole process. Using impedance model, the force control problem is transferred into a kinematic control one by modifying the reference speed Eq.(5.4). Consequently, the resulting trajectory \(x_r\) together with \(x_\text {d}\) are as shown in Fig. 5.3d, e. As an important index in the proposed control scheme, the norm of joint speed \(||\dot{\theta }||^2_2\) is wished as small as possible. Therefore, we introduce a comparative simulation, in which the solution is obtained based on pseudo-inverse of Jacobian matrix and physical limitations are not considered. Comparative curves of the objective functions are as shown in Fig. 5.3f. The RNN based controller can optimize the objective function, it is remarkable that a difference appears at about \(t=1.2-5\) s, which is mainly caused by obstacle avoidance (which is not considered in JMPI based method). Since the output of RNN \(\dot{\theta }\) is used to approximate the reference speed \(b_0\), the approximate error \(||J\dot{\theta }-b_0||^2_2\) is shown in 5.3c, demonstrating the effectiveness of the established RNN.

5.4.4 Force Control with Uncertain Parameters

In this example, we check the control performance of the proposed control scheme in presence of model uncertainties. Similar with previous simulations, the initial states of the robot are also \(\theta _0=[1.57,-0.628,-0.524,-0.524]^{\text{ T }}\)rad, \(\dot{\theta }_0=[0,0,0,0]^{\text{ T }}\)rad/s. In real implementations, the interaction model is usually unknown, and the nominal values of \(K_d\) and \(K_p\) are not accurate. Without loss of generality, we select the nominal values of \(K_d\) and \(K_p\) as \(\hat{K}_d=80\), \(\hat{K}_p=4000\), respectively. In order to handle model uncertainties in the interaction coefficients, an extra node is introduced into (5.15). Then the modified RNN can be formulated as

$$\begin{aligned} \varepsilon \ddot{\theta }&=-\dot{\theta }+P_{\varOmega }(\dot{\theta }-\dot{\theta }/||\dot{\theta }||_2^2+J^{\text{ T }}\lambda _1-J_o^{\text{ T }}\lambda _2),\nonumber \\ \varepsilon \dot{\lambda }_1&=K_d^{-1}F-K_pK_d^{-1}\varDelta x+\dot{x}_{\text{ d }}-J(\theta )\dot{\theta },\nonumber \\ \varepsilon \dot{\lambda }_2&=-\lambda _2+(\lambda _2+J_o\dot{\theta }-B)^{+},\nonumber \\ \dot{\hat{W}}&=-K_{in}\eta (F_{\text{ d }}-F)^{\text{ T }},\nonumber \end{aligned}$$

in which \(W=[K_p;K_d]\), \(\eta =[x-x_{\text{ d }};\dot{x}-\dot{x}_{\text{ d }}]\), and the positive coefficient \(K_{in}\) scaling the updating rate is defined as \(K_{in}=diag(500,20)\). Simulation results are shown in Fig. 5.4 and Fig. 5.5. Although the exact values of \(K_d\) and \(K_p\) are unknown, the closed-loop system is still stable, which can be shown from the convergence of tracking error \(e_x\) and contact force F in Figs. 5.4a and 5.4b. The change curves of joint angles and joint velocities with respect to time are shown in Fig. 5.4c, d, in which the bounded-ness of joint angles and velocities are guaranteed. The observed interaction coefficients \(\hat{K}_d\) and \(\hat{K}_p\) are shown in Fig. 5.4e, indicating that both \(\hat{K}_d\) and \(\hat{K}_p\) converge to their real values. Figure 5.5a shows the distances between the key points and the obstacle, it is obvious that all key points keep at a safe distance from the obstacle (the closest key point is \(A_2\)). Euclidean norm of \(b_0-J\dot{\theta }\) is illustrated in Fig. 5.5c, despite fluctuation occurs at about \(t=1.5\)s, the proposed controller could handle model uncertainties. The impedance model based reference trajectory and the original desired trajectory are shown in Fig. 5.5d and Fig. 5.5e. Although \(x_r\) and \(x_{\text{ d }}\) are different, the tracking error \(e_x\) along the direction of free motion and force error \(e_F\) converges to zero, as shown in Fig. 5.4a, b. The objective function \(||\dot{\theta }||^2_2\) to be optimized is given in Fig. 5.5f. The convergence of the established RNN is shown in Fig. 5.5c, despite the uncertain parameters, using the adaptive updating law, the established RNN is capable of learning the optimal solution. The spikes are mainly because of the change of \(\lambda _2\) when obstacle avoidance scheme is activated.

Fig. 5.4
figure 4

Control performance of the proposed controller while avoiding a wall obstacle with uncertain \(K_p\) and \(K_d\). a is the robot\('\)s tracking path and the corresponding joint configurations. b is the profile of position error along the free-motion direction. c is the profile of contact force. d is the profile of joint angles. e is the profile of joint velocities. f is the profile of the closest distance to the obstacle of each key points \(A_i,i=1,\ldots ,7\)

Fig. 5.5
figure 5

Simulation results of the established RNN while avoiding a wall obstacle with uncertain \(K_p\) and \(K_d\). a is the profile of \(\lambda _1\). b is the profile of \(\lambda _2\). c is the profile of \(||J\dot{\theta }-b_0||_2^2\). d is the profiles of the desired and reference trajectory along x-axis. e is the profiles of the desired and reference trajectory along y-axis. f is the profiles of the objective function of the proposed controller and JPMI based method

Fig. 5.6
figure 6

Control performance of the proposed controller in a narrow workspace. a is the robot\('\)s tracking path and the corresponding joint configurations. b is the profile of position error along the free-motion direction. c) is the profile of contact force, d is the profile of joint angles. (e) is the profile of joint velocities. (f) is the profile of the closest distance to the obstacle of each key points \(A_i,i=1,\cdots ,7\)

Fig. 5.7
figure 7

Simulation results of the established RNN in a narrow workspace. a is the profile of \(\lambda _1\), b is the profile of \(\lambda _2\), c is the profiles of the desired and reference trajectory along x-axis. d is the profiles of the desired and reference trajectory along y-axis. e is the profiles of the objective function of the proposed controller and JPMI based method

5.4.5 Manipulation in Narrow Space

In this part, we discuss a more general case of motion-force control task, in which the workspace is defined in a limited narrow space. The robot is limited by two parallel lines, namely, \(y_1=0.15\) and \(y_2=-0.15\) m. Considering the safety distance, all key points except \(A_8\) must satisfy the workspace description \(-0.14\le y\le 0.14\)m. The initial joint angles are set to be \(\theta _0=[0.393,-1.05,1.57,-0.785]^{\text{ T }}\) rad, and \(\dot{\theta }_0=[0,0,0,0]^{\text{ T }}\) rad/s. The desired path is selected as \(x_{\text{ d }}=[0.8+0.1cos(0.5t),-0.15]^{\text{ T }}\)m, and the expected contact force is \(F_{\text{ d }}=20\) N, with the direction vector being \([0,-1]^{\text{ T }}\). Simulation results are given in Figs. 5.6 and 5.7. When simulation begins, the initial position error is about 0.1 m, and the converges to zero, with the transient being about 0.5 s. Simultaneously, the contact force also converges to 20 N. In Fig. 5.7a, minimum distances between the key points to \(y_1\) and \(y_2\) are represented by blue and red curves, respectively. The tracking trajectory and the corresponding joint configurations are shown in Fig. 5.6a. During \(t=1-1.5\)s and \(t=6-13\)s, point \(A_2\) gets close to \(y_1\), during \(t=4-7\)s, \(A_4\) is close to \(y_2\). Remarkable that there exist fluctuations in positional and force errors at \(t=1\)s and \(t=4\)s, (i.e., when \(A_2\) and \(A_4\) get close to the bounds), respectively. Similar to the previous simulations, the reference trajectories are given in Fig. 5.5c, d, and the objective functions are shown in Fig. 5.5e. Using the proposed RNN controller, the robot can realize both position and force control in limited narrow space.

Table 5.1 Comparisons among The Proposed Controller and Existing Methods

5.4.6 Comparisons

In this part, comparisons among the proposed control scheme and existing methods are given to show the superiority of the RNN based strategy. The comparisons are shown in Table 5.1. In [22], an RNN based controller is designed for redundant manipulators, both obstacle avoidance and physical constraints are considered. However, the controller only focus on kinematic control problem. In [40] and [16], force control together with obstacle avoidance are taken into account, but the physical constraints are ignored. [23] develop an adaptive admittance control strategy, which is capable of dealing with force control under model uncertainties, physical constraints and real-time optimization. It is remarkable that the proposed strategy focus on real-time obstacle avoidance in force control tasks, and the controller is capable of ensuring the boundedness of joint angles and velocities. At the same time, simulations have shown the potential of optimization ability of norm of joint speed.

5.5 Summary

This chapter constructs a new collision free compliance controller based on the concept of QP programming and neural network. Different from the existing methods, this chapter describes the control problem from the perspective of optimization, taking compliance control and conflict avoidance as equal or inequality constraints. Physical constraints, such as joint angle and speed constraints, are also considered. Before concluding this chapter, it is worth noting that it is the first RNN based compliance control method, which considers collision avoidance in real time and shows great potential in dealing with physical constraints. In this chapter, Matlab is simulated to verify the efficiency of the controller. In the future, we will check the control framework of different impedance models in the physical real simulation environment, and then consider the machine vision technology and system delay on the physical experiment platform.