## 3 Exoskeleton Control System  
The control architecture for the upper limb exoskeleton and carbon hand is shown in Figure 3. The control system is implemented in the robotic operating system (ROS), which includes task planning for activities of daily living, a complete path planning for the robotic exoskeleton, computing the inverse kinematics, trajectory generation, and controller design. Furthermore, input control signals are used to perform an ADL while wearing the robotic exoskeleton and carbon hand.  
The control system consists of four motors, controllers (Maxon EPOS4 Compact 50/8 CAN) and encoders. Moreover, a graphical interface was developed using a combination of PyQt4, Python and ROS that can be used to choose the various types of control modes, tune control parameters, sending high level control commands and real-time logging of data. A CAN bus communication is adopted as the communication method between ROS and Maxon EPOS4.  
Figure 3: An overall system control architecture. The tasks for the activities of daily living (ADL) is predefined. The PD control method is implemented for the individual joint control. A carbon hand developed by SEM glove is adopted to control the hand opening/closing movement (switch on/off control).  
_PD Control Scheme for Upper Limb Exoskeleton Robot_  
The dynamic model of an exoskeleton can be derived using the Lagrange formulation and can be expressed by the following equation  
\[M(q)\ddot{q}+C(q,\dot{q})\dot{q}+\tau_{g}=\tau \tag{6}\]  
where \(q\in\Re\) is a position vector, \(M(q)\) is inertia matrix, \(C(q,\dot{q})\) represents the Coriolis forces and \(\tau_{g}\) is the torque due to gravity. Although we have used the model-free PD/PID control scheme, the dynamic model of the system is still provided in (4) to simulate the dynamic response of the robotic exoskeleton. All entries of the dynamic Equation (4) can be found in Appendix B.  
In this article, a PD-based trajectory tracking control problem is investigated, where the joint angle trajectories \(q\) are bound to track the desired trajectories \(q_{d}\) (Algorithm 1).  
The PD control law can be expressed as:  
\[\begin{array}{l}u=K_{p}\ddot{q}+K_{d}\ddot{q}\\ \dot{q}=\dot{q}_{d}-\dot{q}\end{array} \tag{7}\]  
where \(\ddot{q}=q_{d}-q\). \(K_{p}\) and \(K_{d}\) are the proportional and differential gains, respectively.  
We stabilize the open loop robotic system (6) by using the stability property of the PD control scheme (9) and form a stable closed loop system as follows:  
\[\begin{array}{l}M(q)\ddot{q}+C(q,\dot{q})\dot{q}+\tau_{g}=K_{p}\ddot{q}+K_{d }\ddot{q}\\ \dot{q}=\dot{q}_{d}-\dot{q}\end{array} \tag{8}\]  
The equation can be written in the matrix form as:  
\[\begin{bmatrix}\ddot{q}\\ \ddot{q}\end{bmatrix}=\begin{bmatrix}\dot{q}_{d}-\dot{q}\\ \ddot{q}_{d}+\frac{1}{M}(C\dot{q}+g-K_{p}\ddot{q}-K_{d}\ddot{q})\end{bmatrix} \qquad\qquad\ddots\ddot{q}=\ddot{q}_{d}-\ddot{q} \tag{9}\]  
```
Given: * Sampling time: \(T_{s}\) * User define parameters: \(k_{p}\), \(k_{d}\) * Desired trajectory: \(q_{d}(k)\) Initialization: * \(\ddot{q}(0)=0\) * \(k\gets 0\) Repeat: * \(\ddot{q}(k)=q_{d}(k)-q(k)\), \(\dot{q}(k)=\frac{\ddot{q}(k)-\ddot{q}(k-1)}{T_{s}}\) * \(Output=k_{p}\ddot{q}(k)+k_{d}\ddot{q}(k)\) * \(\ddot{q}(k-1)\leftarrow\ddot{q}(k)\) * \(k\gets k+1\)
```  
**Algorithm 1** PD-based trajectory tracking for each joint