srmainwaring / asv_wave_sim

This package contains plugins that support the simulation of waves and surface vessels in Gazebo.
GNU General Public License v3.0
114 stars 31 forks source link

Add checks for collinear points in hydrodynamics calculations #50

Open srmainwaring opened 2 years ago

srmainwaring commented 2 years ago

CGAL 5.4 on Ubuntu 22.04 is raising a CGAL::Precondition_exception because the calculation of submerged triangles results in some arrangements with collinear points.

terminate called after throwing an instance of 'CGAL::Precondition_exception'
  what():  CGAL ERROR: precondition violation!

The library requires additional checks that all mesh triangles are non-degenerate, and should handle exceptions gracefully.

Replicate

System: Ubuntu Jammy (22.04)

$ gz sim -v4 -s -r waves.sdf

Only the spherical buoy needs to be included to produce the error.

Related

There are 2 failing tests in UNIT_CGAL_TEST on Ubuntu.

$ ./build/gz-marine1/bin/UNIT_CGAL_TEST 
[==========] Running 15 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 15 tests from CGAL
[ RUN      ] CGAL.Surprising
[       OK ] CGAL.Surprising (0 ms)
[ RUN      ] CGAL.SurfaceMesh
[       OK ] CGAL.SurfaceMesh (0 ms)
[ RUN      ] CGAL.AABBPolyhedronFacetIntersection
[       OK ] CGAL.AABBPolyhedronFacetIntersection (0 ms)
[ RUN      ] CGAL.SurfaceMeshGridCell
unknown file: Failure
C++ exception with description "CGAL ERROR: precondition violation!
Expr: ! running
File: /usr/include/CGAL/Timer.h
Line: 83" thrown in the test body.
[  FAILED  ] CGAL.SurfaceMeshGridCell (0 ms)
[ RUN      ] CGAL.SurfaceMeshGrid
[       OK ] CGAL.SurfaceMeshGrid (1 ms)
[ RUN      ] CGAL.SurfaceMeshModifyGrid
[       OK ] CGAL.SurfaceMeshModifyGrid (0 ms)
[ RUN      ] CGAL.SurfaceMeshWavefield
[       OK ] CGAL.SurfaceMeshWavefield (1285 ms)
[ RUN      ] CGAL.VertexRangeIterator
[       OK ] CGAL.VertexRangeIterator (0 ms)
[ RUN      ] CGAL.CreateTriangulationN
unknown file: Failure
C++ exception with description "CGAL ERROR: assertion violation!
Expr: n == N[2]
File: /usr/include/CGAL/Triangulation_ds_face_base_2.h
Line: 224" thrown in the test body.
[  FAILED  ] CGAL.CreateTriangulationN (0 ms)
[ RUN      ] CGAL.CreateTriangulationHierarchyN
[       OK ] CGAL.CreateTriangulationHierarchyN (0 ms)
[ RUN      ] CGAL.CreateTriangulation3
[       OK ] CGAL.CreateTriangulation3 (0 ms)
[ RUN      ] CGAL.CreateTriangulation4
[       OK ] CGAL.CreateTriangulation4 (0 ms)
[ RUN      ] CGAL.CreateConstrainedTrianguation4
[       OK ] CGAL.CreateConstrainedTrianguation4 (0 ms)
[ RUN      ] CGAL.CreateCTAlt
[       OK ] CGAL.CreateCTAlt (0 ms)
[ RUN      ] CGAL.CreateCTAltN
[       OK ] CGAL.CreateCTAltN (159 ms)
[----------] 15 tests from CGAL (1447 ms total)

[----------] Global test environment tear-down
[==========] 15 tests from 1 test suite ran. (1447 ms total)
[  PASSED  ] 13 tests.
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] CGAL.SurfaceMeshGridCell
[  FAILED  ] CGAL.CreateTriangulationN

 2 FAILED TESTS