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

[TransitionPlanner] In planPath, call checkProblemAndForwardParameters.

  In startSolve, check that the initial configuration of the main problem
  has been initialized.
parent 7189e445
No related branches found
No related tags found
No related merge requests found
...@@ -162,6 +162,8 @@ class HPP_MANIPULATION_DLLAPI TransitionPlanner : public core::PathPlanner { ...@@ -162,6 +162,8 @@ class HPP_MANIPULATION_DLLAPI TransitionPlanner : public core::PathPlanner {
void init(TransitionPlannerWkPtr_t weak); void init(TransitionPlannerWkPtr_t weak);
private: private:
/// Check problem and forward maxIterations and timeout to inner problem.
void checkProblemAndForwardParameters();
/// Get pointer to edge from an id /// Get pointer to edge from an id
graph::EdgePtr_t getEdgeOrThrow(std::size_t id) const; graph::EdgePtr_t getEdgeOrThrow(std::size_t id) const;
/// Pointer to the problem of the inner planner /// Pointer to the problem of the inner planner
......
...@@ -59,7 +59,7 @@ TransitionPlannerPtr_t TransitionPlanner::createWithRoadmap( ...@@ -59,7 +59,7 @@ TransitionPlannerPtr_t TransitionPlanner::createWithRoadmap(
return shPtr; return shPtr;
} }
void TransitionPlanner::startSolve() { void TransitionPlanner::checkProblemAndForwardParameters() {
// Check that edge has been selected // Check that edge has been selected
// Initialize the planner // Initialize the planner
if (!innerProblem_->constraints() || if (!innerProblem_->constraints() ||
...@@ -68,13 +68,24 @@ void TransitionPlanner::startSolve() { ...@@ -68,13 +68,24 @@ void TransitionPlanner::startSolve() {
"TransitionPlanner::startSolve: inner problem has" "TransitionPlanner::startSolve: inner problem has"
" no constraints. You probably forgot to select " " no constraints. You probably forgot to select "
"the transition."); "the transition.");
innerProblem_->constraints()->configProjector()->rightHandSideFromConfig( // Check that the initial configuration has been initialized
innerProblem_->initConfig()); if (innerProblem_->initConfig().size() != innerProblem_->robot()->configSize()) {
std::ostringstream os;
os << "TransitionPlanner::startSolve: initial configuration size ("
<< innerProblem_->initConfig().size() << ") differs from robot configuration size ( "
<< innerProblem_->robot()->configSize() << "). Did you initialize it ?";
throw std::logic_error(os.str().c_str());
}
// Forward maximal number of iterations to inner planner // Forward maximal number of iterations to inner planner
innerPlanner_->maxIterations(this->maxIterations()); innerPlanner_->maxIterations(this->maxIterations());
// Forward timeout to inner planner // Forward timeout to inner planner
innerPlanner_->timeOut(this->timeOut()); innerPlanner_->timeOut(this->timeOut());
}
void TransitionPlanner::startSolve() {
checkProblemAndForwardParameters();
innerProblem_->constraints()->configProjector()->rightHandSideFromConfig(
innerProblem_->initConfig());
// Call parent implementation // Call parent implementation
core::PathPlanner::startSolve(); core::PathPlanner::startSolve();
} }
...@@ -106,6 +117,7 @@ core::PathVectorPtr_t TransitionPlanner::planPath(const Configuration_t qInit, ...@@ -106,6 +117,7 @@ core::PathVectorPtr_t TransitionPlanner::planPath(const Configuration_t qInit,
if (resetRoadmap) { if (resetRoadmap) {
roadmap()->clear(); roadmap()->clear();
} }
checkProblemAndForwardParameters();
PathVectorPtr_t path = innerPlanner_->solve(); PathVectorPtr_t path = innerPlanner_->solve();
path = optimizePath(path); path = optimizePath(path);
return path; return path;
......
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