Skip to content
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 mesh support #156

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Conversation

lorycontixd
Copy link

@lorycontixd lorycontixd commented May 20, 2024

This pull requests aims to extend Jaxsim's parsing functionalities on robot descriptions to meshes.
It does so by using third-party library trimesh to parse the mesh file, and custom algorithm create_mesh_collisions to wrap a mesh with collidable points.


📚 Documentation preview 📚: https://jaxsim--156.org.readthedocs.build//156/

@flferretti
Copy link
Collaborator

@lorycontixd do you prefer a squash and merge or can you please clean the commit history?

Copy link
Collaborator

@flferretti flferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lorycontixd! I wrote some initial comments

.vscode/settings.json Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
tests/test_parser_mesh.py Outdated Show resolved Hide resolved
Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @lorycontixd, it's a great start. First minor changes, I'll review the logic in more detail after these ones are addressed.

.vscode/settings.json Outdated Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
src/jaxsim/parsers/rod/parser.py Outdated Show resolved Hide resolved
@lorycontixd lorycontixd force-pushed the add_mesh_support branch 4 times, most recently from bf8bd78 to 195cb68 Compare May 20, 2024 15:56
Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on trimesh usage. Almost good on my side, I'll do a final check tomorrow.

src/jaxsim/parsers/rod/parser.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
@diegoferigo
Copy link
Member

For the records, this is the function called to load a mesh in trimesh:

https://trimesh.org/trimesh.html#trimesh.load

@flferretti
Copy link
Collaborator

@diegoferigo before merging this, do we want to set meshes support as default or should it be activated using an environment variable?

@diegoferigo
Copy link
Member

@diegoferigo before merging this, do we want to set meshes support as default or should it be activated using an environment variable?

Yes I need to properly assess the implications of merging this PR on existing appplications. Automatically adding the collidable points of all meshes is a huge change of behavior and it will make existing simulations unbearably slow.

@lorycontixd
Copy link
Author

lorycontixd commented May 21, 2024

@diegoferigo @flferretti As of now, random point sampling from a mesh is supported. I think it would be a good idea if I tried to benchmark different values of sampling points and find a good tradeoff between performance and simulation results.

Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready, last comments on the changes before started assessing the new default behavior of mesh collisions in JaxSim.

setup.cfg Show resolved Hide resolved
src/jaxsim/parsers/descriptions/collision.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/descriptions/collision.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/parser.py Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
src/jaxsim/parsers/rod/utils.py Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
@diegoferigo
Copy link
Member

Reminder to myself: bump the version of the ROD dependency before merging this PR.

@lorycontixd lorycontixd force-pushed the add_mesh_support branch 2 times, most recently from 0dddfc1 to c28ae05 Compare June 12, 2024 15:28
- Remove leftover comments
- MeshMappingMethods inherit from IntEnum instead of Enum
- Added center comparison for MeshCollision object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants