# Cable-Driven Exoskeleton for Ankle Rehabilitation in Children with Cerebral Palsy
## 2 Exoskeleton Development and Control Methodology
### Inverse Kinematics  
The inverse kinematics function, denoted as \(\varphi^{IK}\), computes the required cable lengths from a desired pose of the end effector. Given the target position \(\vec{r}\) and orientation \(\mathbf{R}\) of the end effector in Cartesian space, the inverse kinematics maps these to the corresponding set of cable lengths \(\vec{l}=[\vec{l}_{1},\dots,\vec{l}_{n}]\) according to  
\[\varphi^{IK}(\vec{r},\mathbf{R})=\vec{l} \tag{2}\]  
\[l_{i}=\|\vec{l}_{i}\|=\|\vec{a}_{i}-\vec{r}-\mathbf{R}\vec{b}_{i}\| \tag{3}\]  
\[\mathbf{R}=\mathbf{R}_{x}(\text{roll})\cdot\mathbf{R}_{y}(\text{pitch})\cdot \mathbf{R}_{z}(\text{yaw}) \tag{4}\]  
\[\vec{r}=(x,y,z) \tag{5}\]  
In this formulation, \(\vec{r}\in\mathbb{R}^{3}\) is the Cartesian position of the end effector's center relative to the exoskeleton's fixed coordinate system \(\{X,\,Y,\,Z\}\); \(\mathbf{R}\in\mathbb{R}^{3\times 3}\) is the global rotation matrix defined by Euler angles roll, _pitch_, and yaw; \(\vec{a}_{i}\) is the position vector of the \(i\)th motor anchor point; and \(\vec{b}_{i}\) is the local position of the \(i\)th cable attachment point on the end effector, expressed in its local frame \(\{X^{\prime},\,Y^{\prime},\,Z^{\prime}\}\). The geometric interpretation of these vectors is illustrated in Figure 9.  
Since the mechanical structure of the platform and the positions of the motors are fixed, and the end effector is assumed to be rigid and inelastic, the inverse kinematic function \(\varphi^{IK}\) enables the computation of the exact cable lengths required to guide the end effector to any desired pose during rehabilitation exercises.  
Figure 9: Geometric schematic of the ankle control module. \(A_{i}\) and \(B_{i}\) denote the proximal and distal cable anchor points, respectively. \(\vec{a}_{i}\) and \(\vec{b}_{i}\) represent the vectors to these anchor points, while \(\vec{r}\) is the target position vector of the end effector’s center. \(\mathbf{R}\) denotes the rotation matrix. \(\{X,\,Y,\,Z\}\) and \(\{X^{\prime},\,Y^{\prime},\,Z^{\prime}\}\) represent the global and local coordinate frames, respectively. Each of the four motors regulates the length of a pair of mechanically linked cables.  
Conversely, the forward kinematics function, denoted as \(\varphi^{FK}\), estimates the pose of the end effector based on measured cable lengths. This is used primarily for evaluating the system's tracking accuracy and performance.  
Computing \(\varphi^{FK}\) involves solving an overdetermined system derived from the geometric constraint that each cable defines a sphere centered at an anchor point \(\vec{a}_{i}\) with a radius \(l_{i}\). The intersection of these spheres determines the position and orientation of the end effector. The geometric formulation of the problem \(\varphi^{FK}\) is illustrated in Figure 10.  
To solve this system, a nonlinear least-squares optimization approach is adopted, minimizing the squared difference between the predicted and measured cable lengths, as follows:  
\[\psi_{i}(\vec{l},\vec{r},\mathbf{R})=\left\|\vec{a}_{i}-\vec{r}-\mathbf{R} \vec{b}_{i}\right\|^{2}-\|\vec{l}_{i}\|^{2}=0 \tag{6}\]  
\[\Phi(\vec{l})=\min\sum_{i=0}^{N-1}\psi_{i} \tag{7}\]  
Here, \(\psi_{i}\) is the error function for the \(i\)th cable, and \(\Phi(\vec{l})\) is the total objective function to be minimized. The values of \(\vec{r}\) and \(\mathbf{R}\) that minimize \(\Phi\) are interpreted as the estimated position and orientation of the end effector at the given instant.  
The forward kinematics function thus allows continuous pose estimation of the end effector using encoder measurements. This capability is essential for experimental validation, enabling accurate assessment of system performance and motion tracking during rehabilitation sessions.