## 2 Methods
### Particle Swarm Optimization Algorithm for Parameters Identification of Continuum Robots  
The accuracy of the cable-driven model is critical for determining the motion control precision of the minimally invasive thyroid surgery robot. Inevitable errors introduced during the manufacturing and assembly processes can lead to inaccurate parameters in the cable-driven model. To further enhance the motion control precision of the robot, this section focuses on identifying parameter errors in the cable-driven model. By utilizing the Particle Swarm Optimization (PSO) algorithm, we aim to detect these parameter errors and apply appropriate compensation techniques, thereby improving the accuracy of the model. The Particle Swarm Optimization (PSO) algorithm is based on the social sharing of information. Each particle has two attributes: velocity and position. The velocity dictates the particle's movement in the search space, determining its position in the next iteration, which represents a potential solution. The PSO algorithm is governed by six key parameters. If there are \(N\) particles in a \(D\)-dimensional search space, the following parameters are defined:1. The position of the \(i\)-th particle \(x_{id}\) and its update formulae are: \[x_{id}=(x_{i1},x_{i2},\cdots,x_{iD})\] (8) \[x_{id}^{k+1}=x_{id}^{k}+v_{id}^{k+1}\] (9) 2. The velocity of the \(i\)-th particle \(V_{id}\) and its update formulae are: \[V_{id}=(v_{i1},v_{i2},\cdots,v_{iD})\] (10) \[v_{id}^{k+1}=wv_{id}^{k}+c_{1}r_{1}(p_{id,pbest}^{k}-x_{id}^{k})+c_{2}r_{2}(p _{d,gbest}^{k}-x_{id}^{k})\] (11)  
In Equation (11), \(w\) represents the inertia weight, \(c_{1}\) and \(c_{2}\) are the self-learning and global learning factors of the particles, respectively, and \(r_{1}\) and \(r_{2}\) are random numbers between 0 and 1. 3. The individual optimal solution for the \(d\)-th dimension of the \(i\)-th particle at the \(k\)-th iteration, denoted \(P_{id,pbest}\) is \[P_{id,pbest}=(p_{i1},p_{i2},\cdots p_{iD})\] (12) 4. The group optimal solution for the \(d\)-th dimension at the \(k\)-th iteration \(P_{d,gbest}\) is \[P_{d,gbest}=(p_{1,gbest},p_{2,gbest},\cdots,p_{D,gbest}).\] (13) 5. The fitness value of the optimal position found by the \(i\)-th particle is \(f_{p}\). 6. The fitness value of the optimal position found by the swarm is \(f_{g}\). Here, \(N\) represents the number of particles used to solve the problem. When \(N\) is small, the swarm may fall into a local optimum. However, as \(N\) increases, convergence improves, and the global optimal solution is more easily found. Nonetheless, the computational effort required for each iteration increases, and beyond a certain point, increasing \(N\) does not yield significant improvements. The dimension \(D\) of the search space in the Particle Swarm Optimization algorithm corresponds to the number of independent variables in the solution problem. The flow of the Particle Swarm Optimization algorithm is illustrated in Figure 4.  
Figure 4: Flow chart of Particle Swarm Optimization algorithm. When taking into account practical machining and assembly processes, the parameters of the cable-driven model may be subject to errors. If we define the measurement parameters from Solidworks (2022) software as \(\overset{\rightarrow}{P}_{N}\), PSO can be applied to identify these manufacturing errors as \(\overset{\rightarrow}{E}\). The objective function is designed as follows:  
\[\text{min}f=\sum_{i=1}^{6}\left|\overset{\rightarrow}{\theta}_{di}^{N}- \overset{\rightarrow}{\theta}_{di}^{R}\right| \tag{14}\]  
where \(\overset{\rightarrow}{\theta}_{di}^{N}\) represents the driving motor angles obtained from the cable-driven model, which considers parameter errors identified by PSO, and \(\overset{\rightarrow}{\theta}_{di}^{R}\) denotes the actual driving motor angle.