An Adaptive Assistance Controller to Optimize the Exoskeleton Contribution in Rehabilitation

: In this paper, we present a novel adaptation rule to optimize the exoskeleton assistance in rehabilitation tasks. The proposed method adapts the exoskeleton contribution to user impairment severity without any prior knowledge about the user motor capacity. The proposed controller is a combination of an adaptive feedforward controller and a low gain adaptive PD controller. The PD controller guarantees the stability of the human-exoskeleton system during feedforward torque adaptation by utilizing only the human-exoskeleton joint positions as the sensory feedback for assistive torque optimization. In addition to providing a convergence proof, in order to study the performance of our method we applied it to a simpliﬁed 2-DOF model of human-arm and a generic 9-DOF model of lower limb to perform walking. In each simulated task, we implemented the impaired human torque to be insufﬁcient for the task completion. Moreover, the scenarios that violate our convergence proof assumptions are considered. The simulation results show a converging behavior for the proposed controller; the maximum convergence time of 20 s is observed. In addition, a stable control performance that optimally supplements the remaining user motor contribution is observed; the joint angle tracking error in steady condition and its improvement compared to the start of adaptation are as follows: shoulder 0.96 ± 2.53 ◦ (76%); elbow − 0.35 ± 0.81 ◦ (33%); hip 0.10 ± 0.86 ◦ (38%); knee − 0.19 ± 0.67 ◦ (25%); and ankle − 0.05 ± 0.20 ◦ (60%). The presented simulation results verify the robustness of proposed adaptive method in cases that differ from our mathematical assumptions and indicate its potentials to be used in practice. Contributions: Conceptualization, R.N. and A.A.; methodology, R.N. and A.A.; writing, R.N. and A.A.; simulation, R.N. and M.S.; data analysis, R.N. and M.S.; visualization, R.N. and M.S.; review editing, R.N. and A.A. and M.S.; funding acquisition A.A.; project administration A.A.; A.A.


Introduction
Every year, millions of people suffer from motor impairments around the world due to Spinal Cord Injury (SCI), Stroke, and Cerebral Palsy. These individuals suffer from reduced muscle control ability, which demonstrates itself in reduced torque generation and lack of ability to modulate mechanical impedance about the joints. They often suffer from symptomatic muscle control, for instance, due to spasticity [1,2]. A high portion of these individuals could benefit from rehabilitation techniques for restoring their motor capacity [3]. Several methods have been developed to reconnect the lesion site in SCI such as stem cell techniques or by bypassing the lesion using neuroprosthetics [4,5]. Neuroprosthetic technologies [6] such as pharmacological stimulation [7] and functional electrical stimulation [8,9] have been used to recover the affected movements. Intensive activity-therapy based rehabilitation showed evidence for long-term motor recovery in SCI [10,11]. In addition to rehabilitation purposes, locomotor training with exoskeletons have huge potentials for improving individuals' experience of daily activities, improving their mental condition, and preventing muscle loss in the long term; see [12].
In order to maximize rehabilitation outcome, the rehabilitation and assistance level should maximally engage each individual user in the motor task. Developed work on Assist as Needed (AAN) strategies for exoskeleton control are aimed towards reaching this goal [13,14]. Hence, we can enable the users to continue intensive training while remaining engaged.
These benefits of locomotor training have motivated several research studies to present new rehabilitation controller strategies. An effective control strategy should partially assist the user while allowing voluntary active movements and permit the users to maximally engage their neuromuscular system [13,14]. This strategy promotes neuroplasticity [15] and, in the long term, may result in neural control recovery of the affected limbs [10,11]. From this perspective, the main challenge for controller design is to identify the borders of the affected neuromuscular system capabilities: how much user can contribute? Accordingly, the control structure should be tunable for each individual and account for the alternations of user performance during training, i.e., it should be adaptive.
There are several perspectives in the robotic field that can address this property. For instance, in human-robot interaction, the reference trajectories are adapted to the human's intended trajectory through interaction force minimization; see [13,[16][17][18][19][20][21]. For instance, Jezernik et al. [19] presented three different control strategies for minimizing the interaction force between exoskeleton and user during walking, however, none of them could guarantee the convergence to a cyclic, stable, and reliable walking pattern. The main assumption behind reference trajectory adaptation based on interaction force minimization is that the user can generate cyclic and reliable patterns. This assumption is not valid for individuals with motor impairment and, thus, we cannot fully rely on their exhibited trajectory and trajectory adaptation by means of interaction force minimization as it might results in a failure; this is already addressed in [19] where even changes in the control structure cannot improve the performance of trajectory adaptation.
From another perspective, the AAN controller can be realized by the minimization of exoskeleton actuator torque while tracking error is reduced; it forces the exoskeleton to only compensate for tracking error reduction and prevents any further contribution. There are several works which address this idea to adapt the reference trajectory and to guarantee reliable performance (see [22][23][24][25]). In [22], a classic control (similar to LQR) cost function is suggested to train the robot motions and to extract a control rule, which is the AAN. In the next step, this work is developed (in [23]) for rehabilitation during walking. Moreover, refs. [24,25] present impedance/compliant control approaches to optimize the exoskeleton contribution to the gait. Another perspective is to design a vector field for the assistive torque profile, which applies torque to the joints proportional with velocity (see [26,27]).
Adaptation in muscle level (using myoelectric sensors) is another alternative to having an AAN controller. In this scenario, the controller command is adapted according to real-time biofeedback from EMG muscles to regulate (maximize/minimize) the user contribution to the motion. For instance, Nasiri et al. [28] introduced a general adaptation rule to optimize the robotic assistive torque which minimizes the actuator torque. This adaptation rule is extended for wearable robots in [29,30] and its generality for lower limb exoskeletons is studied in [31]. However, in SCI individuals, the muscles' EMG signals are not sufficiently reliable for controller adaptation.
Human dynamics can resemble a multi-joint manipulator system and, accordingly, an alternative approach is to employ the adaptive control approach suggested for robotic systems [32][33][34][35]. By using a similar perspective, in this paper, instead of trajectory adaptation, we adapt the assistive torque profile of the exoskeleton while a low gain adaptive PD controller guarantees the stability of close loop during assistive torque adaptation. Although the PD controller tries to control the user joints over a reference trajectory, in our method the PD gains are sufficiently low to allow the user to have voluntary motions around the reference trajectory and most of the task is performed by adaptation of assistive torque which assists as needed, i.e., our controller is a type of AAN.

Problem Statement
Consider Figure 1 which describes the control schematics of the Adaptive Assistance Controller (AAC). In this block diagram, the user applied torque ( τ h ) indicates the contribution of the human to the gait/motion. AAC assists the human-exoskeleton system to perform the desired task and the AAC controller command ( τ e ) contains four main blocks: reference trajectory ( q d ), required torque ( τ r ), PD controller ( τ pd ), and the adaptation rule block which optimizes the exoskeleton assistive torque ( τ a ) and updates the PD controller gains. Note that in our mathematicsx ∈ R n×n , x ∈ R n , x ∈ R are matrix, vector, and scalar, respectively. The exoskeleton controller compensates for the user applied torque to perform the desired trajectory ( q d ∈ R n , where n is number of the joints) using the human-exoskeleton joint position ( q ∈ R n ) as the only sensory feedback. The required torque block generates the required torque profile ( τ r ∈ R n ) as a function of the desired trajectory; the required torque is a torque profile, which is sufficient to move the human-exoskeleton system over the desired trajectory. Here, we assume that the user is performing a rehabilitation task in which the desired motion is designed by physiotherapist and it is provided; hence, both q d and τ r are known.
The adaptation block utilizes the tracking error ( e ∈ R n ) and the required torque ( τ r ) to optimize the assistive torque profile ( τ a ∈ R n ) and, accordingly, updates the PD controller gains. The adaptive PD controller ( τ pd ∈ R n ) is considered in the control loop to ensure the stability of the system during assistive torque ( τ a ) adaptation. The PD controller torque is equal to τ pd =K p e +K d˙ e whereK p ,K d ∈ R n×n are diagonal matrices with positive values which contain time-varying proportional and derivative gains for each joint.
Here we present an adaptation rule to optimize the assistive torque profile for humanexoskeleton system. The optimal assistive torque ( τ * a ) profile supplements the human applied torque ( τ h ∈ R n ) to perform the desired task, i.e., τ r = τ h + τ * a [29].

