Skip to content

Conversation

@caguero
Copy link
Contributor

@caguero caguero commented Jul 22, 2025

🎉 New feature

Closes #741

Summary

This patch adds support to bridge DVL messages.

I'm using this DVL message definition in the ROS side and this one on the Gazebo side.

I'm opening this PR as a draft because we still need to figure out some discrepancies between messages. I'll start with the Gazebo -> ROS conversion. I invoke @rolker and @hidmic . I'd love you two to join the discussion if have some spare cycles. cc/ @bsb808.

Gazebo -> ROS Discussion

  1. altitude requires to know the location of the DVL beams with respect to the vehicle. I don't think we have the pose of the sensor in the Gazebo message. We could potentially include a pose in the DVLBeamState message. At the same time this will be a redundant message sent over and over all the time.

  2. num_good_beams. How that field should be used? If this field tells me only two beams are good, which of the four beams are the two good ones? Should their elements be rearranged within the array in a way that the two first ones are the good ones? Or this is just purely informative but it shouldn't be used as an index in the arrays. Gazebo has the locked field in each beam which captures the same spirit. Should the "bad beams" be completely ignored? That's what I'm trying to do when copying the data into Gazebo.

  3. sound_speed isn't supported in Gazebo. -1 for now? Add a field in DVLVelocityTracking? Is 1500 a good default value?

  4. beam_unit_vec: See (1).

  5. beam_quality. I'm associating it to rssi but we could also set it to -1 if it's too specific.

  6. velocity_covar is a float32. In Gazebo this is a 3x3 matrix. I guess we have three variance values in the diagonal in Gazebo, one for each velocity component. Do you have a suggestion about how to populate the velocity_covar for each beam here?

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

caguero added 4 commits July 18, 2025 22:42
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Jul 28, 2025
caguero and others added 3 commits July 28, 2025 14:35
…gs.hpp

Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Signed-off-by: Carlos Agüero <cen.aguero@gmail.com>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
@azeey azeey added this to the Jetty Release milestone Jul 28, 2025
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Copy link

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, first pass!


// Unsupported.
for (auto j = 0; j < 9; ++j) {
beam->mutable_velocity()->add_covariance(0);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caguero gz-sim accepts a null covariance matrix?

ros_msg.range[numGoodBeams] = gz_msg.beams()[i].range().mean();
ros_msg.range_covar[numGoodBeams] = gz_msg.beams()[i].range().variance();
ros_msg.beam_quality[numGoodBeams] = gz_msg.beams()[i].rssi();
gz::math::Vector3d v = gz::msgs::Convert(gz_msg.beams()[i].velocity().mean());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caguero nit: can be const

Comment on lines +149 to +151
ros_msg.beam_unit_vec[numGoodBeams].x = -1;
ros_msg.beam_unit_vec[numGoodBeams].y = -1;
ros_msg.beam_unit_vec[numGoodBeams].z = -1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caguero why not use the normalized mean velocity vector? I don't know if the frames match but we are already assuming they do for the ros to gz conversion.

compareTestMsg(std::make_shared<gz::msgs::Header>(_msg->header()));
EXPECT_EQ(expected_msg.type(), _msg->type());
// compareTestMsg(std::make_shared<gz::msgs::DVLTrackingTarget>(_msg->target()));
// compareTestMsg(std::make_shared<gz::msgs::DVLKinematicEstimate>(_msg->velocity()));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caguero why are these commented out?

Comment on lines +126 to +128
ros_msg.course_gnd = std::atan2(ros_msg.velocity.y, ros_msg.velocity.x);
ros_msg.speed_gnd = std::sqrt(ros_msg.velocity.x * ros_msg.velocity.x + ros_msg.velocity.y *
ros_msg.velocity.y);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caguero meta: I would double check frames are correct. It's not clear to me what the ROS message definition means by ground speed.

caguero added 2 commits August 4, 2025 16:55
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Signed-off-by: Carlos Agüero <caguero@osrfoundation.org>
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mind to take a look to @hidmic comments too ?

@azeey azeey removed this from the Jetty Release milestone Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

5 participants