## 3 Impedance-Based Assist-as-Needed Controller  
### Design of the Controller  
In order to realize the assistance rehabilitation training of the upper limb, a band-type AAN controller is designed in this paper by building a virtual FTR around the predetermined trajectory. The patient's arm has complete freedom when moving within the FTR, which is a zero-impedance region, while the robot would provide a time-varied adjustable assistance force when deviating from the FTR. The patient's functional ability is evaluated through the deviation between the patient's hand and the predetermined trajectory during the rehabilitation training. The greater the deviation, the worse the patient's functional ability is, approximately, and the greater the assistance force needed to be applied by the robot is to assist the patient's arm to finish the rehabilitation task. Generally, the movement of a patient's upper extremity during the training is slow. Studies have shown that compared with fast rehabilitation training, slow rehabilitation training has a better effect on the recovery of a patient's upper limb motor function [41]. Otherwise, compared with the influence of velocity on the robot's assistance force, the impact of position is more significant. Therefore, the AAN controller proposed in this paper mainly focuses on the position of the patient's upper extremity, and the model between the motion of the patient's upper limb and the robot's assistance force can be established as follows:  
\[K(x_{cur}-x_{des})=F_{assist} \tag{9}\]  
where \(K\) is the stiffness coefficient matrix; \(x_{cur}\) and \(x_{des}\) are the positions on the actual and desired trajectory of the patient's arm, respectively. A robot-aided rehabilitation control strategy based on the Equation (9) has been realized in research [42; 43]; however, the spatial motion freedom of the patient's upper limb in these studies is limited. In order to solve this tendency, a spatial channel with an adjustable radius was added to the rehabilitation trajectory in the impedance-based  
Figure 4: Schematic diagram of the transformation from the joint space impedance control model to the Cartesian space impedance model. AAN controller, which enables the patient's upper limb to have complete freedom, which is shown in Figure 5. The black curve in Figure 5 is the predetermined trajectory, the blue curve is the actual trajectory of the patient's hand, and the red area is the virtual channel with full freedom set for the patient. Since the patient's hand and the handle are connected together through a bandage, the position of the patient's arm can be solved by the kinematic model of the manipulator, assuming that \(P_{act}(x_{a},y_{a},z_{a})\) is the actual position coordinate of the patient's hand, \(P_{ref}(x_{d},y_{d},z_{d})\) is the desired position of the patient's arm during the training, and \(P_{NN}(x_{N},y_{N},z_{N})\) is the point on the desired trajectory that nearest to actual position of the patient's arm. For an arbitrary trajectory \(R\), \(P_{start}\) and \(P_{target}\) are assumed to be the starting and ending points of the trajectory, respectively, and a cylindrical virtual channel with an adjustable radius \(R_{W}\) is added around the trajectory. To better express the schematic of the FTR, it is simplified to a planar case, as shown in Figure 6. According to Equation (9), the magnitude and direction of the assistance force provided by the robot are related to the reference position during the rehabilitation training. Since the position of the patient's hand is time-varying, a searching algorithm is needed to define the real-time reference position of the patient's hand. First, the point \(P_{NN}\) that is nearest to the actual position of the patient's arm on the training trajectory is solved:  
\[\|P_{NN}(R)-P_{act}\|^{2}\doteq min \tag{10}\]  
A region with the width \(R_{W}\) is then defined around the FTR to better define the reference position during the training.