gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Unbounded velocity growth observed with hydrodynamics plugin

Open laughlinbarker opened this issue 1 year ago • 12 comments

Environment

  • OS Version: Ubuntu 22.04.2 LTS
  • Source or binary build: binary, version 7.4.0
    • Rendering plugin: ogre2
      • [X] running in Docker/Singularity
    • Rendering system info:
ubuntu@coyote:/opt/mr/nadir$ lspci -nn | grep VGA
2d:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] [10de:1c82] (rev a1)
ubuntu@coyote:/opt/mr/nadir$  echo "$DISPLAY"
:1
ubuntu@coyote:/opt/mr/nadir$ glxinfo -B | grep -i '\(direct rendering\|opengl\|profile\)' 
direct rendering: Yes
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 510.108.03
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6.0 NVIDIA 510.108.03
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 510.108.03
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
ubuntu@coyote:/opt/mr/nadir$ ps aux | grep Xorg
ubuntu    180400  0.0  0.0   4020  2052 pts/1    S+   13:21   0:00 grep --color=auto Xorg

There appears to be a bug, which I believe to be related to the hydrodynamics plugin, which results in a model world velocity run-away. I've experienced this with my personal model, and it is reproducible in the AUV example provided by [auv_controls.sdf](https://github.com/gazebosim/gz-sim/blob/gz-sim7/examples/worlds/auv_controls.sdf#L139)

Description

  • Expected behavior: Vehicle velocity should decrease upon commanding zero prop speed
  • Actual behavior: Vehicle velocity grows unbounded until sim crash

In my own simulation, the problem is not exhibited when the added mass terms are 0, or significantly smaller than the vehicle mass. I have adjusted the sign of the added mass terms in my own model (non-example LRAUV system) and this does not change the outcome.

I haven't had time yet to check the implementation of Fossen's Eqns in HydrodynamicsPlugins.cc.

I believe M_A (added mass matrix) should be positive definite, symmetric. Yet the terms that exist in [auv_controls.sdf](https://github.com/gazebosim/gz-sim/blob/206def391d6ba23259ce8596e7256c2d705a9e53/examples/worlds/auv_controls.sdf#L144) result in a decidedly negative definite matrix.

Steps to reproduce

  1. Launch the auv sim: gz sim auv_controls.sdf -v 4
  2. Run the prop momentarily: gz topic -t /model/tethys/joint/propeller_joint/cmd_thrust -m gz.msgs.Double -p 'data: -31'
  3. Stop the prop: gz topic -t /model/tethys/joint/propeller_joint/cmd_thrust -m gz.msgs.Double -p 'data: -0'

Output

You can see a video of the problem manifesting here: https://youtube.com/shorts/zExnMM8K-L8 Notice the world velocity of the AUV growing unbounded even once the prop has been commanded to stop.

ogre2.log

laughlinbarker avatar Mar 09 '23 22:03 laughlinbarker