Skip to content

Commit

Permalink
Swarm: rename vicsek to vasarhelyi
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricaSo committed Dec 9, 2020
1 parent 4443909 commit e33f52c
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions @Swarm/Swarm.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ function update_state(self, wind, time)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [vel_commands, collisions] = update_command(self, p_swarm, r_coll, dt)

if self.algorithm == "vicsek" % Vicsek swarming algorithm
[vel_commands, collisions] = self.compute_vel_vicsek(p_swarm, r_coll, dt);
elseif self.algorithm == "olfati_saber"% Olfati-Saber swarming algorithm
% Select the swarm algorithm and call the associated update
if self.algorithm == "vasarhelyi"
[vel_commands, collisions] = self.compute_vel_vasarhelyi(p_swarm, r_coll, dt);
elseif self.algorithm == "olfati_saber"
[vel_commands, collisions] = self.compute_vel_olfati_saber(p_swarm, r_coll, dt);
end
if isempty(self.collisions_history)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [V_command, collisions] = compute_vel_vicsek(self, p_swarm, r_agent, dt)
function [V_command, collisions] = compute_vel_vasarhelyi(self, p_swarm, r_agent, dt)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% VICSEK SWARMING ALGORITHM
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ The GUI allows for run-time changes of some parameters, such as the swarm direct
To start off with your first drone swarm simulation, open the project folder <i>swarmlab</i> in Matlab (see picture aside). Then, add all folders and subfolders to the current path (select the swarmlab folder → right-click → Add to Path → Selected Folders and Subfolders).
You have two ways of running your simulations, either via the provided GUIs or by calling an example script.
* For the GUI, type `GUI_drone` or `GUI_swarm` on the Matlab command view, select the parameters you want and slide to `On` the _Start Simulation_ button.
* For running an example, type `example_vicsek`
For editing the example scripts, go to examples → examples_swarm, and open the <i>example_vicsek.m</i> script.
* For running an example, type `example_vasarhelyi`
For editing the example scripts, go to examples → examples_swarm, and open the <i>example_vasarhelyi.m</i> script.
</p>

Finally, simply run the script and pay attention to the prompted instructions!
Expand Down
4 changes: 2 additions & 2 deletions enumerators/SwarmAlgorithm.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classdef SwarmAlgorithm
% This class (enumerator) is meant to manage the Swarm algorithms:
% vicsek, olfati_saber, centr_nlmpc
% vasarhelyi, olfati_saber, centr_nlmpc
enumeration
vicsek, olfati_saber, centr_nlmpc
vasarhelyi, olfati_saber, centr_nlmpc
end
end
Binary file modified examples/GUI_swarm.mlapp
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/examples_swarm/example_olfati_saber.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DEBUG = true;
VIDEO = true;
CENTER_VIEW_ON_SWARM = false;
SWARM_ALGORITHM = "olfati_saber"; % either vicsek or olfati_saber
SWARM_ALGORITHM = "olfati_saber"; % either vasarhelyi or olfati_saber

if DEBUG || VIDEO
results_dirname = strcat('results/results_swarm');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DEBUG = true;
VIDEO = true;
CENTER_VIEW_ON_SWARM = false;
SWARM_ALGORITHM = "vicsek"; % either vicsek or olfati_saber
SWARM_ALGORITHM = "vasarhelyi"; % either vasarhelyi or olfati_saber

if DEBUG || VIDEO
results_dirname = strcat('results/results_swarm');
Expand All @@ -39,7 +39,7 @@
DRONE_TYPE = app.drone_type;

% Swarming parameters
SWARMING_ALGO = "vicsek";
SWARMING_ALGO = "vasarhelyi";
p_swarm.nb_agents = app.nb_agents;
p_swarm.d_ref = app.d_ref;
p_swarm.v_ref = app.v_ref;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/example_co_mn.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function output_collisions = example_co_mn(SWARM_ALGORITHM, max_neig, nb_agents, end_time)

%% Running example_vicsek.m
%% Running example_vasarhelyi.m
DRONE_TYPE = "point_mass";
ACTIVE_ENVIRONMENT = false;
DEBUG = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/example_ct.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

t_start = tic;

%% Running example_vicsek.m
%% Running example_vasarhelyi.m

ACTIVE_ENVIRONMENT = false;
DEBUG = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_comp_time.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

end_time = 10; % p_sim to evaluate
iterations = 1;
algo_array = ["vicsek", "olfati_saber"];
algo_array = ["vasarhelyi", "olfati_saber"];
drone_array = ["point_mass", "quadcopter"];
nb_agents_array = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]; % nb_agents to evaluate
ct = zeros(length(iterations), length(algo_array), length(drone_array), length(nb_agents_array));
Expand Down
6 changes: 3 additions & 3 deletions tests/test_max_neig_vs_collisions.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
%% Initialization

end_time = 500; % p_sim to evaluate
algo_array = ["vicsek", "olfati_saber"];
algo_array = ["vasarhelyi", "olfati_saber"];
neig_array = [2, 4, 8, 16, 32, 64];
nb_agents = 64;
co_mn = zeros(3, length(algo_array), length(neig_array));
Expand Down Expand Up @@ -43,7 +43,7 @@
xlabel('Number of max neighbours')
ylabel('Collisions')
grid on
legend('vicsek', 'olfati-saber', 'Location', 'northwest')
legend('vasarhelyi', 'olfati-saber', 'Location', 'northwest')

figure

Expand All @@ -60,7 +60,7 @@
xlabel('Number of max neighbours')
ylabel('Collisions')
grid on
legend('vicsek', 'olfati-saber', 'Location', 'northwest')
legend('vasarhelyi', 'olfati-saber', 'Location', 'northwest')
%%

disp('Computational time analysis completed successfully')

0 comments on commit e33f52c

Please sign in to comment.