Position Encoder Analysis and Low Delay Control for a Medical Robot with Six DoFs

Medical robots are in great demand for orthopedic surgery. The robotic control could be divided into two layers, the top layer and the bottom layer (also called joint control). However, how to improve the dynamic performance of joint control is still a challenging issue. Traditional PID control and PID-based sliding mode control are commonly used methods for the joint control of medical and industrial robots. In this paper, the proposed joint control is based on dynamic compensation. Dynamic compensation includes inertia and friction. The joint control diagram includes PID, sliding mode control, and adaptive dynamic compensation as a module unit. The design of the proposed joint control method could overcome the disadvantages of model uncertainty and dynamic disturbances and improve robot dynamic performance. Additionally, since control feedback is based on the joint position encoder, position encoder analysis is included in this paper. The dynamic performance of the proposed joint control was tested on the six-DoF medical robot, and the indexes of rising time, task space tracking, and contact space tracking were adopted to evaluate the dynamic performance. The experimental results show that the proposed control method has a much smaller rising time than the commercial controller product. The control proposed in this paper realized low delay control and improved the dynamic response of the control.


Introduction
Many medical robots are being developed for surgery ( Figure 1 shows examples of medical robot applications) to realize better operation performance that is more precise and minimally invasive, compared with traditional manual procedures.
Research related to medical robots for orthopedic surgery began in the mid-1980s [1,2]. The orthopedic medical robots are supposed to play an important role in orthopedic surgery. The role of orthopedic medical robots is divided into two kinds of essential features. The first feature is that the orthopedic medical robots can be used for bone cutting/drilling/milling, and the second feature is that the orthopedic medical robots can be used for holding/placing surgical tools [3].
The basic requirements for medical robots are safe, reproducible, and precise [1]. One of these mentioned requirements is to provide more precise control during robotic surgical procedures. The robotic control could be divided into two layers (see Figure 2), the top layer and the bottom layer. The top layer focuses on manipulation planning, and the bottom layer focuses on joint control [4,5]. Both the top layer and the bottom layer could improve the precise control of the robot. This paper will focus on the joint control of the medical robot. For the joint control, the key is its dynamic performance. The indexes of the dynamic performance of joint control are included in [4,6]. In this paper, the indexes of rising time, task space tracking, and contact space tracking will be adopted to test the dynamic performance of the controller.
To date, orthopedic medical robots, such as MAKO, Robodoc, Praxim, and Navio, have good performance on clinical surgical tasks [7]. However, how to improve the control performance and reduce the delay time of joint control [8] is still a challenging issue in robotics.
In early robotic applications, because PID control [9] has a simple structure and easy adjustment, PID control is used as a component of joint control and is widely used in both indus-trial robots and medical robots. With the development of robotic applications, traditional joint control cannot meet the requirements that are of good dynamic characteristics and high precision result [10]. Therefore, many improved joint control methods have been proposed [11][12][13]. Intelligent methods for PID tuning are adopted to improve the joint control performance. In [11], some autotuning methods have been proposed by researchers. Since PID fails in the case of     Journal of Sensors uncertain environment, to realize high-precision trajectory tracking under model uncertainty and external disturbances, researchers have adopted a sliding mode control (SMC) method that includes PID and sliding mode control. In [12], it lists different configurations of PID-based SMC to overcome the drawbacks of PID. In [13], researchers combine the fuzzy gain tuning, the robustness of the sliding mode controller, and the rapid response characteristics of the PID, which effectively reduces the chattering caused by the sliding mode controller and improves the stability of the system. Although PID-based SMC has the advantages of tracking trajectory with high precision and overcoming the uncertain environment, it still has a limit on dynamic performance. The essence of dynamic performance of the joint control is bandwidth. Both tuning control parameters and dynamic compensation are approaches to improve bandwidth. Improving the bandwidth could reduce the delay time of the control response [14]. However, researchers [9][10][11][12][13] focus on tuning the control parameters, and the research on the dynamic compensation of the joint control (bottom layer) is much less.
By considering that dynamic compensation is also a good approach to reduce the delay time of the joint control, this paper will improve the dynamic characteristics of the joint control by adding dynamic compensation. Dynamic compensation includes inertia and friction.
In this paper, the main contribution of the proposed method over the previous methods is the joint control diagram which includes PID, sliding mode control, and adaptive dynamic compensation as a module unit. The design of the proposed joint control method could overcome the disadvantages of model uncertainty and dynamic disturbances and improve the dynamic performance of robot.
The structure of this paper is as follows. In the second section, the VDC method [5] is used to build the kinematics of the 6-DoF medical robot. In the third section, it shows an improved control approach that combines joint control and dynamic compensation. Since control feedback is based on the joint position encoder, the position encoder analysis included in the fourth section will discuss how to determine the data bits and sampling time. The control performance is shown in the fifth section.

