Adaptive Position/Force Control of a Robotic Manipulator in Contact with a Flexible and Uncertain Environment

: The present paper concerns the synthesis of robot movement control systems in the cases of disturbances of natural position constraints, which are the result of surface susceptibility and inaccuracies in its description. The study contains the synthesis of control laws, in which the knowledge of parameters of the susceptible environment is not required, and which guarantee stability of the system in the case of an inaccurately described contact surface. The novelty of the presented solution is based on introducing an additional module to the control law in directions normal to the interaction surface, which allows for a fluent change of control strategy in the case of occurrence of distortions in the surface. An additional module in the control law is perceived as a virtual viscotic resistance force and resilient environment acting upon the robot. This interpretation facilitates intuitive selection of amplifications and allows for foreseeing the behavior of the system when disturbances occur. Introducing reactions of virtual constraints provides automatic adjustment of the robot interaction force with the susceptible environment, minimizing the impact of geometric inaccuracy of the environment. stability of the system in the of an inaccurately


Introduction
In recent years, in the field of robotization, rapid growth has been observed in applications of manipulator robots in tasks that require simultaneous execution of a desired trajectory and the interaction force of the end-effector with the environment. In terms of industrial applications, this refers to, inter alia, questions regarding the robotization of mechanical processing [1][2][3][4] or certain assembly tasks, but also a complex issue of the cooperation between robots and humans. A tendency towards precise force control, necessary for the correct execution of the assigned processes, is observed. In the field of industrial applications, these processes are mainly grinding [5], beveling [6], polishing [7,8], assembly [9,10], and friction welding [11,12].
The performance of the aforementioned tasks requires simultaneously executing movement in one direction and exerting force in the other direction. For instance, polishing of a surface may be performed as a result of the movement of the polishing tool on the surface and exerting force on it at the same time. From the perspective of the theory of robot control, the discussed problems refer to the control of systems with partial movement constraints [13,14]. From the point of view of mechanics, this is the solution to the problem of inverse dynamics of the system with imposed geometrical constraints. In the case of a manipulator robot moving in a free working space, that is, without contact between the end-effector and the environment, there are no constraints regarding the robot's position and it cannot develop any forces. If contact with the environment occurs, the movement of the robot is constrained and interaction forces, which need to be controlled, occur at the contact point.
Each task connected with the contact between a manipulator robot and the environment is characterized by a set of constraints, which result from the mechanical and geometric characteristics of the task [15]. For every task, the so-called generalized surface with position constraints along directions normal to this surface and force constraints along directions tangential to them may be defined. Such constraints divide possible movements of the end-effector into two orthogonal sets, whereas these movements must be controlled in accordance with different criteria. Friction forces acting in the tangential surface and resulting in the disturbance of natural force constraints constitute disturbances in the position control system and reduce the quality of control. In practice, natural position constraints may also not be rigidly maintained, e.g., due to susceptibility or inaccuracies in the description of the contact surface. Therefore, local movements of the end-effector in normal directions, which are the result of exerting force onto the surface, may occur. Significant and unknown susceptibility of the environment occurs in the case of, among others, the processing of thin-walled component parts. By comparison, the case of an inaccurately described surface of the environment originates from robotization of the processing of castings, which due to the phenomena connected with shrinking during solidification, have significant size and shape deviations.
Currently in industrial robotics, two main strategies for force control are applied in robotized processes of mechanical processing [16]. The first is based on maintaining the desired interaction force with a constant motion velocity and the trajectory is automatically adjusted to the shape of the contact surface (Figure 1a). A disadvantage of such a solution reveals itself in the example described below. If the processed surface is processed with the use of a tool with a small contact surface and if there is a cavity in the surface, it will be deepened with each passing of the tool, which is a consequence of exerting a constant pressure force and automatic adjustment of the trajectory to the surface [17]. Nonetheless, this method gives good results in applications such as polishing or grinding, when in the processed surface there are no significant cavities and the tool has a large operative surface [16]. The latter control strategy [16] is based on the movement of the end-effector of the robot along the desired trajectory regardless of the shape of the processed surface ( Figure  1b). The variable value is velocity, which is dependent on the resistances of movement. If there are significant allowances in the processed surface, large resistances of movement occur and the velocity decreases. In this strategy, the pressure force is not a controlled value. It depends on the desired trajectory and the actual shape of the contact surface. This strategy is similar to the methods of processing with the use of a CNC [18], but the difference is that the advance velocity is dependent on tangential forces. A disadvantage of this method is that there is a possibility of the lack of contact between the end-effector and the surface if the desired trajectory diverges significantly from the actual location of the contact surface, which may lead to system failures [16]. Sometimes, basic control strategies in commercial applications are modified to introduce a certain flexibility in their execution [4]. Nonetheless, they are still two separate strategies.
Disadvantages of these solutions derive from the fact that in each of them only one criterion is taken into consideration, on the basis of which the control error is defined. This is the desired interaction force or the assigned shape of the interaction surface [16]. In the case of performing certain procedures of mechanical processing, mainly finishing processes, controlling the pressure force of the tool and taking into consideration the desired shape of the processed surface at the same time is vital [7]. Moreover, in the case of processing a surface of high susceptibility, it is necessary to take its deformation into consideration [19]. The currently developed and applied force control strategies fail to allow for taking these requirements into consideration. Furthermore, in commercial applications, it is necessary to position the processed surface against the robot with precision. In the case of failure to comply with this requirement, e.g., while processing component parts of significant inaccuracy in terms of their shapes and sizes, system failures occur [16]. One of the most typical system failures occurs when the end-effector of the robot has no contact with the processed surface in the precisely defined environment of the desired trajectory. The robot increases velocity and a sudden contact with a detail takes place or the driver cancels the task.
In the field of robotized mechanical processing [4,7,14], an important and topical issue is the development and implementation of a strategy for movement control, which could provide an appropriate quality of mechanical processing, despite the occurrence of phenomena that are not modelled, e.g., caused by significant errors in the description of the geometry of the processed component parts (connected with the uncertainty of their location regarding the robot) or local disturbances of their surface [20][21][22][23][24][25][26][27][28][29]. The present paper is concerned with the synthesis of movement control systems in the cases of disturbances of natural position constraints, which are the result of surface susceptibility and inaccuracies in its description. The study includes the synthesis of control laws, in which the knowledge of parameters of the susceptible environment is not required, and which guarantee stability of the system in the case of an inaccurately described surface.

