-
Notifications
You must be signed in to change notification settings - Fork 30
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
[WIP] return Colliding Bodies' Names if user given state is in collision #235
Conversation
Codecov Report
@@ Coverage Diff @@
## master #235 +/- ##
======================================
Coverage 70.8% 70.8%
======================================
Files 172 172
Lines 5059 5059
Branches 802 802
======================================
Hits 3582 3582
Misses 993 993
Partials 484 484
|
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 a pretty gross way of returning the information. Instead, I suggest adding an optional output parameter to the base isSatisfied()
interface that is populated with debugging information if provided.
This is a little tricky to implement because each implementation of Testable
would populate different fields. Here is my best suggestion:
-
Add a base class for
Testable
diagnostic information that is printable, to enable parity with the functionality that you have here:class TestableOutcome { public: bool is_satisfied() const = 0; virtual std::string to_string() const = 0; };
-
Modify
isSatisfied()
to have an optionalTestableOutcome
output parameter:bool isSatisfied(const aikido::statespace::StateSpace::State* _state, TestableOutcome* _outcome = nullptr);
-
Implement a concrete subclass of
TestableOutcome
for eachTestable
constraint, e.g.:class NonCollidingOutcome : public virtual TestableOutcome { // implementation of is_satisfied() and to_string() }
-
Add a pure
virtual
overload ofisSatisfied()
to theTestable
base class to make it possible to call (2) without knowing the concrete type ofTestableOutcome
that must be passed in as the output parameter:bool isSatisfied(const aikido::statespace::StateSpace::State* _state, std::unique_ptr<TestableOutcome>* _outcome = nullptr);
Given this architecture, this is how you would print the debugging information that you have today:
NonCollidingOutcome outcome;
noncolliding_testable.isSatisfied(state, &outcome);
std::cout << outcome.to_string() << std::endl;
If you don't know the type of Testable
at compile time, you could use (4) to do this:
std::unique_ptr<TestableOutcome> outcome;
testable.isSatisfied(state, &outcome);
std::cout << outcome->to_string() << std::endl;
The key advantage of this API is that it provides programmatic access to the information that is currently printed to stdout
. This is critical to implement good backtracking strategies for multi-step planning algorithms like MAGI.
@@ -14,8 +14,10 @@ class Testable | |||
virtual ~Testable() = default; | |||
|
|||
/// Returns true if state satisfies this constraint. | |||
/// \param _givenState: true if state is user-provided |
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.
What does this mean? Isn't _state
always user provided? 😕
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.
Nit: We don't use :
(semicolon) for a parameter docstring.
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 guess _state
is set to false
when the checking state is provided by a planner, and, in that case, we don't want to terminate the planning due (could reject the sample though).
I think we don't need _givenState
parameter for enforcing the planner to terminate. It's actually done by the caller (see this). _givenState
is just using to determine whether a concrete Testable
prints.
I agree with @mkoval that changing the way of receiving debug information.
Great suggestions! Loved the point about the programmatic access. |
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.
There are many "unused parameter" warnings due to _givenState
. Currently, Travis CI doesn't test the working branch so it couldn't catch this. Please double check if all the warnings and errors (if any) on a local computer.
@@ -24,6 +24,11 @@ trajectory::InterpolatedPtr planOMPL( | |||
double _maxPlanTime, | |||
double _maxDistanceBtwValidityChecks) | |||
{ | |||
|
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.
Nit: Please remove unnecessary this whitespace
@@ -73,6 +78,10 @@ trajectory::InterpolatedPtr planOMPL( | |||
double _maxPlanTime, | |||
double _maxDistanceBtwValidityChecks) | |||
{ | |||
|
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.
Nit: Please remove unnecessary this whitespace
@@ -17,6 +17,10 @@ trajectory::InterpolatedPtr planSnap( | |||
const std::shared_ptr<aikido::constraint::Testable>& constraint, | |||
aikido::planner::PlanningResult& planningResult) | |||
{ | |||
|
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.
Nit: Please remove unnecessary this whitespace
@@ -218,6 +218,10 @@ trajectory::InterpolatedPtr planCRRT( | |||
double _maxDistanceBtwProjections, | |||
double _minStepsize) | |||
{ | |||
|
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.
Nit: Please remove unnecessary this whitespace
@@ -303,6 +307,10 @@ trajectory::InterpolatedPtr planCRRTConnect( | |||
double _minStepsize, | |||
double _minTreeConnectionDistance) | |||
{ | |||
|
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.
Nit: Please remove unnecessary this whitespace
@@ -14,8 +14,10 @@ class Testable | |||
virtual ~Testable() = default; | |||
|
|||
/// Returns true if state satisfies this constraint. | |||
/// \param _givenState: true if state is user-provided |
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.
Nit: We don't use :
(semicolon) for a parameter docstring.
@@ -14,8 +14,10 @@ class Testable | |||
virtual ~Testable() = default; | |||
|
|||
/// Returns true if state satisfies this constraint. | |||
/// \param _givenState: true if state is user-provided |
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 guess _state
is set to false
when the checking state is provided by a planner, and, in that case, we don't want to terminate the planning due (could reject the sample though).
I think we don't need _givenState
parameter for enforcing the planner to terminate. It's actually done by the caller (see this). _givenState
is just using to determine whether a concrete Testable
prints.
I agree with @mkoval that changing the way of receiving debug information.
I think we'll wind up rewriting this entirely per @mkoval's suggestion, so I'm just going to close this PR. The branch will still be somewhat useful until we have the new implementation, though. |
This PR forces the planning procedure to terminate if the user provided start state is in collision and prints the body nodes that are in collision.
WIP: Needs tests.
Before creating a pull request
make format
Before merging a pull request
CHANGELOG.md