Kinematics of the 6-DoF Medical Robot
In this paper, the medical robot is with six DoFs (see Figure 3), and its load capacity is 10 kg. In the project, this robot is supposed to be used for drilling and placing. From the base to the end effector, the six joints are labeled as J1-J6. All six joints are the type of rotational joint.
For the 6-DoF robot, the inertial coordinate frame is defined as F 0 -x 0 y 0 z 0 ; the coordinate frame for the end effector is labeled as F ee -x ee y ee z ee ; the coordinate frame for the ith (i = 1, 2, ⋯, 6) joint is F i -x i y i z i , and the direction of the axis z i aligns with the rotational axis of the ith joint, respectively.
Based on the VDC method [5], the 6-DoF robot is virtually decomposed into six subsystems by placing six cutting points at the six joints, respectively. As illustrated in Figure 4, a cutting point is an interface of separation that virtually cuts through the ith joint. The ith joint is located between the ði − 1Þth link and the ith link. For the ith joint, two coordinate frames are defined. The first is the inboard frame F̂i which is attached on Link i-1 and labeled with F̂i − x̂iŷiẑi, and the second is the outboard frame F i which is attached on Link i and labeled with F i -x i y i z i . Therefore, while the ith joint rotates with θ i , the outboard frame F i will rotate along the axis ẑi as θ i with respect to the inboard frame F̂i. If θ i = 0, frame F i and frame F̂i will share the same position and orientation at the cutting point. Since frame F̂i and frame F i−1 are attached on the same Link i − 1, the rotation matrices i−1 Ĉi between frame F i−1 and frame F̂i are constant. The rotation matrices associated with inboard frame and outboard frame can be expressed as The transformation matrices between inboard frame and outboard frame are defined aŝ where in Equation (2), is i−r r i−1,î the position vector between the origin of frame F̂i and the origin of frame F i−1 that is expressed in frame F i−1 , and the cross-product operator is defined as Based on Table 1, which shows the D-H parameters of the 6-DoF robot, it can derive the following.
Hence, for the 6-DoF robot, the transformation matrix from the base to the end effector is 3 Journal of Sensors

Dynamics and Controller of the 6-DoF Medical Robot
In this paper, the control is model-based. The classical adaptive identification method [15,16] was adopted to identify the inertial parameters in this research project. However, in previous research, the adaptive identification method was not included in the joint control structure of joint con-trol, and it was included in the top layer of the control of the system. In this section, the first part will build the dynamics of the subsystem, and the second part will show the joint control based on dynamic compensation.
3.1. Dynamics of the Subsystem. As mentioned above, the full system of the 6-DoF robot is virtually decomposed into six subsystems. This part will discuss the velocity transformation, force transformation, and dynamics of the subsystem.
For the velocity transformation, the defined labels have the corresponding meanings: i v i represents that the linear velocity of target (v i ) is with respect to the origin of the frame F i and is expressed in frame F i ; i ω i represents that the angular velocity of the target (ω i ) is with respect to the origin of the frame F i and is expressed in frame F i . Then, the following will hold: where i r i,mi is the CoM (center of mass) position of Link i that is expressed in frame F i . For the force transformation, the defined labels have the corresponding meanings: i f net,i represents the vector sum of the force (except the gravitational force) that is acting on Link i and expressed in frame F i ; i m net,i represents the vector sum of the moment of force (except the contribution of the gravitational force) that is acting on Link i and expressed in Link i  Journal of Sensors frame F i . τ net,i represents the sum of torque that is acting on the ith joint. Then, Equations (9) and (10) will hold.
i f̂î i m̂i where in Equations (9) and (10), For the ith subsystem, m i is the mass of Link i, I i is the moment of inertia of Link i which is with respect to the CoM of Link i, and g ! is the gravity vector. Then, the dynam-ics of the ith subsystem is expressed as where

Control Based on Dynamic Compensation.
In this paper, the model-based design is adopted to set up the controller. The classical adaptive identification method [15,16] was adopted to identify the inertial parameters in the bottom layer of control. Additionally, joint control is the basic of full-system control. Optimizing the joint control can improve reducing the delay time of the dynamic response. Therefore, in this part, the discussions will focus on joint control.
In Equation (13), it shows the common sliding mode control. θ d,i and _ θ d,i are the command of the ith joint position and velocity, respectively. For the control coefficient, For the ith joint, its control law is defined as Equation (14). In the right part of Equation (14), the first three items play the role of dynamic compensation, and the last three items play the role of control.
Additionally, θ e,i = θ d,i − θ i , _ θ e,i = _ θ d,i − _ θ i ;k c,i is the estimated value for the Coulomb friction coefficient of the ith joint, andk v,i is the estimated value for the viscous friction coefficient of the ith joint; k P,i , k I,i , and k D,i are the PID control parameters.
In Equation (14), I j,i ,k c,i , andk v,i are the unknown variables. The inertial variable I j,i was identified based on the classical adaptive identification method [15,16] by the top layer of control.k c,i andk v,i are identified by using the following equations: Equations (15)-(17). k c,i and k c,i are supremum and infimum for k c,i , respectively; k v,i and k v,i are supremum and infimum for k v,i , respectively. The function P is the identification function [4], and its time derivative is shown in Equation (17).
_ P s t ð Þ, ρ, k, k, t À Á = 0, if P ≥ k and s ≥ 0, 0, if P ≤ k and s ≤ 0, ρ•s t ð Þ, otherwise: Finally, the computation result of i τ net,i in Equation (14) is substituted into Equation (10). Then, a complete dynamic equation of the subsystem shown in Equation (11) is obtained. The matrices of M i , C i , and G i are also identified based on the classical adaptive identification method [15,16].

