A Passivity-Based Strategy for Manual Corrections in Human-Robot Coaching

In recent years, new programming techniques have been developed in the human-robot collaboration (HRC) field. For example, walk-through programming allows to program the robot in an easy and intuitive way. In this context, a modification of a portion of the trajectory usually requires the teaching of the path from the beginning. In this paper we propose a passivity-based method to locally change a trajectory based on a manual human correction. At the beginning the robot follows the nominal trajectory, encoded through the Dynamical Movement Primitives, by setting high control gains. When the human grasps the end-effector, the robot is made compliant and he/she can drive it along the correction. The correction is optimally joined to the nominal trajectory, resuming the path tracking. In order to avoid unstable behaviors, the variation of the control gains is performed exploiting energy tanks, preserving the passivity of the interaction. Finally, the correction is spatially fixed so that a variation in the boundary conditions (e.g., the initial/final points) does not affect the modification.


Introduction
In the last few years, a growing attention on physical human-robot interaction and collaborative robotics has allowed to convert robots into collaborators that work in industries side by side with human operators.As a consequence, robot programming has to be more intuitive, easily accessible by people who do not have software knowledge prerequisites and easily adjustable without a code rebuilding.Only through this natural human-robot synergy, will future systems be able to combine human expertise with robot endurance and precision.Learning from Demonstration paradigm ( [1]) enables robots to autonomously perform new tasks, adding the capacity of learning and generalizing an initial taught operation.
Many techniques are available for teaching a robot a desired behavior.For example, 3D motion capture systems allow to learn from visual observations, while haptic devices allow to control the robot from a remote place.However, kinesthetic teaching is commonly used to teach the robot the desired task in a cooperative scenario.In walk-through programming (see, e.g., [2]) the user can grab the end-effector of a robot and take it along the desired trajectory in the space.At the same time, the poses are recorded in such a way that the robot can play back the trajectory shown by the operator.This simple strategy lacks flexibility since it is a mere record and reproduce operation.If an obstacle appears along the trajectory or a portion of it is unsatisfactory, a new trajectory has to be taught from scratch.
Different strategies have been developed for flexibly dealing with online task modifications and data encoding.Refs.[3,4] propose a probabilistic approach to learn and generalize multiple human demonstrations.The collected data are encoded in a Hidden Markov Model and a Gaussian Mixture Regression exploits the joint probability density function of these data to derive the regression and generalize the motion.Ref. [5] propose a model based on Hidden Semi-Markov Model (HSMM) and Cartesian impedance control to teach the robot in-contact tasks.The robot is able to smoothly satisfy the task position and force constraints according to the HSMM state belief.Ref. [6] model a motion as a nonlinear autonomous dynamical system while the learning algorithm finds out the optimal parameters through a mixture of Gaussian functions.Time invariance and global asymptotic stability at the goal ensure the system reaction to perturbations during the movement.Ref. [7] combine Learning from Demonstration and adaptive control for teaching a robot a physical interaction task, sharing a load between the human and the robot partner.The adaptive control algorithm tunes the impedance parameters to ensure an accurate reproduction.A wide and detailed review on various Learning from Demonstration techniques can be found in ref. [1].
A successful control strategy that allows the robot to learn and generalize a trajectory is the Dynamic Movement Primitives (DMPs) ( [8,9]).The trajectory is encoded using stable nonlinear attractor systems and it can be adapted to varying boundary conditions.For example, a change of the execution speed or the final target can be done by re-parameterizing the time scale or the goal, while preserving the qualitative behavior of the system.Obstacle avoidance can be implemented in the system: the obstacles are modeled as repulsive potential fields that automatically force the control system to circumnavigate them in a reactive way, as shown for example in ref. [10].However, the obstacles positions have to be known in advance and the produced deviation is not completely predictable.In addition, a dedicated sensor for obstacle detection needs to be mounted.In ref. [11], a strategy for adapting the trajectory to external perturbations and to deal with uncertainties has been proposed.However, the variation of the trajectory is somehow unpredictable.
In a cooperative scenario, humans and robots share the same workspace for executing a task together.It is very likely that the user needs to change the trajectory in a precise way and with a specific shape.This trajectory can be generated, for example, by the DMPs.This trajectory modification can be applied if the environment surrounding the robot changes, for maintaining a desired relative pose between obstacles and the robot, to adapt the robot motion to varying postures of different operators, or for adding a temporary working point.This problem is referred to as "robot coaching".
In this paper we present a safe and easy-to-use strategy to apply manual changes to a trajectory.The user directly grabs the end-effector and guides it throughout the correction while the robot is executing the nominal trajectory.This online modification is more intuitive for the human operator than a software modification: no additional procedures or coding skills are required and external cameras or dedicated sensors are not needed.Hence, this strategy can be applied in a cooperative industrial scenario where robots work closely to different users, that can be either experienced operators with software programming skills, or inexperienced ones.Furthermore, we consider position-controlled robots that are made compliant through the admittance control ( [12]), by means of a force/torque sensor placed on the robot end-effector.This strategy allows to easily implement the proposed method on different industrial robots.
When the robot follows the nominal trajectory, the gains in the admittance control are set to high values, while during the interaction, low values of the parameters allow to obtain a compliant robot behavior.Since in a collaborative scenario the safety of the human operator is of paramount importance, the parameters variation must avoid the generation of unsafe robot behaviors, due to the loss of passivity of the system ( [13]).Many solutions are presented in literature to handle with variable gains in impedance/admittance control (see e.g., [14][15][16]), but they are mainly focused and developed according to the specific task the robot has to perform.The use of energy tanks ( [17,18]) has been introduced to flexibly handle energy exchanges.Energy tanks have been used for guaranteeing a non conservative but passive behavior in interactive systems (see e.g., [19][20][21]).With the capability of storing the dissipated energy of the system, energy tanks allow to implement a passive inertia variation ( [22,23]) and a stiffness variation ( [13]) in admittance control.Nevertheless, we propose a strategy that allows to vary the stiffness parameter in admittance controlled robots.This strategy guarantees a higher flexibility with respect to ref. [13] still preserving passivity.
We presented a preliminary version of the proposed method in ref. [24]: at first we teach the robot the desired trajectory exploiting the walk-through programming.Then the trajectory is encoded using DMPs, which allow to generalize the motion by changing the execution speed or the initial/final point.Once the desired start and goal positions have been set, the robot tracks the nominal trajectory by means of high gains in the admittance control.If the user wants to change a portion of the trajectory, he/she applies the manual correction: the controller detects the grasping force and it makes the robot compliant and easily maneuverable.The user executes the correction and releases the end-effector somewhere nearby the nominal trajectory.The controller detects the releasing action and the new portion of the trajectory is optimally joined to the nominal one.In the meantime the admittance control is made stiff again and the amended trajectory is recorded.
A limitation of ref. [24] shows up when the user changes the initial/final points of the trajectory.In fact, the overall modified trajectory is encoded in a unique set of DMPs, and a change of these points causes a space shifting of the applied modification.However, once the correction has been made, it is important to preserve it despite a change in the boundary conditions.This could help, for example, to avoid a fixed obstacle in the space.Indeed, if the correction shifts, the previous correction becomes useless and the user has to manually re-apply another correction, wasting time and risking a collision with the obstacle.
To overcome this limit, we propose a new strategy based on a trajectory segmentation.The overall modified trajectory is divided into three parts, where the central one embeds the correction that has to be kept fixed.Whereas the initial point of the first part and the final point of the third one can be changed.
It is worth noting that, unlike ref. [24], in this paper the exploitation of DMPs becomes crucial.Indeed we exploit the capability of the DMPs to adapt the motion depending on the initial and final points.Other learning methods might not have this property and the proposed method to maintain the modification unchanged cannot be applied.
Finally, we present a comparison between the proposed method and the repulsive potential method presented in ref. [9].This decision was made to show the effectiveness of our method with respect to a common approach, applied since the beginning of the DMP development.
This paper is organized as follows: in Section 2 a comparison between our method and related works is presented.In Section 3 the problem statement is presented, while in Section 4 the proposed solution implying the use of energy tanks is described.In Section 5 the optimization method to join the old trajectory with the applied correction is introduced.Section 6 describes the control architecture, while the experimental results are illustrated in Section 7. Finally, conclusions are drawn and future works are presented in Section 8.

Related Works
Different approaches are available in the literature to modify a taught robot behavior in the context of Human-Robot Interaction.Several approaches are based on voice or gestures, that are given as a feedback by the human coach to the robot.For example, ref. [25] address the problem of teaching a task to a mobile robot by means of multiple demonstrations and instructions.If a portion of the task needs to be refined or changed, a voice feedback is given by the human coach.Nevertheless, ref. [26] implement an active learning method for Human-Robot Interaction (HRI), to autonomously modify a trajectory after robot's voice questions.Despite the simplicity of a verbal or gestural interaction, the robot has to be endowed with a voice recognition system or a vision system, that may be expensive and not trivial to handle for an inexperienced user.
Ref. [27] exploit the positive and negative human feedback to modify the robot behavior.This feedback is obtained from facial expressions of the human trainer during the interaction with the robot.A wearable device that captures EMG signals allows to interact with the robot in a natural manner, expressing feeling and emotions, as if it was another human.A similar approach, based on gesture recognition, is presented in ref. [28].The authors propose to modify the existing behaviors encoded by DMPs according to human coaching gestures.These gestures are suggested by pointing towards the part of the movement that has to be changed.The pointing gestures are encoded to generate a virtual force field that affects the movement in a recursive way.However, external sensors or vision systems are required to give the robot the correct feedback.
Gestures and voice commands are often combined with a physical HRI to manually drive the robot through the correction.In the scenario described by ref. [29] a person, acting as a coach, interactively directs the humanoid behavior to a desired outcome.Human-robot communication is realized through vocabulary and physical interaction.A direct student-coach dialog allows to resolve ambiguities and a physical guide of the robot allows to demonstrate a correction of the trajectory.Nevertheless, refs.[30,31] implement robot coaching by using visual and force feedback to change the imitation-related error signal.If the user is not satisfied with the periodic pattern, he/she can change parts of the motion through predefined gestures or physical contact.This type of approach is not very intuitive for users that do not have a strong experience.Moreover, the visual information is not always available in industrial scenarios or occlusions can arise.
To avoid the use of vision systems or external devices, kinesthetic teaching is often used to manually apply the desired correction to the robot behavior.Ref. [32] propose a method for role adaptation when the robot performance is unsatisfactory.When the human persistently exerts strong forces that unambiguously show the human intent to lead, the robot yields and becomes the follower.The resulting controller is a variable impedance controller where the damping and stiffness parameters are concurrently adapted.However, the authors do not address an accurate discussion about stability.Ref. [33] propose an approach for motions teaching that combines observational demonstrations and kinesthetic demonstrations.If a portion of the motion needs to be changed, the human teacher applies the correction by physically guiding the robot joints.The already learned motion primitive is incrementally updated and the old data are slowly forgotten.The robot is made compliant by means of an impedance controller.However, the method cannot be implemented on common industrial robots since it requires a compliant robot.Ref. [34] proposed a method for changing the faulty last part of a taught trajectory.The operator can grab the end-effector and demonstrate the correct motion, pressing and external button to switch from the trajectory tracking to a compliant mode.The main drawback is that only the last part of the motion can be changed and external buttons are required for swapping among two types of controllers.
In ref. [35], if the environment changes, the user can intervene and modify part of the trajectory, exploiting shared control and reinforcement learning.The user applies manually the desired correction several times and the control weights are adjusted through shared control.Nevertheless, other works exploit Reinforcement Learning ( [36]) and Iterative Learning Control ([37]), but these methods require several demonstrations of the task, hence they are more time consuming and computationally demanding.

