Summary
This work addresses heterogeneous swarm segregation: agents belong to distinct groups and must form spatially coherent clusters with conspecifics while avoiding inter-group entanglement, using only information available within a finite sensing range. The proposed controller assigns each agent a probabilistic policy by defining an energy-based model over candidate velocity vectors and drawing updates via Metropolis–Hastings sampling, in contrast to deterministic gradient steps on smooth potentials.
The accompanying software implements the GRF-based method together with several published baselines under a shared simulation harness (identical world generation, sensing, and logging hooks), enabling controlled empirical comparison. All methods are launched as ROS Melodic packages and execute multi-agent updates in a two-dimensional workspace with visualization suitable for qualitative inspection and quantitative logging of summary statistics across iterations.
Video
The following recording illustrates the behavior of the proposed approach in the experimental setting described in the manuscript.
Direct link: https://youtu.be/KooNGIStWlM
Usage tutorial
Prerequisites
The repository targets ROS Melodic on Ubuntu 18.04. System packages required by the
workspace include a C++11 toolchain, catkin, OpenCV, Boost,
OpenMP, and Python 3 with numpy for world generation scripts.
Installation
Clone into the src tree of a Catkin workspace and build:
cd ~/catkin_ws/src
git clone https://github.com/verlab/2021-icra-grf-swarm.git
cd ~/catkin_ws
source /opt/ros/melodic/setup.bash
catkin_make
source devel/setup.bash
Running the proposed method
The primary executable is exposed as grf_swarm_node. The standard entry point is the launch
file below; it generates an initial configuration and runs the simulation for a fixed horizon.
roslaunch grf_swarm grf_swarm.launch
For scenarios that use the navigation-oriented binary (grf_swarm_nav), use
grf_swarm_analysis.launch, which starts the grf_swarm_nav node with the same
parameter surface as the main experiment.
roslaunch grf_swarm grf_swarm_analysis.launch
Logging
Set log:=true (default in the provided launch files) to emit a text log of the cluster-count
metric each iteration. Disable the graphical window on headless systems with gui:=false.
Docker environment
A container image based on osrf/ros:melodic-desktop-full builds all five Catkin packages and
provides a reproducible runtime without a local ROS installation. The default command runs the GRF swarm
launch file with the GUI disabled, which is appropriate for servers and automated runs.
docker build -t icra2021-grf-swarm /path/to/2021-icra-grf-swarm
docker run --rm icra2021-grf-swarm
For interactive visualization on Linux hosts with X11, allow local connections and use the Compose
profile gui (see docker-compose.yml in the repository):
xhost +local:docker
docker compose --profile gui up grf-gui
The image is sizable owing to the full desktop ROS dependency stack; it trades disk footprint for a self-contained build of OpenCV, Catkin, and visualization-related packages used across baselines.
Parameters and implementation notes
The launch files for grf_swarm and the bundled baselines expose a common set of
experiment-level arguments. Additional dynamical constants are fixed in the C++ controller
implementation (see table below).
Launch arguments (shared pattern)
| Argument | Default | Description |
|---|---|---|
robots |
150 | Total number of agents in the simulation. |
groups |
10 | Number of heterogeneous groups; agents are assigned types in order of equal-sized partitions. |
world |
5 | Extent of the square workspace (world size parameter passed to the generator and controller as worldsize). |
sensing |
1.5 | Neighborhood radius for pairwise interactions and obstacle sampling relative to each agent. |
seed |
1 | Random seed for the Python world generator; use the same seed across methods for paired trials. |
log |
true | Enable per-iteration logging of the cluster metric to a plain-text file in the working directory. |
gui |
true | Open an OpenCV window for real-time visualization when supported. |
The launch file sets iterations to 20000 simulation steps unless modified
in the XML. The private namespace parameter swarmconf invokes
grf_swarm/world/generator.py, which prints one line per robot: position, initial velocity
components, and discrete type index, consumed by the node at startup.
Controller constants (grf_swarm node)
The following quantities are read from ROS parameters where indicated; others are compiled into the
controller: integration step dt = 0.02, velocity cap vmax = 1.0, inertial
scaling mass = 0.3, and clearance safezone = 0.3. Optional compile-time flags
in grf_swarm.h control obstacle drawing, velocity glyphs, noise injection, and auxiliary
logging features for development.
Related work and bundled baselines
The repository includes reimplementations or ports of several methods from the swarm segregation literature, invoked through parallel launch files so that experimental conditions remain aligned.
Gradient-based potential (local minima illustration)
roslaunch grad_swarm grad_swarm.launch
Deterministic gradient descent on a smooth potential; useful to illustrate stagnation in unfavorable configurations relative to stochastic sampling.
Particle swarm optimization (Inácio et al., 2019)
Inácio, F. R., Macharet, D. G., & Chaimowicz, L. (2019). PSO-based strategy for the segregation of heterogeneous robotic swarms. Journal of Computational Science, 31, 86–94.
roslaunch pso_swarm pso_swarm.launch
Minimalistic segregation (Mitrano et al., 2019)
Mitrano, P., Burklund, J., Giancola, M., & Pinciroli, C. (2019). A minimalistic approach to segregation in robot swarms. 2019 International Symposium on Multi-Robot and Multi-Agent Systems (MRS), 105–111. IEEE.
roslaunch min_swarm min_swarm.launch
Differential potentials with global position knowledge (Santos et al., 2020)
Santos, V. G., Pires, A. G., Alitappeh, R. J., Rezeck, P. A., Pimenta, L. C., Macharet, D. G., & Chaimowicz, L. (2020). Spatial segregative behaviors in robotic swarms using differential potentials. Swarm Intelligence, 1–26. (Used here as a strong baseline that assumes global positional information.)
roslaunch vgs_swarm vgs_swarm.launch
Replication protocol for fair comparison
To compare the proposed GRF controller against any bundled baseline under matched conditions, we recommend the following protocol.
-
Fix the random seed. Pass identical
seed:=Svalues to every launch file so thatgenerator.pyreproduces the same initial positions, velocities, and group labels. -
Match swarm and environment metadata. Use the same
robots,groups,world, andsensingarguments across runs. These arguments fully specify the synthetic scenario together with the seed. -
Align horizon. Keep
iterationsat the same value (default 20000) unless the research question explicitly requires a different horizon for all methods. -
Enable logging. Set
log:=trueand retain the emitted files. The GRF node writes the instantaneous cluster-count metric each cycle when logging is enabled, supporting time-series comparison across algorithms. -
Separate qualitative and quantitative runs. Use
gui:=falsefor batch replication on clusters; enable the GUI only for visualization or debugging. - Container parity. When using Docker, build a single image and execute each method with the same image ID and host configuration to exclude toolchain drift.
Adhering to this checklist isolates algorithmic differences from initialization and simulator configuration effects, which is essential when reporting comparative performance in scientific publications or supplementary material.
Citation
If this work or software contributes to your research, please cite:
@inproceedings{rezeck2021flocking,
title={Flocking-Segregative Swarming Behaviors using {Gibbs} Random Fields},
author={Rezeck, Paulo and Assun{\c{c}}{\~a}o, Renato M. and Chaimowicz, Luiz},
booktitle={2021 IEEE International Conference on Robotics and Automation (ICRA)},
year={2021},
organization={IEEE}
}