Comments (9)
@bmagyar : Seems we got some good results. In our fork we tested a couple of fixes for the padding effect:
- 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.
- 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)
from geometric_shapes.
@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.
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.
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.
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.
from geometric_shapes.
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.
PS.- A couple of comments about the padding update:
- 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".
- 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.
- 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.
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)
- Release geometric_shapes into ROS Noetic? HOT 12
- Release in ROS2 Eloquent? HOT 2
- Add mutex to protect global map
- add so versions? HOT 2
- scaleAndPadd does not keep the object centered HOT 14
- Foxy Release
- Drop -devel from release branch names HOT 3
- foxy build error linking boost libbrary HOT 3
- Possible Memory Leak in constructBodyFromMsgHelper() HOT 1
- Galactic Release HOT 1
- --- stderr: geometric_shapes/src/bodies.cpp:44: warning: redundant redeclaration(s) HOT 3
- building geometric_shapes results in error /visualization_msgs/msg/detail/markertraits.hpp HOT 5
- CI build jobs not running on Foxy HOT 1
- New Release for Rolling / Jammy HOT 3
- bodies.cpp: Variable may be used uninitialized
- colcon build error ros2 humble HOT 8
- Could not load resource mesh rendering error HOT 4
- ROS 1 releases HOT 4
- When FCL 0.6 is the default, bounding box code can be simplified HOT 1
- boost dependency problem with ROS 2 humble and Ubuntu 22.04
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geometric_shapes.