Mathematics
Consider the dynamical equations of the human-exoskeleton system as follows: where H(.) represents the dynamical equations of human-exoskeleton system. Similar equation can be used for upper limbs or lower limbs. If the joint trajectories moves on the desired trajectory, then q ≡ q d → e ≡ 0. In this case, the PD controller torque is τ pd ≡ 0 and we can replace q with q d in dynamical equations and compute the required torque to move over the desired trajectory as: However, in general, the human-exoskeleton system's actual trajectory would have errors with respect to the reference trajectory ( q = q d + e), where the PD controller can guarantee an upper bound for the tracking error, i.e., e T e ∞ < λ. In this case, the dynamical equations can be rewritten as follows: where τ e is the error torque added to model inconsistency between the required torque and dynamical equations; if e ≡ 0 → τ e ≡ 0, τ pd ≡ 0. In the rest of the mathematical analysis, without loss of generality and for the sake of simplicity, we focus on one joint of the system and develop the mathematics only for that joint; clearly, all of the presented mathematics can also be presented in the vector and matrix format.

Optimal Assistive Torque
The optimal assistive torque profile is the torque profile that supplements the human torque profile as τ * a = τ r − τ h . From another perspective, by using Equation (2), the assistive torque profile is optimal if and only if the contribution of PD controller in movement control is minimized. Hence, to optimize the assistive torque profile in an online manner, we consider a cost function based on the minimization of PD controller torque.
The torque applied by the PD controller is a summation of proportional and derivative terms, with the proportional term providing a greater contribution in low dynamic regimes. Hence, in order to minimize the contribution of PD controller and optimize assistive torque profile, the indirect chosen cost function is the squared of tracking error J = e 2 . Minimization of this cost function results in minimization of the PD controller torque, which indirectly optimizes the assistive torque profile.

Assistive Torque Adaptation
In order to extract the adaptation rule for the assistive torque optimization, we define τ a = ατ r where α is the exoskeleton contribution gain and 100α determines what percentage of required torque should be compensated by exoskeleton. Therefore, if α = 0 means zero exoskeleton contribution then the task is completely performed by the user, while if α = 1 means exoskeleton maximum contribution then the task is completely performed by exoskeleton. The values between α ∈ [0, 1] mean a portion of the required torque is applied by the user and if α > 1, then it means the user is resisting against exoskeleton assistance. Finally, for rehabilitation purposes, we can choose α < 0 and the exoskeleton resists against the user and will require him/her to apply extra torque to perform the task. In this paper, the users with motor impairments, α ∈ [0, 1], have been considered.
The optimization of exoskeleton contribution gain (α * ) is equivalent to optimizing the assistive torque (τ * a ). In order to extract the adaptation rule for optimization of α, we apply gradient decent over the defined cost function asα = 2γe∂e/∂α. By replacing τ a = ατ r and τ pd = K p e + K dė in Equation (1), we can compute ∂e/∂α as τ r /K p . Hence, the adaptation rule is computed as follows:α where is the adaptation rate; increasing (decreasing) increases (decreases) the rate of adaption and consequently affects the convergence precision. Hence, the exact determination of is a trade-off between speed and accuracy of converged solution.
The proposed adaptation rule (in Equation (3)) only utilizes the tracking error and required torque to optimize the exoskeleton contribution. It does not require any information about user impairment level and it is completely autonomous. In addition, it is important to note that this adaptation rule is extracted without any strong assumption on the dynamics of the human-exoskeleton system or any assumptions with respect to human applied torque; it is general and applicable for both upper limb and lower limb exoskeletons. Finally, the adaptation rule is extracted without any assumptions on the desired reference trajectory as long as the trajectory is known; hence, it is applicable for periodic and non-periodic tasks.

