Skip to main content
. 2026 Feb 10;26(4):1129. doi: 10.3390/s26041129
Algorithm 1 Configuration for the Second Flexible Segment
1: Input: Desired position pd, current configuration q2,k, tolerance λ, step size α, maximum iteration K.
2: Output: Configuration parameter qc(2)R2 for the second flexible segment.
3: Calculate current tip position: p2=fw,c(q2,k).
4: Calculate current error: e=pdp2.
5: Initialization k0.
6: while e>λ and k<K do
7:    Calculate local Jacobian matrix J2.
8:    Calculate new q2,k by (16).
9:    Update p2 and e.
10:    kk+1.
11: end while
12: Set qc(2)=q2,k.