New Approach to the Problem
In the paper, a new approach to the problem of control of a robot in interaction with the environment is described. A control strategy that combines two basic strategies is proposed. Nevertheless, this approach is not a simple combination of two strategies known from scientific writings [17,30] or industrial applications [16]. One of the component strategies is based on maintaining the desired interaction force with a constant motion velocity, while the trajectory is automatically adjusted to the shape of the contact surface. The second component strategy is based on executing the desired trajectory regardless of the shape of the processed surface. The combination of these two strategies on the basis of cooperation introduces cooperation between them, therefore, the requirements of each of the strategies are executed in a "soft" way. The proposed method may be closer to either of the strategies, depending on the introduced project factor. This is the amplification factor, which is responsible for regulating the priority to exert force or position.
If the theoretical description of the surface and the programmed trajectory in the normal direction that results from it are consistent with the actual shape of the processed surface, the first basic strategy is executed (Figure 2a). This is an extreme case of system operation and control is aimed only at the control of the down force in a direction normal to the surface.
If the shape of the surface diverges from theoretical assumptions, the importance of the second basic strategy, the activity of which is dependent on the differences between the programmed trajectory and the actual trajectory in the normal direction, that is, the trajectory execution error . This is executed by introducing an additional control module , which may be understood as a reaction of the virtual interaction surface. This complements the actual reaction force in the situation of an unforeseen change in the shape of the processed surface (Figure 2b). The control error is defined in a way that leads to the cooperative connection of both control strategies, which means that in the case of distortions in the shape of the surface, none of the basic strategies will be fully executed, but the state of "balance" between the strategies will be achieved. This protects the system from the "extreme" activity of each of them. The disadvantages of basic strategies, which would occur if they were applied individually, are not revealed. This also allows using the advantages of the two basic strategies by means of fluent passage from one to the other. The activity of component control strategies and the result of their cooperative combination are presented in Figure 3.  The cooperative control strategy is not a combination of the two discussed strategies used in commercial industrial applications [16], but is a new approach to the problem. The first basic strategy corresponds with the strategy used in commercial industrial applications ( Figure 1a); it also has solid theoretical foundations and is well established in the literature [16,17,[22][23][24][25]30]. The second basic strategy fails to correspond with the presented commercial solution (Figure 1b). It originates from the position control methods [17] and its aim is to execute a trajectory that would provide an appropriate shape of the processed surface.

Dynamics of the Robot-Flexible Environment System
From the perspective of the task being performed, which is defined in the task space, it is convenient to present the dynamics of the robotic manipulator in the same space. In most practical applications, the task space is related to Cartesian space. Thus, in the discussion below, the description of the robot's dynamics in task space is used. The dynamic equations of the motion of a robotic manipulator in this space can be represented in the form [19]: where ∈ -vector of generalized coordinates (joint coordinates), ∈ -vector of task variables, ( ) ∈ × -inertia matrix, ( ,̇) ∈ × -matrix of coefficients of centrifugal and Coriolis forces, ( ,̇) ∈ -vector of friction and gravitational forces, ( , ) ∈ -vector of limited interference, ∈ -vector of control inputs, ∈ vector of interaction forces of the robot with the environment, ∈ × -matrix of system vulnerability, -the dimension of the task space (it was assumed that the dimension of the task space is equal to the dimension of the robot joint).
The vector of interaction forces has the following form: where ∈ -vector of normal forces, ∈ − -vector of tangent forces. The vector of task variables has the following form: where ∈ − -vector of tangential displacement. This decomposition of the vector of interaction forces and the vector of task variables results from the decomposition of the -dimensional task space { } into -dimensional normal subspace { } and ( − )-dimensional tangential subspace { } [31,32]. The vulnerability of the surfaces limiting the movement of the robot tip is included in the dynamics description because the system vulnerability matrix has the following form: where = × -the environmental vulnerability matrix. Equation (1) describes the system dynamics in task coordinates and is a function of kinematic motion parameters in tangential directions and forces in normal directions. The presented description of the dynamics of the system in the task space related to the surface of the environment facilitates the definition and implementation of the task to be performed by the robotic manipulator, i.e., the implementation of the motion with the pressure of the end-effector. The simultaneous introduction of variables related to motion and normal forces of interaction to the task variables vector describing the system state allows the use of the same control methods, e.g., with regard to non-linearity compensation for both position and force control. The paper [19] provides information on the transformation of the dynamics description from the robot's configuration space to the task space, and then the decomposition of the task space into tangential and normal subspaces.

Adaptive Position/Force Tracking Control
This section proposes a control strategy that can be called cooperative because it combines two different control strategies on the basis of cooperation ( Figure 3). The purpose of this approach is to supplement one strategy by the other in situations in which a given elementary strategy applied individually leads to unfavorable behavior of the robot. To properly implement the strategy, the work involved the direct measurement of interaction forces using a force sensor placed in the robot's end-effector. This ensures correct implementation of the feedback loop in the force control, even when the surface of the environment is not known exactly. The adaptive control algorithm presented in this section is based on the assumption of knowledge of the structure of the system dynamics model. Implementation of a cooperative control strategy requires the assumption of nominal contact surface geometry (determination of theoretical constraints), desired trajectory of motion and force, and knowledge of the current position of the robot's end-effector.
Assumption 1: For dynamical system (1), the following trajectories are given: -Limited trajectory of motion of the robot's end-effector in the tangential plane Limited nominal trajectory of motion of the robot's end-effector in normal directions ( ) ∈ , ̇ ( ), ̈ ( ), which results from the assumed surface shape.
Assumption 1 concerning simultaneous knowledge of the description of the nominal motion path and the force trajectory in the same direction (normal) is a significant difference in comparison to the assumptions formulated in typical issues related to position/force control. It also allows the definition of a modified control objective, by an appropriate definition of the filtered tracking error, which in the case of taking into account the inaccuracy of constraints must be different than in the case of knowing the environment surface or omitting its inaccuracy.
To define the control objective, control errors were introduced, where: is the error of motion in the tangential plane, and: is the error of force in the normal direction. An auxiliary variable ∈ is defined such that: which is related to the difference between the nominal position of the robot end-effector resulting from the theoretically existing constraints and the real position in the normal direction. That is, is the deviation of the end-effector from the assumed constraints in the normal direction. In detail, it should be added that the expression 0 = −1 is the predicted surface deformation derived from the pressure force . With high surface rigidity, this deformation is negligible, but for more flexible elements its inclusion is necessary.
In the case of disturbances of geometrical constraints, the system will be stimulated by disturbances related to surface inaccuracies. To illustrate this, Figure 4 shows the case when the end-effector of the robotic manipulator remains in contact with the surface of the environment, but the shape of this surface does not correspond to the nominal path . The aim of the control is to follow the trajectory of motion, i.e., to minimize the motion error ̃, and to follow the force trajectory, i.e., to minimize the force error ̃ if the real and nominal constraints match ( = ). In the event of their non-compliance, the goal is to minimize the error ̃− , which is a combination of force error and deviation error from the nominal constraints. This allows for the introduction of a cooperative control strategy in the normal direction, which for the co-operation gain matrix = changes into the force control strategy, whereas for > the importance of the strategy for maintaining the nominal motion path in the normal direction is strengthened in the case of imperfections in surface contact. If the real and nominal constraints match, the deviation = and only the force control strategy is implemented independently of the matrix.
To achieve the control objective, a filtered tracking error was introduced: in which: where ∈ ( − )×( − ) and ∈ × are diagonal gain matrices, ∈ × is the co-operation gain matrix. Expression (10) introduces a new approach to the problem of control in the normal direction to the surface of constraints. Compared to the approach presented in papers [19,33], in which the generalized error for normal directions depends on the force error and its derivative, here it also depends on deviation from the desired nominal motion path in the normal direction and from the derivative ̇.
Equations (8)-(10) make it possible to write the filtered tracking error with the form: and then convert it to the form: By introducing Equation (12) into Formula (1), a description of the dynamics as a function of the filtered tracking error was obtained: where there is an auxiliary variable that has the form: The non-linear part of Equation (13) is designated as: where ∈ is a function dependent on both the robot mathematical model and the environment. In particular, it depends on unknown robot parameters and unknown rigidity of the environment, but also on its possible inaccuracies. Finally, the description of the dynamics of the system has the following form: Next, the control law including the PD controller, the non-linearity compensating control ̂∈ , the term compensating the interaction force λ, and the robust term ∈ was assumed: In the control law, the expression is a form of PD control, where ∈ × is a gain matrix such that = > 0, and function ̂ approximates . The third part of the control law introduces feedback from the forces of interaction of the robotic manipulator with its environment in all directions. It is important to clarify the form of the first two parts of the control law that introduce differences in relation to the typical control laws. Regarding the first control part, it is possible to decompose the matrix according to the equation: and the part is written taking into account using Equation (11) as: where ∈ ( − )×( − ) and ∈ × are diagonal gain matrices. Then, Equation (19) is written in the form: from which it follows that, in comparison to a conventional force control containing only the elements ̃ ̇+̃, the equation also has the part-̇− . It can be written in the form −̇− . Then, = is the effective proportional gain coefficient, which can be understood as the coefficient of the virtual resilient resistance force, and = is the effective differential gain coefficient, which can be understood as the coefficient of the virtual viscous damping force. To summarize, it should be stated that, in the case of surface inaccuracy, the control −̇− becomes active, replacing the surface effect in such a way as if it had a coefficient of resilience and damping . The part ̂ was introduced into the control law of Equation (17) to compensate for the non-linear function , which depends on, inter alia, the inaccuracy of the surface , not just from the force error ̃. The non-linear function can be decomposed into two parts, one of which corresponds to the tangential directions and the other the normal direction: where: The constituent functions and described by System (22) can be approximated with the help of various techniques [34][35][36][37][38]. In the next subsection, one of these, which is an adaptation method, is presented.
The remainder of this section describes the stability of the adaptive control algorithm, which was introduced to avoid the problem of not knowing the object parameters, assuming knowledge of the structure of mathematical model of object.
Using the linearity of the and functions with respect to the parameters, the following were written: where the matrices ( ,̇, ,̇) ∈ ( − )× and ( ,̇, ,̇) ∈ 1× are called regression matrices, ∈ and ∈ are vectors of unknown parameters, , are the dimensions of the parameter space, and = 1, … , . The approximation of the functions and by ̂ and ̂ depends on the estimation of the vectors of unknown parameters, which is written as follows: where: and ̂∈ , ̂∈ are parameter vector estimates. Assuming the control law of Equation (17) where: are errors of parameter estimates. Formula (28) is a description of a closed control system as a function of the filtered tracking error and errors of parameter estimates.
In the case of inaccurate surfaces, the analysis of asymptotic stability has no practical justification, which is why proof of the practical stability of the control system is presented. To this end, appropriate assumptions were made.

Theorem 1. If the dynamic system described by Equation (1) is controlled by Equation
Proof. The description of the system given by Equation (1) was transformed into a description in terms of the filtered tracking error of Equation (16), and after the introduction of the control law of Equation (17), a closed system description (Equation (28)) was obtained, including disturbances and a robust term. To demonstrate the stability of the closed system, the Lyapunov stability theory was used. The function was assumed: where is an element of the matrix of environmental vulnerability. By calculating the derivative of Function (40) with respect to time the following was obtained: Taking into account Equation (28) in Equation (41) the following was written: Given that = , the fifth element of Equation (42) was transformed into the following form: . (43) In addition, the expression [̇( ) − 2 ( ,̇)] is a skew-symmetrical matrix (see Property 5 in [19]), therefore the following relationship emerges: Taking into account Equations (32) and substituting Equations (31) and (33) in which the matrix was replaced by submatrices ∈ ( − )×( − ) and ∈ × such that: Substituting the parameters adaptation laws of Equations (38) and (39), the following equation was obtained: Taking into account the following limitations: and robust term elements of Equations (34) and (35), Equation (48) was transformed into the form: where is the minimum singular value of . Inequality (51) was transformed into the following form: The function ̇ is negative if the expressions in square brackets are positive. These expressions are written as follows: They are positive if the errors meet the following inequalities: or: It follows that ̇ is negative outside the compact sets defined by Equations (55)-(58). According to the extension of the standard Lyapunov theory [36][37][38], it can be concluded that ‖ ‖, | |, ‖̃‖, and ‖̃‖ are uniformly ultimately bounded and the control system is stable. Therefore, the filtered tracking error and its derivative are limited, similar to the vectors of parameter estimates ̂ and ̂. □

Simulation Results
A model of a robotic manipulator was constructed, whose kinematic structure is shown in Figure 5. It is a robot with a three-link arm, at the end of which there is an endeffector with two degrees of freedom. The arm is used to reach the desired position, and the orientation of the robot's tool is accomplished by adjusting the end-effector. The endeffector is not driven directly by motors mounted on the robot arm, but by motors located in the base using a drive train. This results in the fact that the orientation of the end-effector does not depend on the position of the arm. Thus, the orientation of the end-effector can be set by locking its drives in the selected positions. In this situation, the robotic manipulator can be treated as a system with three degrees of freedom. Details on kinematics, dynamics, and parameters used in the simulation are given in Appendix A. It was assumed that the end-effector should move on a flat surface lying in the plane parallel to the plane 0 0 and distant from it by . The end-effector of the robot should simultaneously exert pressure perpendicular to the contact surface.
The desired motion path of point D is shown in Figure 6 a,b, and the profile of the desired velocity of motion is shown in Figure 6c. The positional trajectory obtained from the solution of the system of Equation (A26) at the assumed velocity of Equation (A27) is shown in Figure  7 along with the desired force trajectory in the normal direction to the contact surface. The presented control algorithm requires the nominal trajectory of motion in the normal direction to be given. This results from the assumed shape of the interaction surface and, in the case under consideration, has the form = = ., ̇ = 0, ̈ = 0. In fact, due to the pressure of the end-effector of the robot on the flexible contact surface, the condition ̇= 0 will not be strictly maintained and there will be surface deformation proportional to the pressure force. Therefore, the expected deformation of the surface with the coefficient of stiffness under the influence of the desired force ( ) is additionally taken into account, which is expressed by the variable 0 = / . To test the properties of the system in the event of an inaccuracy in the surface of constraints, a simulation was carried out assuming a disturbance of constraints consisting in a depression in the surface of 0.001 m, which is shown in Figure 8a. Changing the surface of constraints can also be understood as a change in the surface profile as a function of time during the motion of the robot end-effector (Figure 8b). The overall control signal in the task space is shown in Figure 9. At the moment of surface disturbance, the control changes in such a way that the pressure of the end-effector on the surface is smaller (from 30 to 45 s). The signals generated by individual control subsystems are shown in Figure 10. According to the control law Equation (17), they are in turn: PD control (Figure 10a,b), compensatory control (Figure 10c,d), interaction force compensation (Figure 10e,f), and robust control (Figure 10g,h). The largest control changes in the area of surface disturbance concern PD control ( Figure 10b), which contains a signal dependent on the surface inaccuracies and the control compensating for the effect of normal force 3 = (Figure 10f), affecting the total control changes described earlier. The remaining control signals then show, at most, only slight oscillations. Figure 11 presents the realized positional trajectory in the tangential directions (Figure 11a), the force trajectory in the normal direction (Figure 11c), and the deformation of the surface resulting from the implementation of this force (Figure 11b). In addition, Figure 11b shows the profile of the surface without deformation, and Figure 11c shows the desired pressure force (marked with dashed lines). Figure 11d shows deviation of the robot's end-effector from the assumed constraints in the normal direction. As a result of the pressure force causing deformation in the normal direction, the actual motion path of the robot's end-effector in the phases of realizing the down force is shifted in relation to the assumed path. It should also be noted that in the area of surface disturbance, the end-effector displacement in the normal direction is not proportional to the desired force. The actual pressure force was reduced and, as a result, the increase in the end-effector displacement was less than that of the surface disruption. In real applications, this system action will prevent the deepening of surface losses.
The control errors obtained are presented in Figure 12. Regarding the tracking error for the force trajectory in the normal direction, it should be stated that at the moment of surface disturbance, the value of force error increases (Figure 12b) and simultaneously the deviation of the manipulator end-effector increases from the assumed constraints ( Figure  11d). Therefore, the goal of minimizing the force error or the purpose of following the end-effector along a desired path in the normal direction are not fully realized. These goals are competitive and cannot be implemented simultaneously in a situation of surface disruption. However, it should be noted that the definition of a filtered tracking error in Equation (11) indicates that the simultaneous occurrence of force deviation and position deviation in the normal direction does not contradict the possibility of minimizing this error (Figure 12d). This approach favors finding a "balance" between the demands to minimize the force error and minimize the deviation from the nominal surface of the constraints. Estimates of robotic manipulator parameters are shown in Figure 13. The analysis of their waveforms shows that they are limited, in accordance with the proof of stability. The biggest changes in the parameter estimates occur in the initial phase of the motion when the control errors are greatest, and then the estimates are stabilized. This section presents the results of simulation tests with a description, with particular emphasis on the impact of the selected constraint distortion model on the control of a robotic manipulator. The test results indicate that the requirements for the control system were met. The control system is stable and knowledge of the stiffness coefficient of the environment is not required. In addition, the control system operates in the prescribed manner in the presence of a surface disturbance, providing a compromise between the implementation of the desired force and following the desired path. Depending on the chosen value of the co-operation coefficient , priority is given to achieve the desired force or nominal motion path. This is shown in Figure 14, which results from the additional simulations performed.  Figure 14 shows the influence of the gain on the operation of the control system. The graphs presented in this figure were obtained as a result of the simulation of the adaptive system operation at different values of the coefficient . Its zero value results in the implementation of a desired force regardless of surface disturbances, i.e., classic force control is implemented. The control algorithm is then identical to that shown in [19,33]. In turn, an increase in the value of coefficient causes an increase in the importance of maintaining the nominal trajectory of motion in the normal direction despite surface disturbances, which takes place at the expense of the accuracy of force realization. It should be noted that the effects of the system's action are not proportional to the increase in the value of coefficient and it is not possible to switch the system to the strategy of controlling only the position, because this would require an infinitely large value of .

