Skip to content
Snippets Groups Projects
Commit 3d8cb46b authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Reorganize statistics.

  Make "Success" and "Failure" be the sum of sub-categories,
  sub-categories make a partition.
parent 5a357d1a
No related branches found
No related tags found
No related merge requests found
...@@ -108,13 +108,14 @@ namespace hpp { ...@@ -108,13 +108,14 @@ namespace hpp {
/// A Reason is associated to each EdgePtr_t that generated a failure. /// A Reason is associated to each EdgePtr_t that generated a failure.
enum TypeOfFailure { enum TypeOfFailure {
PROJECTION = 0, PATH_PROJECTION_SHORTER = 0,
STEERING_METHOD = 1, PATH_VALIDATION_SHORTER = 1,
PATH_VALIDATION_ZERO = 2, REACHED_DESTINATION_NODE = 2,
PATH_PROJECTION_ZERO = 3, FAILURE = 3,
PATH_PROJECTION_SHORTER = 4, PROJECTION = 4,
PATH_VALIDATION_SHORTER = 5, STEERING_METHOD = 5,
PARTLY_EXTENDED = 6 PATH_VALIDATION_ZERO = 6,
PATH_PROJECTION_ZERO = 7
}; };
static const std::vector<Reason> reasons_; static const std::vector<Reason> reasons_;
......
...@@ -57,13 +57,14 @@ namespace hpp { ...@@ -57,13 +57,14 @@ namespace hpp {
const std::vector<ManipulationPlanner::Reason> const std::vector<ManipulationPlanner::Reason>
ManipulationPlanner::reasons_ = boost::assign::list_of ManipulationPlanner::reasons_ = boost::assign::list_of
(SuccessBin::createReason ("[Fail] Projection")) (SuccessBin::createReason ("--Path could not be fully projected"))
(SuccessBin::createReason ("[Fail] SteeringMethod")) (SuccessBin::createReason ("--Path could not be fully validated"))
(SuccessBin::createReason ("[Fail] Path validation returned length 0")) (SuccessBin::createReason ("--Reached destination node"))
(SuccessBin::createReason ("[Fail] Path could not be projected")) (SuccessBin::createReason ("Failure"))
(SuccessBin::createReason ("[Info] Path could not be fully projected")) (SuccessBin::createReason ("--Projection of configuration on edge leaf"))
(SuccessBin::createReason ("[Info] Path could not be fully validated")) (SuccessBin::createReason ("--SteeringMethod"))
(SuccessBin::createReason ("[Info] Extended partly")); (SuccessBin::createReason ("--Path validation returned length 0"))
(SuccessBin::createReason ("--Path could not be projected at all"));
ManipulationPlannerPtr_t ManipulationPlanner::create (const core::Problem& problem, ManipulationPlannerPtr_t ManipulationPlanner::create (const core::Problem& problem,
const core::RoadmapPtr_t& roadmap) const core::RoadmapPtr_t& roadmap)
...@@ -242,10 +243,12 @@ namespace hpp { ...@@ -242,10 +243,12 @@ namespace hpp {
SuccessStatistics& es = edgeStat (edge); SuccessStatistics& es = edgeStat (edge);
if (!edge->applyConstraints (n_near, qProj_)) { if (!edge->applyConstraints (n_near, qProj_)) {
HPP_STOP_TIMECOUNTER (applyConstraints); HPP_STOP_TIMECOUNTER (applyConstraints);
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[PROJECTION]); es.addFailure (reasons_[PROJECTION]);
return false; return false;
} }
if (qProj_.isApprox (*q_near)) { if (qProj_.isApprox (*q_near)) {
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[PATH_PROJECTION_ZERO]); es.addFailure (reasons_[PATH_PROJECTION_ZERO]);
return false; return false;
} }
...@@ -254,6 +257,7 @@ namespace hpp { ...@@ -254,6 +257,7 @@ namespace hpp {
HPP_START_TIMECOUNTER (buildPath); HPP_START_TIMECOUNTER (buildPath);
if (!edge->build (path, *q_near, qProj_)) { if (!edge->build (path, *q_near, qProj_)) {
HPP_STOP_TIMECOUNTER (buildPath); HPP_STOP_TIMECOUNTER (buildPath);
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[STEERING_METHOD]); es.addFailure (reasons_[STEERING_METHOD]);
return false; return false;
} }
...@@ -266,10 +270,10 @@ namespace hpp { ...@@ -266,10 +270,10 @@ namespace hpp {
if (projShorter) { if (projShorter) {
if (!projPath || projPath->length () == 0) { if (!projPath || projPath->length () == 0) {
HPP_STOP_TIMECOUNTER (projectPath); HPP_STOP_TIMECOUNTER (projectPath);
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[PATH_PROJECTION_ZERO]); es.addFailure (reasons_[PATH_PROJECTION_ZERO]);
return false; return false;
} }
es.addFailure (reasons_[PATH_PROJECTION_SHORTER]);
} }
HPP_STOP_TIMECOUNTER (projectPath); HPP_STOP_TIMECOUNTER (projectPath);
} else projPath = path; } else projPath = path;
...@@ -283,16 +287,17 @@ namespace hpp { ...@@ -283,16 +287,17 @@ namespace hpp {
(projPath, false, fullValidPath, report); (projPath, false, fullValidPath, report);
} catch (const core::projection_error& e) { } catch (const core::projection_error& e) {
hppDout (error, e.what ()); hppDout (error, e.what ());
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[PATH_VALIDATION_ZERO]); es.addFailure (reasons_[PATH_VALIDATION_ZERO]);
return false; return false;
} }
HPP_STOP_TIMECOUNTER (validatePath); HPP_STOP_TIMECOUNTER (validatePath);
if (fullValidPath->length () == 0) { if (fullValidPath->length () == 0) {
es.addFailure (reasons_[FAILURE]);
es.addFailure (reasons_[PATH_VALIDATION_ZERO]); es.addFailure (reasons_[PATH_VALIDATION_ZERO]);
validPath = fullValidPath; validPath = fullValidPath;
return false; return false;
} else { } else {
if (!fullyValid) es.addFailure (reasons_[PATH_VALIDATION_SHORTER]);
if (extendStep_ == 1 || fullyValid) { if (extendStep_ == 1 || fullyValid) {
validPath = fullValidPath; validPath = fullValidPath;
} else { } else {
...@@ -303,6 +308,7 @@ namespace hpp { ...@@ -303,6 +308,7 @@ namespace hpp {
(core::interval_t(t_init, t_init + length * extendStep_)); (core::interval_t(t_init, t_init + length * extendStep_));
} catch (const core::projection_error& e) { } catch (const core::projection_error& e) {
hppDout (error, e.what()); hppDout (error, e.what());
es.addSuccess ();
es.addFailure (reasons_[PATH_PROJECTION_SHORTER]); es.addFailure (reasons_[PATH_PROJECTION_SHORTER]);
return false; return false;
} }
...@@ -310,8 +316,18 @@ namespace hpp { ...@@ -310,8 +316,18 @@ namespace hpp {
hppDout (info, "Extension:" << std::endl hppDout (info, "Extension:" << std::endl
<< es); << es);
} }
if (!projShorter && fullValidPath) es.addSuccess (); if (!projShorter && fullValidPath) {
else es.addFailure (reasons_[PARTLY_EXTENDED]); es.addSuccess ();
es.addFailure (reasons_ [REACHED_DESTINATION_NODE]);
}
else {
es.addSuccess ();
if (projShorter) {
es.addFailure (reasons_ [PATH_PROJECTION_SHORTER]);
} else {
es.addFailure (reasons_ [PATH_VALIDATION_SHORTER]);
}
}
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment