Underwater imagery differs from surface imagery due to several factors:
These factors combine to create underwater imagery that is distinctively muted in color, lower in contrast, and often more challenging to capture with clarity compared to surface imagery.
Create a camera sensor of type RGB-D and attach the plugin to the model.sdf
file as shown below:
<sensor name="underwater_camera" type="rgbd_camera">
<update_rate>10</update_rate>
<visualize>true</visualize>
<always_on>1</always_on>
<topic>underwater_camera</topic>
<camera>
<horizontal_fov>1.05</horizontal_fov>
<image>
<width>320</width>
<height>240</height>
</image>
<clip>
<near>0.1</near>
<far>10.0</far>
</clip>
</camera>
<plugin
filename="UnderwaterCamera"
name="dave_gz_sensor_plugins::UnderwaterCamera">
<attenuationR>0.8</attenuationR>
<attenuationG>0.5</attenuationG>
<attenuationB>0.2</attenuationB>
<!-- Murky Coastal Waters -->
<backgroundR>85</backgroundR>
<backgroundG>107</backgroundG>
<backgroundB>47</backgroundB>
</plugin>
</sensor>
Description of the UnderwaterCamera
plugin arguments:
Argument | Description | Default Value |
---|---|---|
attenuationR | This parameter represents the attenuation coefficient for the red color channel. | 0.0 |
attenuationG | This parameter represents the attenuation coefficient for the green color channel. | 0.0 |
attenuationB | This parameter represents the attenuation coefficient for the blue color channel. | 0.0 |
backgroundR | This parameter sets the intensity of the red component of the background color. | 0 |
backgroundG | This parameter sets the intensity of the green component of the background color. | 0 |
backgroundB | This parameter sets the intensity of the blue component of the background color. | 0 |
Build and source the workspace:
cd ~/dave_ws
colcon build && source install/setup.bash
Launch the camera in an underwater setting:
ros2 launch dave_demos dave_sensor.launch.py namespace:=underwater_camera world_name:=camera_tutorial paused:=false x:=10 z:=-93.5 pitch:=0.3 yaw:=3.14
<aside> ⚠️ Important launch arguments:
Argument Name | Description | Default Value |
---|---|---|
namespace | Name of the sensor (select from the available sensors) | “” |
world_name | Gazebo world file to launch (use dvl_world to test the DVL functionality) |
empty.sdf |
paused | Start the simulation paused | true |
debug | Enables verbose mode for Gazebo simulation | false |
verbose | Adjust level of console verbosity | 0 |
x | Initial x position [m] | 0.0 |
y | Initial y position [m] | 0.0 |
z | Initial z position [m] | 0.0 |
roll | Initial roll angle [rad] | 0.0 |
pitch | Initial pitch angle [rad] | 0.0 |
yaw | Initial yaw angle [rad] | 0.0 |
</aside>
Open another terminal, source the workspace and check for available ROS 2 topics:
cd ~/dave_ws && source install/setup.bash
ros2 topic list
It should produce an output similar to:
Open another terminal, source the workspace and view the simulated image using image_view
:
cd ~/dave_ws && source install/setup.bash
ros2 run image_view image_view --ros-args -r image:=/underwater_camera/simulated_image
Argument | Value |
---|---|
attenuationR | 0.0 |
attenuationG | 0.0 |
attenuationB | 0.0 |
backgroundR | 0 |
backgroundG | 0 |
backgroundB | 0 |
Argument | Value |
---|---|
attenuationR | 0.8 |
attenuationG | 0.5 |
attenuationB | 0.2 |
backgroundR | 85 |
backgroundG | 107 |
backgroundB | 47 |