Convergence Proof
Assuming that the user can apply a portion of the required torque as τ h = βτ r . In this case, the optimal contribution gain (α * ) is computed using optimal assistive torque equation In order to prove the convergence of the adaption rule (Equation (3)) to the optimal contribution gain (α * = 1 − β), we compute the tracking error using Equation (2) as follows.
By replacing τ a = ατ r and τ h = βτ r we have the following.
By replacing e into the adaptation rule (Equation (3)), we have the following.
Assuming that the PD controller can guarantee small tracking error; we have τ e ≈ 0,ė ≈ 0. Hence, we can write the following adaptation dynamics.
By considering a Lyapunov function as V = (α + β − 1) 2 , the time derivative of the Lyapunov function is computed as follows.
The derivative of the Lyapunov function is a negative definite function of α. Hence, based on the Lyapunov stability theorem [36], the system is globally asymptotically stable and convergent towards α * = 1 − β.

Adaptive PD Controller
An appropriate PD controller for engaging human assistance tasks is a low gain PD controller that does not impose the trajectory to the joints. However, since the user cannot perform the task alone and, in the course of assistive torque adaptation, the PD controller should guarantee closed-loop stability. Therefore, the PD gains in the course of adaptation should be increased and, after the convergence of the assistive torque profile to its optimal value, the gains can be reduced. In order to adapt the PD gains, we utilize again Equation (3). In the process of adaptation,α increases and, once the adaptation is converged,α diminishes to zero. Accordingly, we set the PD gains to a moving average of |α| plus a minimum value as follows: where K 0 p , K 0 d > 0 are minimum PD gains, T > 0 is the window size, and G p , G d > 0 are PD gain amplifiers. In this format, once a new adaptation is triggered, |α| increases and it amplifies the PD gains by magnitude of G p , G d to ensure the closed-loop stability in the course of adaptation. Moreover, once the adaptation is settled (|α| ≈ 0), the PD gains return to their minimum values K 0 p , K 0 d .

Results
In order to study the performance of the proposed adaptation method to optimize exoskeleton contribution gain and to ensure the stability of closed-loop system, we utilized two different simulation models: (1) a 2-DOF manipulator system which is a representation of simplified human-arm performing task in sagittal plane; (2) a detailed dynamic walking model of the human lower limb with 9-DOF; see Figure 2. The first model is a nonlinear 2-DOF manipulator with unit masses (l 1 = l 2 = 1 m) and lengths (m 1 = m 2 = 1 kg) and gravity acceleration (g = 9.81 m/s 2 ) simulated in MATLAB SimMechanics. The second model is a generic dynamical model of human lower limb with 9-DOF, human body mass distribution, and human anthropometry. This model is simulated in OpenSim [37] and controlled using MATLAB Simulink; for more details about our simulator, please refer to ( [38], Sec IV).

Human Simplified Arm Simulation
The task is to move the hand on a circle with radius of r = 0.5 m and frequency of ω = 5 rad/s where the circle origin position w.r.t. shoulder is at (x 0 , y 0 ) = (1 m, 1 m). The required torque for each joint is recorded using precise dynamics of the model. In this simulation, the controller parameters are set as follows: adaptation rate shoulder = 0.1, elbow = 1, PD initial gains (K 0 p , K 0 d ) = (10, 1), PD gain amplifiers (G p , G d ) = (10, 1), and moving average window size T shoulder = T elbow = 0.5 s.
Here, we consider two different scenarios. Scenario 1: Human torque is proportional to the required torque (τ h = βτ r ), which is exactly the same as it is assumed in our mathematics; this case has resemblance to incomplete SCI cases [39]. In Scenario 2, we consider the human torque as a nonlinear function of the required torque, i.e., τ h = f (τ r ), in contrast to our convergence assumption. Scenario 2 allows testing the generality and robustness of the adaptation rule in cases that drastically violate our considered assumptions.
In Scenario 1, it is assumed that user contribution to the gait at the start of task is β = 0.5 for shoulder joint and β = 0.3 for the elbow joint; in this case, the exoskeleton optimal contribution gains are α * = 0.5 for the shoulder joint and α * = 0.7 for the elbow joint. In order to check the performance of adaptation and stability of the control loop, the user contribution at t = 25 s suddenly increases to β = 0.7 for the shoulder and β = 0.5 for the elbow joints; in this case, the exoskeleton optimal contributions are α * = 0.3 for the shoulder joint and α * = 0.5 for the elbow joint.
In Scenario 2, a dead-zone function is considered to create the nonlinear and nonsmooth relation between human torque and required torque (τ h = f (τ r )). The dead-bands for the shoulder and elbow joints are [−10, 10] Nm and [−5, 5] Nm, respectively. In this case, the optimal exoskeleton contribution cannot be computed analytically. Figure 3 illustrates the simulation results for Scenario 1. It can be observed that for t < 25 s, the exoskeleton contribution gains for both joints converged to their optimal values in 15 s, i.e., α * = 0.5 at shoulder joint and α * = 0.7 at the elbow joint. For t > 25 s, the change in human applied torque re-triggered the adaptation, which converges to its corresponding optimal contribution gains in 5 s; α * = 0.3 for shoulder joint and α * = 0.5 for the elbow joint. Figure 3b,c shows the adaptive PD controller gains demonstrating an increase in PD gains at the start of simulation and at t = 25 s to ensure the stability of control loop. Comparing Figure 3a-c shows that once the adaptation is converged, the PD gains are lessened to their minimum values. Tracking error is depicted in Figure 3d manifesting the stability of the closed-loop human-exoskeleton system thanks to the concurrent adaptation of feedforward contribution gain (α) and the PD controller gains; joint tracking error (mean ± s.t.d.) and error reduction for shoulder and elbow joints are reported in Table 1. After the adaptation settles to the optimal contribution gains, the tracking error magnitude remains below 2 • ; minimization of tracking error is our main adaptation objective. Finally, the desired trajectory and the required torque profile for each joint are reported in Figure 3e,f.   Figure 4. Despite violation of the convergence assumption in this scenario, the adaptation rule successfully adapts the exoskeleton contribution gains to their optimal values in 15 s (see the converging gains in Figure 4a). Similar to Scenario 1, while the adaptation rule optimizes the exoskeleton contribution gain, the PD controller gains are increased to maintain the stability of the closed-loop system (see Figure 4b,c). Interestingly, in this challenging scenario, the humanexoskeleton system can guarantee a minimum level of tracking error while the adaptive PD controller gains are diminished to their minimum values (see Figure 4d where tracking error is lower than 5 • ). Joint tracking error (mean ± s.t.d.) and error reduction for shoulder and elbow joints are reported in Table 1. Finally, the torque profiles for both shoulder and elbow joints are reported in Figure 4e,f, respectively. In these figures, the exoskeleton torque supplements the human torque such that their summation is approximately equal to the required torque, i.e., it proves that the contribution gain is converged to an optimal value.

