When starting the task of migrating the multibeam sonar plugin, it might seem overwhelming to know where to begin. So I'm working on it separately and leaving notes (I will switch to Apple Silicon Metal GPGPU on the way). This could be critically helpful for your work, so please read it. I'll leave update messages in the memo at the top of the page whenever there are updates.
It seems convenient to write the code following the initial development order of the multibeam sonar. When first writing the code, the first step is to acquire depth information from the depth_image using Gazebo's depth_camera plugin. Therefore, it's convenient to find the depth_camera plugin source code (https://github.com/gazebosim/gz-sensors/blob/gz-sensors8/src/DepthCameraSensor.cc) in the Gazebo Harmonic source code and build upon that. (Check out the callout and the template below)The basic concept is to take the distance (depth) of objects in the image per pixel obtained from the depth_image, pass it to CUDA code for calculation, receive it back, and then output it in a format that matches the marine_acoustic_msgs message format and adding handles to pass sonar calculation parameters from sdf all the way to cuda code.
<aside> 💡 In Gazebo Harmonic, starting from the DVL sensor plugin to strip unnecessary codes and add needed would be better than using DepthCameraSensor.cc. Please refer to, https://github.com/gazebosim/gz-sim/tree/gz-sim8/src/systems/dvl, ‣.
</aside>
<aside>
💡 (OUTDATED, Check current live PR on dave repo instead) I’ve put a template(copy&rename of generic dvl plugin) to work at the sonar
branch. You may compile and test with ros2 launch dave_demos dave_world.launch.py world_name:=dave_multibeam_sonar verbose:=true
</aside>
dvl
plugin of gazebo inserted to our ros2
branch with the plugin name changed is at sonar
branch.I am working on it myself too to help guiding the migration work at https://github.com/IOES-Lab/dave/pull/15
ros2 launch dave_demos dave_sensor.launch.py namespace:=blueview_p900 world_name:=dave_multibeam_sonar paused:=false x:=4 z:=0.5 yaw:=3.14
Remove unnecessary part of the code specific to the DVL purpose
const gz::math::Pose3d beamsFramePose = this->Pose() * this->dataPtr->beamsFrameTransform;
this->dataPtr->depthSensor->SetLocalPose(beamsFramePose);
this->dataPtr->imageSensor->SetLocalPose(beamsFramePose);
From GPULidar
used in the dvl, obtain point cloud to feed in to CUDA code
Use following to for sonar msg. It’s ros2
branch of marine_msgs
. Clone it in your workspace src directory.
git clone -b ros2 <https://github.com/apl-ocean-engineering/marine_msgs.git>
For PCL and other dependencies for multibeam sonar
sudo apt install libpcl-dev ros-jazzy-pcl-ros
Build command with logs