-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting assert failure on isOutsidePolytopeFace box to convex hull mesh (sphere) #322
Comments
Also, I just tested building in release with debug info and as you expect it does not stop at the assert but I would have expected it to return bad results but the results were close to right answer. I think there may be an issue with the EPA implementation. Does fcl have a debug tool for visualizing the expanded polygon? Correct Answer:
Calculated Results:
|
The previous example was ran against a convex hull sphere with 128 triangles where I just ran it against a convex hull sphere 1028 triangles. In debug it still fails at the assert but it does produce the correct answer. Now thinking back I did some looking into this a while back I found that when two objects are in collision the nearest point returned is the closest vertex which explains why I am getting the correct answer with a higher resolution mesh. @SeanCurtis-TRI and @hongkai-dai is the assert a valid check? Calculated Results:
|
We'll have to take a look into this. Right here and now, I have no easy means of looking at the sphere. So, without being able to examine it, I have to rely on questions:
|
Ok, I've cheated and cracked open the linked stl file. The 128 triangles are based on 66 vertices. As geodesic spheres go, it doesn't seem overly spherical. I would expect all vertices to be equidistant from the origin. However, what I observe is that the vertices are bound by a bounding box from And since the left most point is located I presume the higher resolution sphere more closely approximates the sphere ideal. So, this all suggests that, in release mode, you're getting the right answer (for the data provided), but that the assertion in debug mode is being fooled. |
All of those comments are actually mine -- I can't keep my github accounts straight when I'm home. |
@hongkai-dai This is related to your EPA changes -- an assertion is failing and we'll want to investigate why. Do you want to do this or shall I put it on my plate? |
@SeanCurtis-TRI if you have time, could you look into it? I don't think I have time to look into it until Saturday. |
@SeanCurtis-TRI When testing you may need PR #288 which is what I have been using. Also I have been using the ROS package geometric_shapes to import the stl file and it has a function which will convert to convex hull code below. shapes::ShapePtr mesh(shapes::createMeshFromResource("package://tesseract_collision/test/sphere.stl"));
bodies::ConvexMesh convex(mesh.get());
convex.correctVertexOrderFromPlanes();
const std::vector<unsigned int>& triangles = convex.getTriangles();
const EigenSTL::vector_Vector3d& vertices = convex.getVertices();
const EigenSTL::vector_Vector4d& planes = convex.getPlanes();
int triangle_count = triangles.size()/3;
Eigen::Vector3d* fcl_vertices = new Eigen::Vector3d[vertices.size()];
Eigen::Vector3d* fcl_plane_normals = new Eigen::Vector3d[planes.size()];
double* fcl_plane_dis = new double[planes.size()];
int* polygons = new int[4 * triangle_count];
for (unsigned i = 0; i < vertices.size(); ++i)
{
fcl_vertices[i] = vertices[i];
}
for (unsigned i = 0; i < planes.size(); ++i)
{
fcl_plane_normals[i] = planes[i].head<3>();
fcl_plane_dis[i] = planes[i][3];
}
for(auto i = 0; i < triangle_count; ++i)
{
int i1 = triangles[3*i + 0];
int i2 = triangles[3*i + 1];
int i3 = triangles[3*i + 2];
polygons[4*i + 0] = 3;
polygons[4*i + 1] = i1;
polygons[4*i + 2] = i2;
polygons[4*i + 3] = i3;
}
fcl::Convexd fcl_convex(fcl_plane_normals, fcl_plane_dis, planes.size(), fcl_vertices, vertices.size(), polygons); |
#288 seems to be crazy. It's so out of date that it isn't compatible with master. I did a local rebase and find I have failing tests. I'm going to address that first and then I'll look at this particular assertion error. |
@Levi-Armstrong, I've submitted a quick PR to help diagnose your problem. There was a TODO in the code that I felt had a reasonable probability of being your problem. This will help confirm the diagnosis. If you (at least temporarily) merge this into your branch and run in debug mode, let me know what error message you get. I hope/expect you to get a different failure complaining about zero-area triangles. If you don't, well, that'll be informative as well. |
Setup:
When checking these two shapes I am recieving an assert failure in gjk_libccd-inl.h
Assert
assert(isOutsidePolytopeFace(&polytope, &f, &query_point));
Function
This was found when testing PR #288. I am still learning my way around fcl so does anyone have any insight into where I should start looking?
The text was updated successfully, but these errors were encountered: