How bvibhav/stonefish_bluerov2 works
Purpose and Runtime Model
This ROS 2 package supplies Stonefish simulation scenes for Blue Robotics vehicles, principally the BlueROV2, and bridges simulator state/actuation to ArduPilot SITL’s JSON simulator protocol. It also supports a BlueBoat/Rover simulation. The operational entry point is ROS 2 launch; ArduSub or Rover SITL runs separately, with QGroundControl or a ROS driver providing vehicle control.
Build and Package Boundary
The repository is a colcon/ament CMake package defined by package.xml and CMakeLists.txt. It depends materially on ROS 2 Jazzy, the Stonefish library and ROS 2 wrapper (v1.3-compatible scenes), and a local ArduPilot SITL installation. This repo contains scene and launch integration rather than ArduPilot or Stonefish implementations.
Paths: package.xml, CMakeLists.txt, stonefish_bluerov2/__init__.py
Launch Entry Points
Python ROS 2 launch files select and start simulations:
• BlueROV2: launch/bluerov2_sim.py
• BlueBoat/Rover: launch/blueboat_sim.py
• General/alternate simulation entry: launch/bluesim.py
These launches are the boundary between ROS graph orchestration and the Stonefish scenario definitions. SITL must be launched independently using ArduPilot’s --model JSON mode.
Scenario Layer
Stonefish .scn files define the simulated vehicle, physical world, and mission environment. BlueROV2 scenarios range from basic/test and tank environments to turbine/farm scenes; boat and Sonobot scenarios extend the same asset-driven simulation model.
Paths: scenarios/bluerov2.scn, scenarios/bluerov2_farm.scn, scenarios/blueboat.scn
Vehicle and Environment Assets
The data/ hierarchy provides geometry and material inputs referenced by scenarios: BlueROV2 URDF and meshes, BlueBoat components, Sonobot, seabed/tank objects, and wind-turbine models. These assets are a runtime dependency of Stonefish scene loading, not generated build output.
Paths: data/bluerov2.urdf, data/bluerov2/bluerov2.obj, data/turbines/turbine2.obj
Primary Control and Data Flow
1. A ROS launch starts Stonefish with a selected scenario.
2. Stonefish simulates vehicle/environment dynamics and exposes ROS-facing simulation interfaces through the installed Stonefish ROS 2 wrapper.
3. The package’s simulator-side integration exchanges state/sensor and actuator information with an externally running ArduPilot JSON SITL instance.
4. ArduPilot produces vehicle control outputs; Stonefish applies them to the simulated vehicle and returns simulation data.
5. QGroundControl communicates with SITL for operator control/configuration; optionally, an external BlueROV2 ROS driver participates through ROS 2.
Key external boundaries are ROS 2/DDS, Stonefish, ArduPilot JSON SITL, and QGroundControl; none are vendored here.
Simulation Customization
Scenario selection is the primary extension point: use existing vehicle/world combinations or add .scn files referencing assets under data/. scripts/ardusim_patch.py is the repository’s explicit ArduSim-related integration utility, indicating compatibility work remains separate from launch/scene definitions.
Paths: scripts/ardusim_patch.py, scenarios/bluerov2_tank.scn, scenarios/turbine1.scn
Main entry points: bluerov2.scn Stonefish Scenarios · bluerov2_farm.scn Farm Scenario · CMakeLists.txt CMake Package Build · blueboat.scn BlueBoat Scenario
Components 18
ROS 2 Package
- ament Build Metadata · Defines the colcon/ament package and runtime dependencies.
package.xml - CMake Package Build
CMakeLists.txt - Python Package
stonefish_bluerov2/__init__.py - BlueROV2 Launch
launch/bluerov2_sim.py - BlueBoat/Rover Launch
launch/blueboat_sim.py - Alternate Simulation Launch
launch/bluesim.py - ArduSim Patch Utility · Applies separate ArduSim compatibility work.
scripts/ardusim_patch.py
Scene Runtime
- Stonefish Scenarios · Select vehicle, world, and mission environment.
scenarios/bluerov2.scn - Farm Scenario
scenarios/bluerov2_farm.scn - BlueBoat Scenario
scenarios/blueboat.scn - Custom Scene Examples
scenarios/bluerov2_tank.scn - Vehicle Assets · Runtime vehicle inputs loaded by scenarios.
data/bluerov2.urdf - Environment Assets · Turbine, seabed, and tank models support mission worlds.
data/turbines/turbine2.obj - JSON SITL Exchange · Transfers simulated state, sensors, and actuator commands.
External Systems
- Stonefish + ROS 2 Wrapper · Loads scenes, simulates dynamics, and exposes ROS interfaces.
- ArduPilot SITL · Runs independently in JSON model mode.
- QGroundControl
- BlueROV2 ROS Driver
Connections 17
- ament Build Metadata → CMake Package Build: package metadata
- CMake Package Build → Python Package: builds/installs
- BlueROV2 Launch → Stonefish Scenarios: selects
- BlueBoat/Rover Launch → BlueBoat Scenario: selects
- Alternate Simulation Launch → Stonefish Scenarios: starts
- Stonefish Scenarios → Stonefish + ROS 2 Wrapper: loaded by
- Farm Scenario → Stonefish + ROS 2 Wrapper: loaded by
- BlueBoat Scenario → Stonefish + ROS 2 Wrapper: loaded by
- Custom Scene Examples → Stonefish + ROS 2 Wrapper: loaded by
- Stonefish Scenarios → Vehicle Assets: references
- Farm Scenario → Environment Assets: references
- Stonefish + ROS 2 Wrapper → JSON SITL Exchange: simulation state and sensors
- JSON SITL Exchange → Stonefish + ROS 2 Wrapper: actuator commands
- JSON SITL Exchange → ArduPilot SITL: JSON protocol
- ArduPilot SITL → QGroundControl: vehicle control/configuration
- BlueROV2 ROS Driver → Stonefish + ROS 2 Wrapper: optional ROS 2 interaction
- ArduSim Patch Utility → ArduPilot SITL: compatibility support