Coder Social home page Coder Social logo

Comments (9)

ana-GT avatar ana-GT commented on June 3, 2024 4

@bmagyar : Seems we got some good results. In our fork we tested a couple of fixes for the padding effect:

  1. Changed the computeVertexNormals(). The original version performed an average of the faces' normals per each vertex. We changed this to be a weighted average using the vertices' angles. There is more than one way to calculate the weights, but we chose this one as it is easy to implement and seems a common choice in the community.
  2. Change the padding function: The original version uses a "radial" padding approach, where the object grows along a line joining the centroid of the object and the vertex being padded. We choose to grow the vertex along its normal, which produces - we think - results more akin to what we'd expect (and results in which the padding is more uniform across the whole surface).

Below are some images showing some comparison tests results (padding ranging from 5 or 10 cm). In each image the leftmost mesh is the original mesh, the one at the middle is the padded version using the original geometric_shapes' padding function and the rightmost mesh is the padded mesh obtained using our modified padding + normal vertex computation.

In case you want to try out the results on your own, you can clone our fork and use the test_scaling.launch file. Just replace the mesh argument with any local mesh you want to test. The result will be 3 meshes (which will be stored in the geometric_shapes/launch folder) such as the ones shown in the images below (original_mesh, padded_mesh and new_padded_mesh)

padding_comparisons_wheels
padding_comparison_table
d985b238.png)
padding_comparison_bin
padding_comparison_long_thin_cube

from geometric_shapes.

BryceStevenWilley avatar BryceStevenWilley commented on June 3, 2024 1

@ana-GT Is there any chance you're willing to open a PR for this? Point 1 seems to be related to some bug, but we can try to fix that before merging. I'd be okay with Point 2, given it's still an improvement, and point 3 should be okay as well (maybe some mesh cleanup can be done later if desired). Overall I see this as a net positive.

from geometric_shapes.

pbeeson avatar pbeeson commented on June 3, 2024

If padding is set like you say above, this also means object like boxes that are open on top will get bigger with padding, but the inside walls pf the bin/box will also get further from the center, meaning that padding a non-convex polygon could result in a mesh that doesn't even intersect the original mesh.

I always assumed "padding" was like a "dilate" operation that fattened the mesh, so the box walls would just fatten up.

from geometric_shapes.

pbeeson avatar pbeeson commented on June 3, 2024

Looking at shapes.cpp, you are correct. Padding is in fact essentially doing what I always thought/knew scaling was doing, in that is pushes all vertices away from the centroid. It seems like what you want is to find the normal for the centroid of the triangles in the mesh and then move the vertices so that the triangular centroids move by the padding amount along that normal.

from geometric_shapes.

bmagyar avatar bmagyar commented on June 3, 2024

Agree and it has been like this since the days of arm_navigation. I think may of us would appreciate a fix for this.
@ana-GT would you be up for submitting a pull request if you figure out a way to solve this?

from geometric_shapes.

pbeeson avatar pbeeson commented on June 3, 2024

from geometric_shapes.

ana-GT avatar ana-GT commented on June 3, 2024

Hi @bmagyar ! As @pbeeson said, an easy way to improve the padding effect would be to apply it along the vertices normals (Blender's approach). We created a fork and are experimenting a bit. I'll let you know soon if we get some good results.

PS.- So far, the first thing to improve is the vertex normal calculation procedure: geometric_shapes calculates vertices normals as the average of the triangle normals, whereas for padding purposes, it seems that a weighted average is more appropriate in order to get uniform, regular normals.

from geometric_shapes.

ana-GT avatar ana-GT commented on June 3, 2024

PS.- A couple of comments about the padding update:

  1. I tested the padded meshes' output it with our collision-free software. There does not seem to be any issues. The only oddity I noticed was a ROS_INFO message from FCL: "eigen: too many iterations in Jacobi transform".
  2. Our padding version produces a more realistic effect (i.e. the object actually "fattens"); however, it still has limitations: For our tabletop example, a padding of 10 cm produces an actual padding on the top surface of ~7cm. This is better than the original ~3cm but still not quite 10 cm.
  3. Our padding approach has a more uniform effect across the mesh's surface. However, for objects with complex geometry (i.e. the bin in the previous comment's image), you can see that the mesh appearance changes with respect to the original. In fact, due to the fattening, some faces/edges in the padded mesh might intersect (i.e. walls growing into one another at a corner edge). This so far does not seem to be a problem for collision detection (as far as I have tested) but only a aesthetic one.

I am not sending a pull request yet since I'd like to hear your comments on the 3 points mentioned above. Also, our fork would need a bit of cleanup first (erase the testing code/launch file, erase the old padding function kept for testing comparison purposes).

from geometric_shapes.

peci1 avatar peci1 commented on June 3, 2024

Anybody interested in this issue might want to chime in to #127 where we're seeking a better new definition of padding.

from geometric_shapes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.