Conclusions
This article presents an approach to positional force control, taking into account the inaccuracy of constraints, the implementation of which requires the adoption of a desired trajectory of motion and the course of the desired pressure force, in addition to the assumptions of the nominal shape of the surface of the environment. These assumptions introduce a difference between the method presented in the article and the standard control strategies used in position/force control. This approach makes it possible to implement force control in the normal direction to the surface of the environment, which is characterized by a kind of "flexibility" in the implementation of two elementary strategies. Introducing reactions of virtual constraints provides automatic adjustment of the robot interaction force with a susceptible environment, minimizing the impact of geometric inaccuracy of the environment.
The novelty of the presented solution is based on introducing an additional module to the control law in directions normal to the interaction surface, which allows for a fluent change of control strategy in the case of occurrence of distortions in the surface. By introducing one additional cooperation amplification factor to the classical strategy for force control, the strategy for maintaining nominal position was added, reducing the importance of the force error minimization in the case of distortions in the shape of the surface. This means of reaction of the control system is vital in the case of the interaction of a robot with inaccurately described surfaces.
An additional module in the control law may be perceived as a virtual viscotic resistance force and resilient environment acting upon the robot. Such an interpretation facilitates the intuitive selection of amplifications and allows for foreseeing the behavior of the system in case disturbances occur. Introducing the factor that amplifies the strategy for maintaining the nominal trajectory by the activity of virtual constraints reaction force allows for automatic adjustment of the interaction force of the robot with a susceptible environment.
The proposed algorithm contains a non-linear function (Equation (25)) dependent on variable and its derivative ̇, which in turn is a function of, inter alia, ̇ and ̈. The velocity error of the end-effector ̇ can be determined based on the velocity measurements of the arm links and kinematics equations. To determine the variable ̈, which depends on the actual acceleration of the robot end-effector ̈, a filtered and differential velocity signal ̇ can be used in the case of a slightly noisy signal, or the signal from an additional acceleration sensor in the robot's end-effector can be used.

Conflicts of Interest:
The author declares no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Appendix A
The dynamics of a robotic manipulator in interactions with a flexible environment is described by Equation (1), where matrices and vectors have the following form [19]: ( 1 + 2 2 + 3 3 ) where: , , -coordinates of point D in the reference system; 1 , 2 , 3 , 1 , 5 -geometric parameters of the arm; 1 , 2 , 3 -robot configuration coordinates (angles of rotation of the links).
Simplifying the description of kinematics to the three-dimensional task space without taking into account the orientation of the end-effector, one can consider the system with the three degrees of freedom resulting from the mobility of the arm, ignoring the mobility of the end-effector. The analytical Jacobian determined using Equations (A2) has the following form: Matrices and vectors ( ), ( ,̇), (̇), ( ) results from the description of robot dynamics in joint space [19], and in the case of the analysed three-link robot are given by Equations (A4)-(A12): (A4) 11 = 2 1 1 2 + 2 2 ( 1 + 2 2 ) 3 + 0,5 3 cos(2 2 ) + 0,5 4 cos(2 3 ) + 5 , (A5) -viscous friction coefficient in the th kinematic pair, -moment of dry friction forces in the th kinematic pair.
The task space of the robotic manipulator { } was separated into the tangential subspace { } and normal subspace { }, taking two tangential directions, 1 = and 2 = , and one normal direction, = , which were included in the kinematics equation: ].
The velocity of the end-effector in the case under consideration is a three-dimensional vector: and its value is determined by the formula: It was assumed that the interaction forces of the robot with the environment in task coordinates are described by the following equations: are the cosine and sine of the angle between the friction force and the 1 axis, and the "-" signs in the counters of the first two elements result from the opposite return of the friction force relative to the velocity. The first element of the interaction force vector is therefore a projection of the friction force vector on the 1 axis, and the second element of this vector is a projection on the 2 axis. Parameters occurring in the dynamic equations of motion of the robotic manipulator-environment system are given in Table A1. The force is one of the controlled variables, therefore it is required to adopt a desired force trajectory in the normal direction ( ) ∈ 1 , ̇( ), ̈( ). The desired force depends on the process, the implementation of which requires an appropriate pressure force. Usually, in machining processes, there are assumed to be intervals of constant pressure force, possibly with a transitional period in which the force is to be smoothly increased or reduced to an appropriate value. The tests assume a pressure force with a defined maximum value , which is to be smoothly achieved, and is ensured by assuming the desired pressure force according to the formula: where is the maximum pressure force, > 0 is the coefficient related to the rate of increase and decrease in force, and determine the time of increase and decrease in force, ∈ (0,70) s. The desired force meets the limit | | ≤ , and its first and second derivatives with respect to time are limited so that |̇| ≤ and |̈| ≤ 2 . Equation (A18) ensures that in the normal direction the desired pressure force is continuously non-negative and has a continuous first and second derivative with respect to time.
The next controlled variables are the position and velocity of the end-effector in the contact plane. It is known that the possible velocity must be tangential to the motion path, i.e., to satisfy the equation: (ℎ( ))̇= 0, where ℎ( ) = is the equation of the motion path. To describe a path in a three-dimensional space requires two equations, i.e., ℎ 1 ( ) = 0 and ℎ 2 ( ) = 0, so it can be written as: ℎ( ) = [ℎ 1 ( ) ℎ 2 ( )] = . In the analyzed example, the contact surface is two-dimensional, so there are two tangential directions along which the end-effector of the robot can move. It was assumed that the motion takes place in a circle with the given equation: where determines the position of the circle centre and is the circle radius. The circle lies in the plane given by the equation: where determines the distance of the contact plane from the plane ( Figure 5). The condition (A19) can be written as follows: and then as a system of two equations: The second equation of the System (A24) results in the velocity in the normal direction ̇= 0, which means that there is no planned motion of the robot end-effector in this direction, and the velocity components in the tangential directions must fulfil the first equations of the System (A24). In addition, they must satisfy Equation (A16), taking into account that ̇= 0. This gives another set of equations: where ̇ is the maximum desired velocity, > 0 is the coefficient related to the speed of acceleration and deceleration of the end-effector, and determine the acceleration and deceleration time of the end-effector, ∈ (0,70) s. The desired velocity of motion meets the limit |̇| ≤̇, and the desired acceleration meets the condition |̈| ≤̇.
The parameters of the positional and force trajectory are listed in Table A2. The parameters of the control system are presented in Table A3.
where the coefficient of vulnerability of the environment is taken into account. Matrices of parameter adaptation gain and were selected as diagonal matrices: