-
Notifications
You must be signed in to change notification settings - Fork 21
Added support for baked collision checking #67
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
Conversation
Conflicts: src/OMPLPlanner.cpp
Conflicts: include/or_ompl/OMPLPlannerParameters.h include/or_ompl/StateSpaces.h src/OMPLPlanner.cpp src/StateSpaces.cpp
Conflicts: src/OMPLPlanner.cpp
Conflicts: include/or_ompl/StateSpaces.h
} | ||
catch (const OpenRAVE::openrave_exception & exc) | ||
{ | ||
throw std::runtime_error("collision checker doesn't support baked checks!"); |
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.
Replace these runtime_error
s with openrave_exception
.
There was a logic error before where @cdellin: What was the motivation behind adding |
The pointer to the baked kinbody must be removed before the planner returns, since it owns raw pointers into internal collision checker datastructures which are not guaranteed to persist past the end of the planning call (from what I remember). That was the point of the boost scoped exit logic. I don't understand why resetting an empty smart pointer would cause a SEGFAULT, so I'm not convinced the proposed change actually solves the problem, and I'm afraid removing the stop method introduces other bugs as well. If this is working, I'm ok with keeping it temporarily, but let's definitely not merge until we take a closer look. I will have some cycles tonight. |
A "planning call" consists of I don't understand how this could create memory issues because (as far as I can tell) we don't allocate anything that needs cleanup. If cleanup is necessary, than the baking implementation in PrPy is also broken. |
Then the problem is that the old code didn't correctly call |
For another point of comparison, personalrobotics/comps#9 only
If this is truly necessary, then I am fine with restoring
This Python garbage collector is deterministic and may not destruct the I still don't understand why all of this is necessary. What data structure could possibly go out of scope when the planner returns? We don't allocate any data structures in the planner! |
Yeah, looks like the Line 348 in 00e53f3
|
The planner constructs a baked kinbody object which internally points into the collision checker. If after the planner returns, the collision checker is removed from the environment and destructed, then that kinbody must no longer be used (and actually, the non-destructed kinbody may prevent the collision checker from being destroyed properly). I agree that we should use a context manager to handle baking in PrPy to ensure that the kinbody never outlives the collision checker. |
I also can see that the |
I looked at the implementation of
Even if I am wrong about the ownership semantics, this is only a problem if the Two potential fixes:
Both of those changes guarantee that the |
I agree your proposed fixes will address the immediate issue, but I really don't like the way they assert ownership over the collision checker. This will create unexpected behavior when the user attempts to destroy the collision checker, but it is not destructed because some random planner still holds a pointer that it's not even using. I will put together a better solution to this tonight. |
Yup, bug was introduced by a merge I made on July 21 (d99d6e7). |
… of scoped exit stuff This reverts commit 9efdd85.
…causes a segfault on plan
I just applied the quick fix to address that merge problem from last week, so it certainly shouldn't segfault any longer (I just tested with some log files). I'll implement better logic later tonight. |
BOOST_SCOPE_EXIT((m_or_validity_checker)) { | ||
m_or_validity_checker->stop(); | ||
} BOOST_SCOPE_EXIT_END | ||
|
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.
This needlessly bakes the collision checker twice.
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.
This is delicate -- what if the user has changed the environment between calls to InitPlan
and PlanPath
? For example, what if they want to use different padding/models for validating starts/goals than for doing the actual planning (not sure if anyone actually does this, but they could). I currently get around this by baking in each call to a function, since I can rely on the environment lock.
@cdellin Any update on that new logic? 😁 |
No update yest |
This is sufficiently un-busted that I am merging the current version. I created an issue #103 to track the minor double-baked issue. |
No description provided.