Algorithm 3: WLVM. |
|
Data: x, y, leaderStart, leaderTarget |
1
|
Initialize parameters |
|
//
n - the number of particles
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
for to n do
|
9
|
|
|
|
10
|
end
|
11
|
while change > 0 do
|
12
|
|
|
|
13
|
|
|
for each changed swarm do
|
|
|
|
|
|
//
getting the positions and angles for the virtual leader
|
14
|
|
|
|
|
|
15
|
|
|
|
|
for to do
|
16
|
|
|
|
|
|
|
Calculate averageTheta |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Smoothen path |
21
|
|
|
|
|
|
|
Deadlock and collision avoidance |
22
|
|
|
|
|
end
|
23
|
|
|
|
|
Segment delay |
24
|
|
|
end
|
25
|
|
|
Swarm evaluation |
26
|
|
|
if swarm changes then
|
27
|
|
|
|
|
|
28
|
|
|
end
|
29
|
end
|