ArduSub + Gazebo simulation for BlueROV.
Clone this repo into ~/workspaces/bluerov_ws/src. If you prefer to place it in another location, edit the paths below.
Install vcstool (add the ROS 2 apt repository first, example):
sudo apt-get update
sudo apt-get install python3-vcstoolThen get the dependencies:
cd ~/workspaces/bluerov_ws
vcs import src < src/ardusub_sim/dependencies.reposcd ~/workspaces/bluerov_ws/src/ardusub_sim
./build.bashThis creates ardusub_sim:humble.
Install rocker: https://github.com/osrf/rocker#installation
Then start the container:
rocker --devices /dev/dri --x11 --network=host --ipc=host \
--volume ~/workspaces/bluerov_ws:/root/HOST/bluerov_ws -- \
ardusub_sim:humbleInside the container:
cd /root/HOST/bluerov_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-install --packages-up-to ardusub_interface bluerov_simOn a hybrid NVIDIA system, enable PRIME render offload before launching for better performance:
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidiaThese variables are not needed on systems where NVIDIA is already the default renderer. Confirm the selected renderer with:
glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"Then launch the simulation:
source install/setup.bash
ros2 launch bluerov_sim bluerov_sim.launch.py \
world_name:=dave_ocean_waves \
ardusub:=true \
mavros:=true \
gui:=trueIn a second shell inside the same container:
rocker --devices /dev/dri --x11 --network=host --ipc=host \
--volume ~/workspaces/bluerov_ws:/root/HOST/bluerov_ws -- \
ardusub_sim:humble
cd /root/HOST/bluerov_ws
source /opt/ros/humble/setup.bash
source install/setup.bashCheck that MAVROS and Gazebo data are flowing:
ros2 topic echo /mavros/state --once
ros2 topic echo /mavros/local_position/pose --once
ros2 topic hz /bluerov/odomArm and switch to GUIDED:
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"
ros2 service call /mavros/set_mode mavros_msgs/srv/SetMode "{custom_mode: 'GUIDED'}"Send one position setpoint:
ros2 topic pub --once /mavros/setpoint_position/local geometry_msgs/msg/PoseStamped \
"{header: {frame_id: map}, pose: {position: {x: 1.0, y: 0.0, z: -1.0}, orientation: {w: 1.0}}}"Useful launch switches:
odom_source:=ground_truth # default
odom_source:=none # no odometry adapterThe simulation command and feedback loop is:
ROS command
→ MAVROS
→ ArduSub SITL
→ ArduPilot Gazebo plugin
→ Gazebo physics
→ odometry adapter
→ MAVROS and TF
- Map poses use ENU; depth below the surface has negative z.
- Host networking is required for the default MAVLink ports.
- If MAVROS is disconnected, check that ArduSub and the Gazebo bridge started.
- If local position is not updating, check the selected odometry adapter.