[WIP][AO migration] collision groups, Bullet debugging, contact queries, RigidObject changes#1247
[WIP][AO migration] collision groups, Bullet debugging, contact queries, RigidObject changes#1247aclegg3 wants to merge 3 commits into
Conversation
| template <typename Func> | ||
| void processActiveManifolds(btMultiBodyDynamicsWorld* bWorld, Func func); |
jturner65
left a comment
There was a problem hiding this comment.
LGTM. Just a few docstrings missing that I found.
| } | ||
| std::string getStepCollisionSummary() override { | ||
| return BulletDebugManager::get().getStepCollisionSummary(bWorld_.get()); | ||
| } |
| void lookUpObjectIdAndLinkId(const btCollisionObject* colObj, | ||
| int* objectId, | ||
| int* linkId) const; | ||
|
|
There was a problem hiding this comment.
I left a bunch of comments. Overall, I'm concerned here. I implemented CollisionGroupHelper and BulletDebugManager, and I certainly intended them as short-term hacks to unblock Andrew, not well-engineered solutions to be merged into master. Unless we are in a rush to get this merged into master, we should step back and re-think these interfaces.
Update: my biggest concern is that the CollisionGroupHelper interface will force Hab2.0 users to fork hab-sim (instead of using, say, a conda installation). This is because another user is unlikely to want/need the exact set of groups and group interactions that Andrew needed, which is currently what CollisionGroupHelper hard-codes.
| }; | ||
| */ | ||
|
|
||
| enum class CollisionGroup { |
There was a problem hiding this comment.
This list is specific to Andrew's Fetch rearrangement project, would you agree? Do you expect that hab-sim users need to always fork hab-sim for their application?
I suggest that we add python bindings to let the application specify collision groups as well as their interactions, rather than hard-coding these.
CollisionGroupHelper is a class I created as a temporary hack. I don't think it's suited to merge to master as-is.
| * @brief Describe collision-filtering for all known collision objects (see | ||
| * also mapCollisionObjectTo). | ||
| * | ||
| * Unfortunately, this will cause a crash if you have added and then removed |
There was a problem hiding this comment.
This is not robust enough as-is to merge to master, as described here. I have an idea for a fix that I will post in the cpp.
|
|
||
| std::string BulletDebugManager::getCollisionFilteringSummary(bool doVerbose) { | ||
| std::stringstream s2; | ||
| for (const auto& pair0 : collisionObjectToDebugName_) { |
There was a problem hiding this comment.
The declaration for the function mentions how this function is unsafe (it can crash). The issue is that Bullet collision objects can be deleted but this debug manager doesn't get notified of that.
One solution is to change this function to start by iterating through all Bullet collision objects known to Bullet (this list must exist somewhere). In this way, we naturally skip over items in collisionObjectToDebugName_ corresponding to deleted collision objects.
| s << " (none)" << std::endl; | ||
| } | ||
|
|
||
| LOG(INFO) << s.str(); |
There was a problem hiding this comment.
This logging is a horrible hack I did as a workaround at one point (specifically, I had trouble printing very long strings to stdout). This function shouldn't directly log; it should return all results in the string.
| return; | ||
| } | ||
| // TODO: will come with AO support | ||
| /* else if (existingArticulatedObjects_.count(rawObjectId)) { |
There was a problem hiding this comment.
What's going on here? This function looks half-finished.
There was a problem hiding this comment.
Just trying to show why linkId is part of this function at all, since it is still valid for rigids. This block should be uncommented with AOs.
| Noncollidable = 256 | ||
| }; | ||
|
|
||
| class CollisionGroupHelper { |
There was a problem hiding this comment.
documentation for this class?
| Noncollidable = 256 | ||
| }; | ||
|
|
||
| class CollisionGroupHelper { |
There was a problem hiding this comment.
We should have a unit test for this class's functionality (setting collision group for objects and verifying they interact or don't correctly).
| }; | ||
| */ | ||
|
|
||
| int CollisionGroupHelper::getMaskForGroup(CollisionGroup group) { |
There was a problem hiding this comment.
Two problems with this implementation:
- It is app-specific and shouldn't be hard-coded in hab-sim (as I've already mentioned)
- As far as actually specifying collision-group interaction (whether in C++ or python), a better way to do this is to explicitly enable interaction between pairs of groups. A problem with the current approach here is that you are able to express contradictory interactions: for example, in Static's case statement, Static can be set to interact with GraspedObject, while in the GraspedObject case statement, GraspedObject might be set to not interact with Static.
|
Not much value left in this WIP PR. |
Motivation and Context
ArticulatedObject migration PR split from #1226.
This PR wraps all significant physics related changes which are not directly related to ArticulatedObjects:
These changes are being further broken into individual PRs for review iteration/polish and this PR will be closed.
How Has This Been Tested
Should be covered by current tests. Expanded a PhysicsTest to check new contactTest functionality.
Types of changes
Checklist