Author: Joseph Pokuta
Course: Robot Operating Systems (EE3280) | Michigan Technological University
Date: 12/12/25
Utilizes ROS to create a distributed swarm intelligence system for minimizing benchmark functions.
This project implements a Particle Swarm Optimization (PSO) algorithm using ROS 2 Jazzy. The system navigates complex 3D benchmark functions to find global minima by collectively moving simulated particles. The system uses a service-based architecture to separate the mathematical evaluation of the environment from the optimization logic, enabling modular testing of different units under test (UUTs).
The swarm is coordinated with two primary ROS nodes:
/function_service: Acts as the environment, providing anEvaluate2Dservice that computes the fitness value for a given (x,y) coordinate based on the chosen benchmark function./pso_controller: The brain of the swarm, managing particle states (position, velocity, personal bests), computing velocity updates and handling communication with the function service.
System Topology: Relationship between the
/pso_controller, the /function_service, and the resulting telemetry topics.
This system was tested against three optimization benchmarks:
- Sphere Function: A smooth, convex surface
- Rosenbrock Function: A narrow, steep-walled valley to test how the swarm slides toward a minimum
- Rastrigin Function: Highly non-convex, with many local minima to test the swarm's ability to avoid premature convergence
Each particle is governed by the standard PSO velocity update equation:
Where:
-
$v_{i}(t)$ : Current velocity of particle$i$ . -
$w$ : Inertia weight (set to0.7). -
$c_1, c_2$ : Cognitive and social acceleration coefficients (set to1.4). -
$r_1, r_2$ : Random values sampled uniformly from$[0, 1]$ .
The project uses a custom interface package pso_interfaces for defining a service that coordinates evaluation. This allows the controller to remain independent of the specific function minimized.
Each benchmark was tested with a swarm size of 10 over 100 epochs. The plots below compare the Global Best Fitness (left) against the Velocity Component Magnitudes (right), illustrating the balance between inertia, cognitive, and social pulls.
Demonstrates the swarm getting trapped in local minima due to the rough landscape and small swarm size.
Shows the "velocity burst" characteristic of the swarm navigating the steep valley walls.
The baseline for ideal convergence; shows the smoothest decay in velocity components.
pso_ws/src/pso_interfaces: Custom ROS 2srvdefinitions for coordinate evaluationpso_ws/src/pso_nodes: Python implementation of the controller and function serviceImages/: Convergence plots and RQT graph visualizations
- Source your ROS 2 Jazzy environment.
- Build the workspace:
colcon build --packages-select pso_interfaces pso_nodes
source install/setup.bash- Launch the function service and controller


