{'fraction_non_alphanumeric': 0.04010715082967483, 'fraction_numerical': 0.00900364610462088, 'mean_word_length': 4.5104551045510455, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Adaptive tracking control for task-based robot trajectory planning

This paper presents a -- Learning from Demonstration -- method to perform robot movement trajectories that can be defined as you go. This way unstructured tasks can be performed, without the need to know exactly all the tasks and start and end positions beforehand. The long-term goal is for children with disabilities to be able to control a robot to manipulate toys in a play environment, and for a helper to demonstrate the desired trajectories as the play tasks change. A relatively inexpensive 3-DOF haptic device made by Novint is used to perform tasks where trajectories of the end-effector are demonstrated and reproduced. Under the condition where the end-effector carries different loads, conventional control systems possess the potential issue that they cannot compensate for the load variation effect. Adaptive tracking control can handle the above issue. Using the Lyapunov stability theory, a set of update laws are derived to give closed-loop stability with proper tracking performance.


I. INTRODUCTION
Children who have severe disabilities have difficulty playing with toys because of limitations reaching out, holding, and manipulating toys. Robots are a potential tool to provide manipulation because children can control them with residual functional abilities (i.e., switches, brain signals), but it is important that play tasks can be changed quickly to keep a child's interest. For example, the pickup and drop-off locations of a toy should be easily reprogrammed, and the type of toy supported by the robot should be easily replaced. Instead of reprogramming for every location and toy weight, a child's playmate could show the robot the new task requirements.
The problem of learning and imitating a task through observation is inherently easy for humans, but a robot has to be re-programmed to perform a different task [1]. Learning from Demonstration (LfD), also known as imitation learning, provides an intuitive way to readily teach new trajectories to a robot. Instead of re-programming every new task, a task is learned from demonstrations [2]. This means a person can move the end-effector of the robot along the desired trajectory, and the robot can learn that trajectory so that it can replay it independently of the person. In this way, a child who has a physical disability can instigate the robot trajectory with whatever action they can (e.g., physical movement at a control interface or a physiological signal) to manipulate toys This work was supported by UARE program to L. Trucios independently with the robot. When they want to do a new play task, a helper can demonstrate the new trajectory to the robot.
As the haptic robot dynamics and the environment contain various uncertainties and disturbances in practical applications, one of the effective ways to deal with this difficulty is to apply an adaptive control. In [3], [4] and [5] a model reference adaptive control (MRAC) for a constrained manipulator is applied to reduce model uncertainties. Since joint acceleration is difficult to measure precisely, in [6] an adaptive impedance controller is designed without requiring estimates of acceleration.
For the purpose of having higher repeatability and accuracy, an adaptive control system is able to adjust parameters related to the robot model when the end-effector load changes frequently. In [7] a summary about "MRAC" shows that traditional controllers are not able to handle systems where their dynamic model parameters varies with respect to time.
This paper aims to design a control algorithm to perform demonstrated tasks online. This algorithm is better at handling the significant non-linearities in the system and different weight of toys that usually makes control and estimation tasks for this class of robots difficult using classical methods [8].

II. EXPERIMENTAL SETUP
We implemented a low-cost device with the idea that a system could potentially be used in homes. The Novint Falcon haptic device has a mechanism with three rotational actuators mounted to a base, and a series of kinematic parallelogram legs to constrain the motion of the end-effector to only translational movements. This form has proven itself as an excellent platform for safe pick-and-place operations due to the mechanism's low actuated inertia when compared to serial counterparts [9]. In [10] the Falcon's workspace is defined as a bounded tri-hemispherical region overlapping along the common longitudinal (z) axis.
In order to obtain motion kinematics from the trajectories performed as they are made, an interface shown in Fig. 1 between ROS and Matlab was developed. Through a USB interface, connected to the Novint, one can send the actuation commands and read encoders data via the interface. Although Novint has released a closed-source SDK, for this research, Using forward kinematics we can obtain the Cartesian points of the end-effector.
In demonstration mode, a user performs end-effector movements. Through the interface, we get points of the path followed by the end-effector. These points, along with their sampling time, are used to fit a curve by smoothing splines. The obtained curve is derived by time to obtain the velocity and acceleration of the end-effector in Cartesian space. The generated trajectory, along with their sampling time, (q,q,q, t s ) is stored for later use in reproduction mode with different toys.

III. FALCON ROBOT MODEL A. Kinematic Modelling
The manipulator kinematics consists of a mapping between the joints angle and the end-effector Cartesian position. The Novint Falcon has a unique solution for inverse kinematics, however, the forward kinematic solution is not straightforward. To overcome this issue, an iterative procedure based on the Newton-Raphson method was employed. For the sake of brevity, interested readers are referred to [11] for the detailed information about the equations.
The inverse kinematics operation results in three joint angles, θ 1i , θ 2i , θ 3i , for each leg i, which can define a possible configuration of each leg for the given position of the endeffector. Finally, the differential kinematics is defined bẏ where˙ q = [θ 11 ,θ 12 ,θ 13 ] represents a set of actuated joint angles, J is the Jacobian matrix and˙ x is a 3-dimensional velocity vector of the end-effector. It will be shown in upcoming sections that the time differentiation of the Jacobian matrix,J, will be needed in some equations. As defined in [11], the Jacobian matrix J is a function of θ ij , which are functions of time. Consequently,J will be a function of θ ij andθ ij . It should be noted thatθ ij is obtained by numerical differentiation of θ ij , and this approach inherently has estimation errors.

B. Dynamic Modelling
The dynamic system of the Novint Falcon is described in detail in [10], where the experimental identification is made using the open-source "libnifalcon". The dynamic model is described as where, τ is the torque applied to the actuators; c m , c i are constants related to the mass of the links; m is a constant related to the mass of the end-effector; c d is the viscous damping of the actuator; c s is the dry friction coefficient of the actuator; ϕ Is the offset angle of input link center of mass; a p is the acceleration of the end effector; F ext is the external force applied to the end-effector.
In order to obtain a p , one can perform a differentiation with respect to time of the differential kinematics equation (i.e., (1)) to obtain the equatioṅ (3)

C. Kinematic and Dynamic Parameters
The corresponding kinematic and dynamic parameters are presented in Table I. It is important to clarify that the estimated parameters in [10] are not in SI base units, since the torque commands that are sent to the robot firmware are also not defined in SI base units. However, it does not modify the accuracy of the applied control algorithm.

A. Controller Structure
For control purposes, the dynamic model is expressed in Cartesian coordinates based on (1), (2) and (3). We get Inspired in [8] and [9], we define an error vector s =ė + Λe, where e = x − x d represents the unconstrained path-tracking error, with x d ∈ R 3 being the desired trajectory; and Λ = diag(λ 1 , λ 2 , λ 3 ) a diagonal positive definite matrix of tuning parameters, with λ i > 0. We geṫ If there is no robot-environment interaction (e.g., F ext = 0), the dynamic model of the robot, defined in equation (4), is rewritten as It should be noted that while grasping an object, the mass of the end-effector will change. This implies that m is not known and should be estimated, and to achieve that a matrix Γ is defined as where Γ ∈ R 3x3 is a symmetric positive definite Matrix; γ ∈ [0, 1] is a tuning parameter and m is the maximum value that m can have.

B. Controller Design
The adaptive tracking control scheme, shown in Fig. 2, was based on the concept of inverse dynamics (e.g., [5], [8]), and is defined as represents the estimate of M x , G x respectively. The estimate of γ is represented in Γ by Γ = Im γ. Observe that by combining (7) and (9) the following dynamical system is obtained: If we design and appropriate update law such thatΓ → Γ, then (11) becomes Now, in order to proceed with the stability analysis, the following Lyapunov function is defined by where k is a positive constant related to the adaptive law. Since M x is a positive definite matrix, V (s,γ) is, likewise, positive definite. Additionally, notice that s T M s s → ∞ as s → ∞ andγ 2 k → ∞ as γ → ∞, which proves that V (s,γ) is radially bounded. The time derivative of V (s,γ) along the system trajectory, described in (13), can be computed aṡ (14) whereγ is replaced by −γ. Therefore, under the assumption, equation (14) becomes, Therefore (s,γ) are uniformly bounded and V (s, γ)≤0 ∀(s, γ) ∈ R 3 ×R 1 withV (s, γ) = 0⇔(s, γ) = (0 3 , 0). Hence, we can conclude that s ∈ L ∞ ∩ L 2 . From (11) we conclude thatṡ is bounded; as a result, according to the Barbarat's lemma, the asymptotic convergence of s can easily be proven. This further implies that the error e = x − x d converges, which completes the proof.

V. PROCEDURE
The procedure was as follows: -We performed a trajectory from the point (0.005; -0.052; 0.108) to the point (0; 0:05; 0:14) without supporting a toy. The interface tracked this trajectory, and extracted information such as position, velocity, etc.
-The controller had as input the demonstrated trajectory information (velocity, position and acceleration), and followed this trajectory. The parameters of the proposed adaptive tracking controller scheme (e.g., (9) and (15)) were selected as K d = 20I 3 , k = 500,γ 0 = 0.5, whereγ 0 is the initial parameter ofγ. -In the reproduction phase, after approximately 1.5 seconds a toy was added to the end-effector of the robot, and taken off at approximately 5 seconds. The controller estimated this variation, and modified its internal parameters, and thus, the use of an adaptive controller is supported.
-The error between the demonstrated trajectory (without a load variation) and the reproduced trajectory (that supported the load) was calculated. Finally, the parameter λ, which is related to the end-effector load (as seen in equation (8)), was estimated.

VI. RESULTS
The position and velocity vectors ( x(t),˙ x(t)), where x(t) was expressed as (x, y, z), related to the performed tasks, were stored as a function of time as shown in Fig. 3. Figure 4 shows the demonstrated and reproduced end-effector trajectories in 3 dimensions. It is possible to observe that the demonstrated trajectory is accurately reproduced by the endeffector even when supporting the toy.
The time evolution of the error module s is shown in Fig.  5. It can be seen that the error increased slightly when the toy is added (1.5 s) and removed (5 s) but settles to minimal quickly. The time evolution of the parameter λ, increases and decreases related to the end-effector load (i.e. the small toy), as shown in Fig. 6.
Therefore, as can be seen in Fig. 4 and Fig. 5, the reproduced trajectory follows the demonstrated path very well, as well as the load variation is accurately estimated by the adaptive controller, as shown in Fig. 6.

VII. CONCLUSION AND FUTURE WORKS
In this paper, we have proposed a robust Novint Falcon controller that can adapt to different trajectories and payload weights. In this way it can support spontaneous play tasks and different toys for children with disabilities. The suitable performance of the control scheme is supported by the stability analysis in the Lyapunov sense.
For its practical implementation, a numerical differentiation of variables (i.e. q, J) are required, which will inherently  generate error in the controller's performance, as can be seen in Fig. 3, where the velocity is not tracked as well as the position was. In order to avoid this issue, a set of gyroscopes, which gives an accurate measurement of the angular velocities, should be used by placing them on the actuator's legs.
Future work will support inputs such as brain computer interfaces and single switches so that the user can instigate the reproduction of the trajectory independently. In addition, we will develop an impedance adaptive controller to reproduce smooth movements over a trajectory. After implementing these steps, the system can be tried by children to enhance their play experience and safety.