-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add Cone as a collision shape #639
Conversation
Squashing commits to make requested target of main with backports to harmonic. Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
dartsim/src/SDFFeatures.cc
Outdated
meshMgr->CreateCone( | ||
coneMeshName, | ||
_geometry.ConeShape()->Radius(), | ||
_geometry.ConeShape()->Length(), | ||
3, 40); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azeey @scpeters @ahcorde I set these values as they seemed to be "reasonable" tradeoff between increased computation and avoiding "lumpy" cones that can't roll. I think the problem really stems from the implementation in gz-common though, it would be nice if segments were actually a function of arc length or surface area so you get consistent segment sizes. IE the bounded area of each segment by the top vertex ring set is much much much smaller than the area bounded by the ringset adjacent to the bottom cap. I think maybe changing that here to be calculated from a segment area and number of rings instead of number of segments and number of rings would make a lot more sense: https://github.com/gazebosim/gz-common/blob/27f7017c5c1b1fd2ba9c603e92b694f98417175d/graphics/src/MeshManager.cc#L1242-L1313
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the number of rings be set to 0? I would think the rolling issue is affected by the number of segments, but not rings.
Regarding the idea of making segments be a function of the arc length, I think we can do that here---if the rings
can be set to 0, segments
could be a simple function of the radius.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, and even for visualization I was thinking it might not be bad to have less segments with the same logic but just implemented in the gz-common I showed earlier? I guess, is there ever a case where we would desire more than one ring? I would feel like having the input to the mesh function just be number of segments might be enough for all cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there ever a case where we would desire more than one ring?
I can't think of one. The unit_cone
which is created in gz::common::MeshManager
is used in gz::rendering
for the cone in the transform tool. That's the only place I see it used. And for that, I don't think we need more than one ring (0 if you don't count the base circle). Maybe someone That being said, is changing the API worth the hassle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated some shape tests in 71d883e (feel free to cherry-pick) to include the cone (just by duplicating cylinder and search/replace s/ylinder/one/
), and I'm seeing a test failure in dart related to casting to the ConeShape. I commented on the dartsim ShapeFeatures.cc file where I think the problem comes from.
Perhaps we could create a CustomConeShape
that inherits from CustomMeshShape
, so we can cast to CustomConeShape
instead of dart::dynamics::ConeShape
?
dartsim/src/ShapeFeatures.cc
Outdated
|
||
const dart::dynamics::ShapePtr &shape = shapeInfo->node->getShape(); | ||
|
||
if (dynamic_cast<dart::dynamics::ConeShape *>(shape.get())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this cast is failing because we are actually using a MeshShape
instead of a ConeShape
Signed-off-by: Steve Peters <[email protected]>
Cherry-picked and pushed. |
not yet; I was just tinkering with it and since the |
ok, I think I've gotten most of the tests fixed, except for bullet-featherstone, which complains about the bounding box size being larger due to the collision margin parameter, which we should discuss directly
|
Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
Thanks, cherry-picked! |
the following patch will fix tests by reducing the bullet-featherstone margin to 0, but I'm not sure if that will cause problems with contact simulation
|
BTW, I do have your personal github as one of my remotes for that repo so you can always just push to the branch and I can fetch/cherry-pick anything in. 😃 But i'll just apply this diff for now anyhow. |
Signed-off-by: Benjamin Perseghetti <[email protected]>
@scpeters thanks once again, I applied your patch, I think it just needs CI approval. |
Co-authored-by: Steve Peters <[email protected]> Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for working on this! I'm going to merge now to support further testing of the gz-sim PR. We can come back to adjust the bullet collision margin if necessary
Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
Signed-off-by: Benjamin Perseghetti <[email protected]>
🦟 Bug fix
Summary
This helps add the missing cone geometry for primitive/basic parametric shapes:
And is also valuable for visualizations of emitters/source that typically have conic-based spread as seen in this acoustic attack on an IMU by showing the affected area:
Associated PRs:
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.