Problem Statement
The focus of this work is to create a stable strategy to apply manual corrections to a taught trajectory.A problem that needs to be tackled is that some energy is injected in the system during the variation of the admittance control gains.Hence, the passivity is lost and an unstable behavior can be generated.This is unsafe for the human operator, that is working in tight cooperation with the robot.In this section we formally discuss the problem and demonstrate what causes this loss of passivity.
If we equip an industrial manipulator with a 6 degrees of freedom (DOFs) F/T sensor placed on the end effector, a compliant behavior can be obtained through the admittance control ( [12]).The admittance control is a very well known strategy for controlling the interactive behavior of a robot, by means of the force applied by the user.This force is tracked by the F/T sensor and, together with the desired trajectory set-point, represents the input of the admittance control.By properly tuning the inertia, stiffness and damping parameters, the computed output is the position that has to be given to the low-level robot control.
Formally, the dynamics of the admittance control is represented by: where M d , D d , K d ∈ R 6×6 are the desired symmetric positive definite inertia, damping and stiffness matrices respectively.x(t) ∈ R 6 and x d (t) ∈ R 6 are respectively the robot pose (The low-level position controller is designed and tuned in such a way that the tracking error is negligible, namely x x d , where x d is the reference position computed by the admittance control) and the desired pose.x(t) is the pose error, with x(t) = x(t) − x d (t), and F ext ∈ R 6 is the external force measured by the 6-DOFs F/T sensor.
In the cooperative scenario we aim at developing, the user directly interacts with the robot by manually applying the correction where needed.Hence, the robot has to be very stiff while tracking the nominal trajectory, and compliant during the manual correction.
As a consequence, the time-varying admittance model has to be considered: In order to preserve their physical meaning, we assume that M d (t), D d (t) and K d (t) are symmetric and positive-definite for all t ≥ 0. We consider a uniform increase/decrease of the parameters.This means that Ṁd (t), Ḋd (t) and Kd (t) are symmetric and definite (either positive semidefinite or negative semidefinite).However, when considering time-varying parameters, the passivity of the admittance control is lost.Considering the non negative total energy as a storage function: The variation of the energy function is given by: Using ( 2) in ( 4) we obtain: Since the inertia and stiffness matrices are time-varying, the term between the brackets can be positive.Hence, some extra energy can be injected in the system by the controller.This energy increasing would destroy passivity, leading to an unstable and unsafe behavior of the robot.
In the proposed cooperative system, the objective is to change the stiffness parameter between two values.During the trajectory tracking, K d needs to be big to guarantee that the elastic term keeps the robot close enough to the desired trajectory.During the manual correction, K d needs to be very small to make the robot compliant and easily driveable by the user.Hence, we consider variable stiffness but constant inertia and damping parameters, i.e., M d (t) = M d and D d (t) = D d .M d and D d are properly selected, depending on the robot and the task.
Thus, (5) becomes: Since D d ≥ 0, the first term in the brackets is always negative and energy can be introduced only by the second term, when the stiffness increases.

Energy Tanks for Passive Stiffness Variation
The loss of passivity described in Section 3 can be dangerous when the user is tightly cooperating with the robot as he/she does during a manual correction.To avoid the generation of unstable behaviors, we exploit energy tanks.The role of an energy tank is to store the energy dissipated by the system and to make it available for the implementation of active behaviors.
If we augment the admittance model in (2) with the tank state z(t) ∈ R, and considering constant damping and inertia parameters, the overall system becomes: where are, respectively, the dissipated power due to the damping and the dissipated/injected power due to the stiffness variation.
The parameter γ ∈ {0, 1} enables/disables the injection ( Kd (t) ≤ 0) or the extraction ( Kd (t) ≥ 0) of energy from the tank.It is defined as: The parameter ϕ ∈ {0, 1} enables/disables the storage of dissipated energy due to the damping factor.It is defined as: where is the energy stored in the tank.In order to avoid the implementation of practically unstable behaviors ( [38]), the maximum amount of energy stored in the tank is limited by the upper bound T. On the opposite side, it is important to avoid the extraction of energy when the tank is nearly empty, avoiding singularities.This means that no more energy is available for passively implementing active behaviors, i.e., augmenting the stiffness in our case.For this reason we define an energy lower bound δ such that δ ≤ T(z(t)) ≤ T.
Finally, the tank initial state is set to z(0) such that T(z(0)) > δ.
The evolution of the tank energy can be written as: Exploiting (7) it is possible to prove the following result: Proposition 1.If T(z(0)) ≥ δ for all t ≥ 0 the (7) is passive with respect to the pair (F ext (t), ẋ(t)).
In conclusion, Proposition 1 states that it is possible to implement an active behavior, like the increment of stiffness, as long as there is energy in the tank.Nevertheless, it is important to guarantee that the variation of the stiffness does not deplete the tank, generating unwanted behaviors in the system.
In the following we propose a condition on the stiffness variation that ensures the tank never gets empty and the system remains passive.
As shown in (7) and in (8), when the stiffness increases (i.e., Kd > 0) energy is extracted from the tank.The maximum value of energy extraction depends on the actual energy stored in the tank.If we assume that the stiffness variation occurs in a predefined and finite time interval, we can consider a generic time interval t i , t f where Kd > 0.
From (9), γ(t) = 1 for all t ∈ t i , t f .From (12) the energy of the tank at t f is given by: In order to avoid depleting the tank during the variation interval, it is sufficient that T(t f ) ≥ δ.Hence, using (18): which can be reformulated as: This means that the energy extracted in the interval is at most equal to the energy initially available beyond the lower bound δ.
Consider a matrix A positive semidefinite, the following property holds: Hence, since we are considering the case where Kd is symmetric and positive semidefinite, we can write: where is the maximum value for the eigenvalues of Kd (t) over the time interval in which the parameter variation occurs, while is the maximum tracking error that the robot can experience in its workspace.
In the proposed scenario, when the robot is tracking the desired path, x is very small.x can be bigger when the user is applying the correction.Nevertheless, the correction is usually done in the proximity of the generated trajectory and, therefore, x M can be small.
In order to satisfy (20) and exploiting (22), we obtain the condition that has to be satisfied when increasing the stiffness on any interval: The constraint ( 25) can be simplified when considering the very common case where K d (t) = diag (k 1 (t), . . ., k 6 (t)).In this case: Consequently, ki ≤ λ M and ( 25) can be rewritten as a condition on every element of the diagonal, i.e.: Equation (27) shows that the more energy in the tank that is initially available, the faster is the variation that can be passively implemented.The shorter the time interval along which the variation is done, the faster the variation can be done.
It can happen that the energy stored in the tank is not sufficient to implement the initial high stiffness value.In this case it is necessary to apply the maximum increase possible with the available energy and wait for some other energy to plan another increment, to reach the desired value.
In conclusion, when the operator manually applies a correction, the stiffness is decreased for making the robot easily driveable.This operation does not affect the passivity and the safety of the system.When the operator releases the robot end-effector after the correction, the increase of the stiffness allows going back to the trajectory tracking phase.This active behavior can be implemented according to condition (27) in order to maintain the passivity of the overall system.The length of the interval is a design parameter.

Braking Damper
When the robot tracks high-speed trajectories and the user grabs the end-effector to apply a correction, usually making the robot compliant is not enough.A high velocity corresponds to a high value of kinetic energy that the user has to compensate.Even if passivity would still be guaranteed, to drive the robot along the desired path requires a big effort from the user.
In order to help the user and to further simplify the task while preserving a passive and safe behavior, we propose to add a temporary damping to the system during the correction.Formally, the admittance dynamics becomes: where B(t) ∈ R 6×6 , B(t) ≥ 0 is an additional damping factor defined as: If the robot speed during the trajectory tracking is bigger than a predefined threshold X ∈ R, X > 0, an extra damping B > 0 is activated when the user applies the manual correction.This external damping would help the user to slow down the robot.If the robot moves slowly enough, no extra damping is needed.
The term B(t) does not affect the passivity of the global system.Intuitively, B(t) is a dissipative term and it will never bring a production of energy.Formally, it is straightforward to show that using (28) instead of ( 7) in Proposition 1 would cause the same results.

Optimization
After the manual correction has been done, the user releases the end-effector somewhere near the nominal trajectory.The distance from the nominal trajectory depends on the accuracy of the user and the size of the correction.Hence, a joining path connecting the last point of the manual correction and the nominal trajectory needs to be generated.The simplest solution is a linear interpolation between the release point and the closest point on the nominal trajectory.However, this simple approach has some drawbacks: first, a linear interpolation results in an abrupt motion and a sharp conjunction to the old trajectory.If we consider as a target point the closest one on the nominal trajectory, it could happen that some important parts are not executed, for example some curvatures.
In order to smoothly embed the correction with the nominal trajectory generated by the DMPs, we design an optimal trajectory.It starts from the end of the correction and includes the retaining trajectory, i.e., the portion of the trajectory generated by the DMPs starting from the corresponding point and reaching the end.The corresponding point is defined as the pose where the robot would be at the same time the end-effector has been released if it had tracked the old trajectory.
As suggested in ref. [34], the optimal trajectory containing the correction and the retaining path should satisfy the following objectives and constraints:

•
It has to stay as close as possible to the retaining path; • It has to start where the correction ends, with the same direction; The transition between the correction and the retaining path has to be smooth and with a moderate curvature.
Thus, it is possible to find the optimal path by solving the following convex optimization problem: minimize where the generic trajectory y ∈ R 6 .The objective becomes to generate a new optimized trajectory y opt that minimizes a cost function, weighted by two factors.The first one states the distance between the optimized trajectory and the part of the old trajectory to retain y rtn .The second one models the trajectory curvature by means of the second-order finite difference operator N) and weighted by the parameter ε > 0.
The parameter ε represents the curvature of the trajectory that joins the releasing point to the old trajectory.For small values of ε, y opt goes rapidly toward the old trajectory.For high values, the curvature is wide and the old path will be reached later.For values near to zero the optimization degenerates to a mere interpolation.The two constraints ensure that the first point of the optimized trajectory corresponds to the last point of the correction (denoted with N) and the two trajectories grow in the same direction.For more details see ref. [34].

Proposed Control Architecture
The control architecture of the proposed system is represented in Figure 1.First, the initial trajectory is encoded through the DMPs and the DMP Trajectory component generates the desired path to be tracked by the robot, sending the each desired position x d to the Admittance Control.In the meantime, the force/torque sensor measures the wrench F ext that is applied by the human operator when the manual correction is applied.If objects are attached to the robot end-effector or if collisions with the environment occur, a low pass filter can be added ( [39]) to avoid the detection of undesired forces.The Admittance Control uses the wrench information coming from the sensor, along with x d , to compute the reference position that has to be followed by the robot low-level position control.Industrial robots are typically position-controlled in the joint space, hence the inverse kinematics is necessary to convert the Cartesian admittance output into the joint pose q re f .When the robot tracks the trajectory and no contact with the operator occurs, the force measured by the sensor is zero.The high value of the stiffness parameter allows the robot to track x d precisely.If the operator wants to modify a portion of the trajectory, he/she applies the manual correction by grasping the end-effector and the force measured by the sensor is different from zero.The State Machine recognizes the interaction: the stiffness is reduced to a very small value and the braking damper B is activated if needed (as reported in Section 4.1).The robot is made compliant exploiting the stiffness reduction and it becomes easily manoeuvrable by the human. .The passivity of the system is preserved since a stiffness reduction does not inject extra energy in the system.Once the correction is finished, the operator can release the end-effector somewhere nearby the nominal trajectory.The DMP Trajectory component finds the corresponding point and identifies the part of the old trajectory that has to be retained, i.e., y rtn .
When the correction has been done, the operator can release the end-effector somewhere nearby the nominal trajectory.The DMP Trajectory component computes the corresponding point and selects the part of the old trajectory to retain y rtn .Then the Trajectory Optimization component computes the optimized trajectory toward the old path y opt (as described in Section 5), that will be the new trajectory to be tracked.In the meantime, the Trajectory Record component records all the positions followed by the end-effector (x r ), including the human corrections.Finally, the robot will be able to recreate the overall modified path.
To avoid instability problems described in Section 3, we exploit Energy Tanks: during the execution of the nominal trajectory and the manual correction, this component stores the virtual energy dissipated by the system, according to (11).Once the correction is done, the tank computes the maximum value of the stiffness K d that can be implemented, according to (27).The stiffness augmentation allows to properly restore the tracking of the optimized trajectory while guaranteeing the passivity of the system.
A limitation of the system proposed in ref. [24] is represented by a space shifting of the applied modification.When the initial or the final points of the overall modified trajectory are changed, the embedded modification is shifted accordingly.However, it is important to keep the correction fixed in the space, otherwise it becomes useless.For example, if the correction was made to avoid an obstacle and the path shifts, the collision avoidance is not guaranteed anymore.Nevertheless, the user has to manually apply another correction, wasting time.
To overcome this limit, we propose a new strategy based on a trajectory segmentation.The overall modified trajectory is divided into three parts: γ 1 , γ 2 , γ 3 .The first trajectory γ 1 starts at the initial point of the overall trajectory and ends at the beginning of the correction; γ 2 coincides with the manual modification; γ 3 starts at the end of the modification and embeds the optimized trajectory.
Based on the force signal and a state machine, three sets of DMPs are created: γ 2 represents the modification, in which the parameters are constant (i.e., the trajectory is constant).On the opposite, γ 1 presents a variable initial point and a fixed goal, γ 3 presents a fixed initial point and a variable goal.As a result, we obtain a variable trajectory where the start and the goal positions can be changed, but the correction remains fixed, as depicted in Figure 2.This operation of encoding the trajectory in different DMPs sets does not affect the passivity of the system, since it does not require energy exchanges.The stiffness variation is performed as described previously and in Section 4. A similar approach can be extended when considering multiple corrections and p sets of DMPs: γ 1 , γ 2 , ..., γ p .

