The hydrodynamics plugin does not account for the pose of the collision relative to the origin of the link
branch:gz-marine and dependencies
platform: all
Description
The hydrodynamics system plugin uses the model's collision meshes to calculate buoyancy and hydrodynamics forces. At each update step a copy of the collision mesh (CGAL surface mesh) is updated to place it the the correct location relative to the wave field. The engine then determines the number of submerged triangles, centroid heights above the local wave field, pressure forces etc.
The function ApplyPose in src/systems/hydrodynamics/Hydrodynamics.cc applies the transformation. In the functions HydrodynamicsPrivate::InitPhysics and HydrodynamicsPrivate::UpdatePhysics the link pose is used; no account is taken for the pose of the collision relative to the link origin.
The results is incorrect buoyancy forces for objects with offset collisions. This may result in objects floating at the wrong level, or upside down.
Example
The example illustrates a number of spherical buoys with the visuals, collisions and inertial elements offset from the link origin. Examples 4 (left most) and 3 (second from left) have the CoM at the link origin but the collision off set 0.5 m below. In both cases the expected behaviour is displayed in example 2 (second from right), where the CoM is displaced down 0.5 m and the collision remains at the origin.
The hydrodynamics plugin does not account for the pose of the collision relative to the origin of the link
gz-marine
and dependenciesDescription
The hydrodynamics system plugin uses the model's collision meshes to calculate buoyancy and hydrodynamics forces. At each update step a copy of the collision mesh (CGAL surface mesh) is updated to place it the the correct location relative to the wave field. The engine then determines the number of submerged triangles, centroid heights above the local wave field, pressure forces etc.
The function
ApplyPose
insrc/systems/hydrodynamics/Hydrodynamics.cc
applies the transformation. In the functionsHydrodynamicsPrivate::InitPhysics
andHydrodynamicsPrivate::UpdatePhysics
the link pose is used; no account is taken for the pose of the collision relative to the link origin.The results is incorrect buoyancy forces for objects with offset collisions. This may result in objects floating at the wrong level, or upside down.
Example
The example illustrates a number of spherical buoys with the visuals, collisions and inertial elements offset from the link origin. Examples 4 (left most) and 3 (second from left) have the CoM at the link origin but the collision off set 0.5 m below. In both cases the expected behaviour is displayed in example 2 (second from right), where the CoM is displaced down 0.5 m and the collision remains at the origin.
https://user-images.githubusercontent.com/24916364/170686783-f1a4e1f1-2dcf-4765-9245-6a950eaa5b34.mov