Position Encoder Analysis
In this paper, the position encoders are fixed on the motor axis of each joint. In this section, it will discuss how to choose the position encoders based on the simulation analysis.  7 Journal of Sensors 4.1. Data Bits Requirement Analysis. As well known, data bits output by the encoder during one round of the encoder shaft will determine the encoder resolution. If an encoder has insufficient resolution, it will not provide effective feedback to the controller, and the system will not perform as required.
In the data bits analysis, the target velocity is set as 0.2 deg/s (see Figure 5(a)), and the gear ratio for each motor is 160 : 1. Two types of encoder are adopted to detect the actual velocity. Figure 5(b) shows the recording result of the encoder with 15 data bits. Figure 5(c) shows the recording result of the encoder with 16 data bits.
Based on the comparisons, especially in the duration from start to 1 second, it shows that the encoder with 16 data bits has better tracking performance than the encoder with 15 data bits. Therefore, in this paper, the robot controller is based on the position encoders with 16 data bits.

Sampling Time Requirement Analysis.
Since the computation resource is limited, it is needed to choose an appropriate sampling time of the encoder. Figure 6(a) shows the recording result of the encoder with a sampling time of 0.1 ms. Figure 6   Journal of Sensors By comparing the encoder performance of recording continuity, it shows that the encoder with 0.1 ms sampling time is better. Therefore, in this paper, the robot controller is based on position encoders with a sampling time of 0.1 ms sampling time.

Control Performance
In control processing, the hardware is based on the BECKH-OFF TwinCAT 3 real-time platform, and the communication protocol is EtherCAT.
In this section, the experimental test of the proposed controller follows the performance criteria shown in [6]. The criteria include the tests of step response, trajectory tracking without load, and payload verification. The experi-mental tests of control performance are based on the 6-DoF medical robot platform. As shown in Table 2, the control parameters for the six joints are listed in detail.

Joint Control Performance.
To reduce the delay time of the dynamic response, in this part, this paper will focus on the rising time for each joint under the command of a sequence of step-square waves. The dynamic joint response can be recorded by TwinCAT 3, and then, the rising time based on the recorded curves can be detected.
Based on the control proposed in the last section, the joint control performances are shown in Figures 7-9.
In Figures 7-9, all figures show that each joint control can achieve the goal with high precision and well dynamic response. More details are shown in Table 2. The rising time For comparison, a commercial controller was adopted to control this 6-DoF robot, and the rising time of joint response (t c,rise ) was about 110 ms based on the commercial controller. Compared with the commercial controller, the controller proposed in this paper could reduce the rising time of joint response by almost more than 50% (see Table 2). Hence, the controller proposed in this paper realized low delay control and improved the dynamic response of control.

Task Space Tracking Performance.
To test the tracking performance of the 6-DoF robot in the task space, a set of commanded velocities of the end effector is adopted as shown in Figure 10.
In Figure 10, the path planning for the commanded velocities follows three steps, speed up, constant speed, and slow down.
Based on the commanded velocities of the end effector, the six joints of the robot will track the commanded velocities in the joint space. As shown in Figure 11, it shows the tracking results of the joint velocities. For the ith joint, _ θ d,i is the commanded joint velocity, and _ θ i is the real joint velocity (i = 1, 2, ⋯, 6). Figure 11 shows that the six joints could follow the commanded velocities well.
In Figure 12, it shows the tracking error of the six joints. The tracking error is small and converging to zero.
Therefore, based on the experimental results shown in Figures 11 and 12, the controller shown in this paper could realize the good tracking performance of the 6-DoF robot in the task space.

Contact Space Tracking Performance.
To test the tracking performance of the 6-DoF robot in the contact space, the test experiments include plate surface contact test and curved surface contact test (see Figure 13). In both tests, the robot is expected to move along the surface with a stable contact force.
In Figure 14, it shows the trajectory of the contact force when the robot is required to move along the plate surface. The contact force is recorded by a six-dimensional force sensor. The commanded contact force is set as 5 N.
In Figure 15, it shows the trajectory of the contact force when the robot is required to move along the curved surface. The commanded contact force is set as 10 N.
Both in Figures 14 and 15, the robot could track the surface well. In particular, in the test of curved surface, the end

Conclusions
In this paper, a method for joint control in robot-assisted orthopedic surgery was proposed. Compared to traditional joint control, improved joint control includes PID, sliding mode control, and adaptive dynamic compensation as a module unit. The performance of the proposed joint control was tested on a six-DoF robot. The experimental results of the joint dynamic response under square waves show that the proposed control method has a much smaller rising time than the commercial controller product, which means better performance in high dynamic response for the robot. The experimental results of the tracking performance in the task space and contact space show that the robot could follow the commanded velocities well.
In the near future, the proposed joint control method will be applied for real orthopedic surgery experiments. And further research will focus on improving human-machine collaboration based on the proposed control method.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this paper.