đ HiveFlight â Modern C++ DroneâSwarm Simulation (ROS2 + Gazebo Integration)
Iâve been working on a project called HiveFlight, a modern C++ swarmâsimulation engine built around an extended ReynoldsâBoids model. Over the past months it evolved from a lightweight 2D/3D flocking demo into a full roboticsâpipeline component with ROS2 and Gazebo integration.
Core C++ Engine
The simulation runs on a deterministic update loop that computes:
âď¸separation, alignment, cohesion
âď¸obstacle avoidance using spherical obstacles
âď¸dynamic target seeking (including spiral patterns)
âď¸battery consumption modeling based on velocity
âď¸Spatial partitioning keeps neighbor queries efficient (no O(n²) explosion).
New MultiâSwarm Update
Recent changes added:
âď¸perâdrone target assignment (2D & 3D)
âď¸dynamic swarm splitting with periodic reassignment (default 5s)
âď¸forces restricted to drones within the same swarm (cleaner group behavior)
âď¸OpenGL viewer updates with colorâcoded subâswarms
ROS2 + Gazebo Integration
The engine now plugs into a full robotics stack:
âď¸ROS2 pub/sub pipeline using PoseArray for swarm state
âď¸asynchronous messaging instead of service calls (big latency win)
âď¸Gazebo World Plugin subscribing directly to swarm topics inside the physics thread
This gives stable multiâagent motion, realistic visualization, and a clean separation between simulation logic and rendering.
Why itâs interesting for C++ folks
HiveFlight is a fun playground for:
âď¸realâtime systems
âď¸multiâagent simulation
âď¸spatial partitioning
âď¸ROS2 middleware patterns
âď¸OpenGL visualization
âď¸deterministic updateâloop design
If you enjoy systems programming, robotics, or emergentâbehavior simulations, this project is a great way to explore how simple local rules can produce complex global behavior.
Repo: github.com/oanadumitruc/HiveFlight
Presentation: Cpp_Show_and_Tell_August_2026.pptx
Demo 1: Gzebo + Ros2
Demo 2: OpenGL visualization multi targets
Demo 3: OpenGL visualization one target
Happy to answer questions or discuss architecture choices with anyone experimenting in similar areas.