Skip to main content
. 2022 May 26;22(11):4022. doi: 10.3390/s22114022
Algorithm 3 Get the value of (Q, W).
1: functionGet Q(wgoal,Cw,Rw,PC,Lv,c,v,n)
2:     addobs[v]=0,add[n]=0,j,k,i ▹ Temporal variables.
3:     for (j=0;j<c;j++) do
4:         for (k=0;k<v;k++) do
5:            for (i=0;i<n;i++) do
6:                xk[i]=cos(wgoal[k])(L[k])i+1n
7:                yk[i]=sin(wgoal[k])(L[k])i+1n (xk,yk) are the coordinates of each singular point for a given link
8:                addobs[k]+=PC[j](xk[i]x[j])2+(yk[i]y[j])2(r[j])2 ▹ The equation of the circular obstacle C(w) can be replaced by the equation of ellipsoidal obstacle R(w)
9:            end for
10:            add[j]+=addobs[k]
11:         end for
12:         addobs[v]=0 ▹ Temporal variable is cleared.
13:         Q+=add[j]
14:     end for
15:     return (Q) ▹ The value of Q is obtained.
16: end function