## 3 Spherical Robotic Positioning Device
### Control and Motion Compensation  
In this study, the robot was controlled using two methods according to the experiment. In the experiment to measure the repeatability of the robot, open-loop control was used to command the robot in the joint space through the inverse kinematics when the position of the target was determined by the Cartesian coordinate system. In the other two experiments, the robot was controlled using the PBVS method [9] to compensate for unpredicted human movements. The PBVS technique requires a 3D pose estimation process, but the controller used in the conventional Cartesian coordinate system can be used as it is. In this study, the marker-based 3D tracking device was used for neuro-navigation. The navigation program delivers the posture information of the end-effector of the robot and the subject's head by inter-process communication. This tracking device is described in detail along with the coordinate systems in the next section. The block diagram of the motion compensation control is given in Figure 5. The coordinate system used for this feedback control is discussed in detail in the next section. Figure 4: (**a**) 3D-model of the spherical robotic positioning device and prototype with enclosure, (**b**) workspace of the device in given conditions. The position and orientation errors used for feedback control were defined as follows. The position error (\(\mathbf{e}_{p}\)) is defined using the difference between the desired position (\(\mathbf{p}_{d}\)) and current end-effector position (\(\mathbf{p}_{e}\)) in Euclidean geometry,  
\[\mathbf{e}_{p}=\mathbf{p}_{d}-\mathbf{p}_{e}. \tag{4}\]  
The orientation error depends on the expressions of rotation. The rotation matrix was used for the inverse kinematics of the robot when the target posture was defined in the previous Section 3. The rotation matrix \(R\) is a matrix that rotates the direction while preserving the length of the arbitrary vector \(\mathbf{z}\) as in Equation (5) and belongs to a special orthogonal group. \[\mathbf{z}^{\prime}=\mathbf{R}\mathbf{z},\ \mathbf{z}=\mathbf{R}^{T}\mathbf{z}^{\prime} \tag{5}\]  
The rotation matrix has the advantage that there is no singularity, unlike the Euler angle, but it is difficult to adjust the gain. Other studies have used the error in the rotation matrix and converted it to the angle-axis representation or unit quaternion (Euler parameter) for control [10; 11]. We use the rotation matrix to represent the orientation error in the control. We define a new orientation error (\(\mathbf{e}_{o}\)) representation using a small-angle approximation of trigonometric functions. If the input angle of the trigonometric function is very small, it can be expressed by approximating \(sin\theta\approx\theta\) and \(cos\theta\approx 1\). When the sine function and the cosine function are 14 degrees and 8 degrees, respectively, the error rate due to the approximation is 1%. Therefore, this approximation can be used, because it aims to compensate for the slight movement of the subject. Given the desired orientation (\(\mathbf{R}_{d}\)), if the rotation of the end-effector (\(\mathbf{R}_{e}\)) is determined by the measurement system, the orientation error is:  
\[ \begin{array}{rcl}\mathbf{e}_{o}=\mathbf{R}_{e}^{T}\mathbf{R}_{d}&\approx&\left[\begin{array} []{cccc}1&-\Delta\alpha&0\\ \Delta\alpha&1&0\\ 0&0&1\\ \end{array}\right]&\left[\begin{array}{cccc}1&0&\Delta\beta\\ 0&1&0\\ -\Delta\beta&0&1\\ \end{array}\right]&\left[\begin{array}{cccc}1&0&0\\ 0&1&-\Delta\gamma\\ 0&\Delta\gamma&1\\ \end{array}\right]\\ &=&\left[\begin{array}{cccc}1&\Delta\beta\Delta\gamma-\Delta\alpha&\Delta \beta+\Delta\alpha\Delta\gamma\\ \Delta\alpha&\Delta\alpha\Delta\beta\Delta\gamma+1&\Delta\alpha\Delta\beta- \Delta\gamma\\ -\Delta\beta&\Delta\gamma&1\\ \end{array}\right]\approx&\left[\begin{array}{cccc}1&-\Delta\alpha&\Delta \beta\\ \Delta\alpha&1&-\Delta\gamma\\ -\Delta\beta&\Delta\gamma&1\\ \end{array}\right].\end{array}