Human Dynamic Walking Simulation
The task is to perform a normal dynamic walking with forward velocity of 1.2 m/s. In order to perform normal walking, the desired ankle, knee, and hip trajectories are set the same as human normal walking (in sagittal plane) (see Figure 5e). In addition, the joint required torques are selected according to the human inverse dynamics torque to perform normal walking; see Figure 5f. The first 60% of each stride percentage is stance phase and the rest 40% is the swing phase. The controller parameters are reported in Table 2. The initial PD gains (K 0 p , K 0 d ) are set high, since the controller should ensure both closedloop stability and a movement stability, i.e., a non diverging movement. A significant miss-match with referent trajectory can results in a falling scenario. In this simulation, we significantly violated our assumptions for the convergence proof, where walking has hybrid dynamics with several zero dynamics [40]; human dynamics during walking cannot be expressed by Equation (1).
In order to investigate the adaptation performance of AAC in the face of variations in user applied torque, for each joint, the user contribution gain (β) is changed twice during the normal walking task; the variation times are t 1 = 50 s and t 2 = 110 s. The human contribution gains (β) are selected based on [39] to simulate an individual with motor capacity reduction with some similarities to an incomplete Spinal Cord Injury (i-SCI); the more distal the joint, the less torque the person can apply with less contribution gain. For each time interval and joint, the human contribution gains (β) and the resultant exoskeleton optimal contribution gains (α * = 1 − β) are reported in Table 3.  The simulation results for lower limb assisted walking are reported in Figure 5. As it can be observed in Figure 5a, for each time interval the exoskeleton contribution gains for each joint are converged to their optimal values reported in Table 3; the maximum convergence time is 20 s at the first interval t ∈ [0, 50]. In addition, Figure 5b,c illustrates the adaptation of PD gains in the course of walking. Based on these figures, each variation in the human contribution gains triggers a new adaptation process for the exoskeleton contribution gain and, consequently, amplifies the PD controller gains. The RMS tracking error is reported in Figure 5d, which indicates the performance of AAC to track the desired trajectory; joint tracking error (mean ± s.t.d.) and error reduction for hip, knee, and ankle joints are reported in Table 4. Regardless of significant changes in the user applied torque (τ h and β), ACC can guarantee stable dynamic walking. In dynamic walking, stability contains mechanical and state stability. Mechanical stability means that the model should not fall during walking and state stability indicates the stability of the joint positions and velocities. Accordingly, this complex simulation on 9-DOF model of human walking demonstrates the potential of the proposed controller to be used in lower limb exoskeletons.

Discussion and Conclusions
In this paper, we present a new adaptive control schematic in order to optimize the assistance level of an exoskeleton. The proposed controller is a combination of an adaptive feedforward and adaptive feedback controllers. The adaptive feedforward controller determines the assistance of the exoskeleton to perform the desired motion, while the adaptive feedback controller guarantees the stability of the closed-loop system in course of adaptation. In order to allow user voluntary motions relative to the reference trajectory, the initial PD gains are very low; however, once adaptation of the feedforward gain is triggered, the PD gains are also amplified deceptively to ensure the stability. The adaptation rule optimizes the feedforward controller by adapting a proportional gain, which is called exoskeleton contribution gain. This value determines the assistance level of the exoskeleton.
The increase in PD gain in our controller during the adaptation of feedforward torque is also in line with previous human motor control experiments indicating an increase in mechanical impedance in unstable tasks [41] and the benefits of co-contractions, which are equivalent to high gain PD control, in accelerating the internal model formation [42]. The human central nervous system modulates muscle activation to generate the required torque and variable mechanical impedance at our joints to move and stabilize our motion [43]. Despite existing efforts in identifying mechanical joint impedance [44][45][46][47], multi-joint mechanical impedance have not yet fully uncovered during motion. In order to improve our simulations, the variable impedance can be also implemented in the future.
The adaption rule can optimize the exoskeleton contribution gain relative to the severity of human impairment and compensates for the required torque to perform the desired task. All of these are performed without any knowledge about user impairment level or motor capacity; the adaptations are fully autonomous and the required torque and the reference trajectory are known. Here, we apply the method on a simplified 2-DOF model of human-arm and a generic 9-DOF model of lower limb by considering three different types of human impairments. (1) The impairment in the upper limb: A user who can provide the torque profile proportional to but lower than the required torque; (2) impairment in the upper limb: a user whose torque is not proportional to the required torque; (3) impairment in lower limb: a user with reduced torque generation capacity and control gains in more distal limbs. In all of the simulation scenarios, the adaptation method successfully converges to the optimal values and guarantees the mechanical and closedloop stability of the systems. These simulation results investigate the applicability of the proposed method for rehabilitation purposes for both upper or lower limb exoskeletons.
As future work, we will consider developing this method for an upper/lower limb exoskeleton and test it first in a realistic closed-loop dynamical simulation, such as in [48]. Upon verification in realistic simulations, we will implement the proposed method in practice where we will validate the applicability of the method in real world. One of the most interesting usage of the proposed method is the presentation of a metric to measure the human and exoskeleton contribution relative to the gait/motion. The exoskeleton contribution gain can be used as a metric to measure the user impairment level at the start of rehabilitation process. It can also measure the improvement/performance of the user in the course of training; the lower the exoskeleton contribution gain, the higher the user contribution/performance.