Gazebo | Ignition | Community
Ask Your Question

buoyancy neutral object goes up with hydrodynamics plugin

asked 2017-03-14 23:15:02 -0500

kalvik gravatar image

updated 2017-03-15 10:36:46 -0500

Hello, I made an object in gazebo. I am using the hydrodynamics plugin on it. The fluid density is 1000. Every part of the object has the same density 1000. Its total weight is 0.218 kgs. When I start the sim the object just keeps going up. Why is it doing this. Since the object has the same density as its surroundings doesn't my object have neutral buoyancy? When I increase my objects weight to a couple of kgs it stays at the bottom. Why is it doing this?

edit retag flag offensive close merge delete


It might be easier for someone to help you if you provide a simple example model which reproduces the problem you're having. The yellow submarine on the example stays in place:

chapulina gravatar imagechapulina ( 2017-03-15 10:49:25 -0500 )edit

I am making a bluerobotics T200 thruster. It's relatively small and weighs 0.211 kgs. When I create it in gazebo it ends up going to the surface and floating at the top. I guess if I attach the thruster to a thruster then it won't have the same issue.A simpler example of my problem would be if I make a tube which weighs 0.211kgs but with the same density as water (along with the hydrodynamics plugin) it floats at the surface instead of staying in place.

kalvik gravatar imagekalvik ( 2017-03-15 15:07:20 -0500 )edit

Are you using the `<volume>` tag?

chapulina gravatar imagechapulina ( 2017-03-15 15:28:49 -0500 )edit

I am using the model editor and I am not aware of a volume tag so no.

kalvik gravatar imagekalvik ( 2017-03-15 15:30:34 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-11-06 07:16:57 -0500

Duckfrost gravatar image

updated 2017-11-27 07:21:35 -0500

Maybe this example might help you understand the fundamentals. Also its an example with URDF, which might be usefull for further ROS integration. Here you have the launch files and the URDF to test it. Also the script to calculate the Buoyancy Forces of a sphere.

Here you have a full video tutorial: VIDEO





You can launch the world through the launch main.launch, and spawn the sphere through the spawn_simple_sphere.launch

Then you can play around with the mass , radius and fluid_desnisty to get different buoyancy. You can calculate the perfect neutral buoyancy with the help of the script. It will tell you the force produced by buoyancy and of the weight of the Sphere. All this is applicable to any shape of course.

Hope this helps understand a bit better and complement the previous answers given.


Here you have a second part explaining how to do it with a complex 3D shape from a dae file: VIDEO PART 2 Basically you could try it with the 3D mesh real volume but the plugin doesnt fully support that still so I also teach you how to know the volume of the bounding box and use that instead.

The formula we use too calculate the neutral buoyancy mass is: Ff: Final Force

Fb: Buoyancy Force

W: Weight of the object

Ff = Fb - W

Ff = 0, because we want neutral buoyancy.

Fb = FluidDensity * 3dMeshVolume

W = mass * gravity

mass = FluidDensity * 3dMeshVolume

This massis the one you have to put in the URDF file.

Bare in mind that even with this the force distribution has to be evenly distributed otherwise it can make the robot be in an unstable situation. But that's another topic that you will need to calibrate yourself depending on what you want.


Here I give you the urdf for the 3DMesh version and the geometric version.



For the 3D mesh you use Blender 3DPrint plugin to get its volume. For the geometric versions you dont need that, with formulas is ok. You can use the that I give at the top of the question to calculate all you need including the mass that it has to have to have neautral buoyancy.

Here you have the VIDEO PART3 that explain all this in more detail.

Also bare in mind that when changing the mas of an object and shape, you have to recalculate the inertial matrix. I give a pythons script also to make those calculations for you

The only thing that it wouldn't be solve is that there is no friction with the fluid and therefore it migh move in un unstable way.

edit flag offensive delete link more

answered 2017-03-15 15:59:26 -0500

chapulina gravatar image

So based on the comments, I think you might not be setting all the necessary parameters for the buoyancy plugin. I suggest you go through this tutorial, which explains the parameters for that plugin:

When attaching the plugin to the model using the model editor, be sure to add the <volume> tag under <link>. Otherwise, Gazebo will use the bounding box of the link by default. If you want a density of 1000 kg / m^3 for a mass of 0.218 kg, the volume should be voume = mass / density = 0.218 / 1000 = 0.00218 m^3.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2017-03-14 23:15:02 -0500

Seen: 1,727 times

Last updated: Nov 27 '17