-
Notifications
You must be signed in to change notification settings - Fork 67
Added preliminary implementation of Gjk #27
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
Added preliminary implementation of Gjk #27
Conversation
Can we put the GJK solver code into a separate directory so that we can move it into the public Newton repo when ready so it can be used by other Newton solvers? |
@erikfrey (and Kyle, cannot tag you so far) - I see Kyle is assigned to GJK. What are your plans with this implementation? Are you planning on iterating on that or will the be another (convex mesh only?) implementation? |
@adenzler-nvidia, I have an GJK/EPA implementation that's used in MuJoCo CPU that's extremely robust and fast with no dependencies, that I'm going to try porting over. Moreover I'm going to merge in whatever good parts from the CUDA version that's been floating around. |
Hi Kyle - looking forward to that GJK implementation, I heard it's quite famous :-) A few questions:
|
Hey all, recap of our discussion this morning:
That said, even if want to get this merged, there's an important design question before we proceed: In MuJoCo we let the collision driver decide what geom type pairs should be handled by GJK/EPA rather than a user flag that switches it on for everything. I think the former is preferable for three reasons:
So before we proceed my recommendation would be for someone to have a go at removing the https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_driver.c#L41 @gavrielstate Let's make a directory in here called
Can do that in either this or a separate PR. |
@erikfrey Thank you for the recap. I have other things to do this week, but I should be able to get back to it on Monday. |
@Kenny-Vilella - this has not been properly reviewed yet anyway, right? Then we can focus on reviewing the actual functionality of the code now, and decide which parts of the code organization and settings items we can put into additional issues/tasks. |
Thanks @erikfrey for the recap from Monday's meeting. Here's some extra info:
|
That works, and tracks with our discussion of eventually moving to a geometry library. |
Thanks Kyle - we definitely don't want to hurry this or put you under any kind of stress that would impact the quality of your work. So let's review this and then let you decide how to handle combining the two versions or flipping a switch depending on what works best for you to develop things. |
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.
added a few comments, not finished yet though.
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.
some more comments. Honestly, this is quite difficult to review so I mostly focused on style/coding issues and did not try to understand all the functionality in detail so far.
if depth < -depth_extension: | ||
# Objects are not intersecting, and we do not obtain the closest points as | ||
# specified by depth_extension. | ||
return wp.nan, wp.vec3(wp.nan, wp.nan, wp.nan) |
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'm not sure if it's a good idea to use nan to encode invalid, as it can pollute all the calculations downstream.. But probably fine for now.
@gavrielstate @erikfrey It will probably better to create the collision folder in a different PR. I can see that @nvtw has several PRs to add more primitive collision, so let's wait that all the PRs are in before changing the code structure. |
Removed the |
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.
Approving - thank you very much. Feel free to merge after addressing the comments.
Implementation was made by @eric-heiden and @nvtw, and I made the integration. Only ported the sparse version.
It seems to not fully work.
When I made some columns of sphere collapse on a plane, after a while the spheres will all roll in the same direction.
But since it is still an alpha, it is maybe better to merge it in its current state to let people have better collision support and try to fix the issue in parallel.