Experiments
We performed experimental tests on a KUKA LWR 4+ (http://www.kuka-robotics.com/en)provided with an ATI Mini45 (http://www.ati-ia.com/)6 axis F/T sensor, in order to validate the theoretical findings presented in this paper.Figure 3 shows the experimental setup and the accompanying video (in Supplementary Materials) shows the experiments described in the following.The bowling pins are used to simulate the obstacles in the environment, while the robot moves in the space to avoid them.Even though the KUKA LWR 4+ robot is provided with compliant control strategies (i.e., Cartesian and joint impedance), the joint position control has been exploited to emulate the common industrial set-up, where the low-level control is typically a position one.The software components have been developed through the Orocos framework (http://www.orocos.org/toolchain)and they run with a 500 Hz frequency, except for the recording that updates every 0.3 s.In ref. [24], preliminary results on a single correction and multiple corrections to the taught trajectory are presented.The evolution over time of the energy level in the tank and the admittance parameters are shown.
In this work we present further results, in particular the initial and final points of a trajectory are changed exploiting DMPs properties, while keeping the correction fixed.In addition, to show the effectiveness of the proposed method, a comparison with the repulsive potentials [9] is presented.
For both of the experiments, the following admittance parameters values were used: while the initial value of the stiffness matrix is: A suitable value of ε was chosen as a trade-off between the execution of all the geometric characteristics of the path and a smooth overall trajectory.In our experiments, ε = 2.

Fixed Correction When Changing Initial and Final Points
As described in Section 6, when a change in the initial/final point of the trajectory is applied, the desired modification is shifted accordingly.Hence, the proposed method allows to keep the correction spatially fixed, avoiding a further manual modification.
Figure 4 shows a trajectory example along the yx plane.The dashed black line represents the trajectory where the human operator has applied the manual correction (highlighted in the yellow box).This correction can be performed, for example, to avoid an obstacle (gray circle).If the initial and final points are shifted, the DMPs allow to generate a new trajectory with the same qualitative behavior, represented by a dotted purple line.However, the correction itself has been shifted and the obstacle is not avoided anymore.With the proposed algorithm, the correction does not spatially change despite the new initial and final points and the resulting trajectory is represented by a solid blue line.

Comparison with Repulsive Potentials Method
To show the effectiveness of the proposed method, a comparison with the repulsive potential method is presented.We made this decision since the repulsive potential is one of the most common approaches in literature to avoid obstacles.In addition, it is embedded in the theoretical definition of DMPs, where the force generated to avoid the obstacle is added to the dynamical system as a coupling term [9].
Figure 5 shows a trajectory example along the yx plane.The obstacle is depicted as a gray circle, the nominal trajectory as a dashed black line.To avoid the obstacle, the human operator grabs the robot end-effector and applies the desired modification, resulting in the overall trajectory depicted with a solid blue line.Conversely, once the obstacle position is defined, a coupling term can be added to the dynamic system to incorporate obstacle avoidance.The resulting trajectory is represented by a dotted red line.The main idea is to compute the angle between the current robot velocity and the direction to the obstacle, and steer away from the it.However, the obstacle position has to be known a priori and the trajectory deviation is somehow unpredictable.As shown in the figure, the user cannot control the shape of the correction and a larger portion of the trajectory is modified.
With our method, the correction is applied in a precise way according to the user preference and only where it is strictly needed.In addition, no visual systems have to be implemented to know in advance the obstacle position.Finally, if the trajectory presents a faulty part or the user is not satisfied with the taught behavior, local and multiple corrections can be applied.

Conclusions
In this paper we presented an online method to apply multiple corrections to a robot trajectory.At the beginning, the initial trajectory is taught exploiting a walk-through programming technique and then encoded through the Dynamical Movement Primitives.During the trajectory tracking, the human operator can intervene by manually applying a correction.When he/she grabs the end effector, the robot is made compliant by means of a stiffness variation.To avoid instability issues during the transition from zero stiffness to a high value, the energy tank is introduced to preserve the passivity of the system.Furthermore, the proposed method keeps the applied correction spatially fixed when the initial/final points of the trajectory are changed.The experiments show the effectiveness of the proposed method and a comparison with the repulsive potential method is presented.

Figure 1 .
Figure 1.Control architecture of the overall system.

Figure 2 .
Figure 2.Proposed method to maintain the correction.i 1 and f 1 are the initial and final points of the trajectory where the user applied the manual correction (green line).i 2 and f 2 are the initial and final points of another trajectory that is encoded using the same sets of DMPs but keeping the correction constant in the space.

Figure 4 .
Figure 4. Comparison between the trajectory generated with the proposed algorithm (solid blue line) and without (dotted purple line), when changing the initial and final points.The trajectory with the manual correction is represented by a dashed black line and the obstacle with a gray circle.The manual correction that has to be constant is highlighted.

Figure 5 .
Figure 5.Comparison between the trajectory generated with the proposed algorithm (solid blue line) and the one generated with the repulsive potentials method (dotted red line).The nominal trajectory is depicted with a dashed black line and the obstacle with a ray circle.