Commit ecf5726b authored by florent's avatar florent
Browse files

Added a method to interrupt the roadmap builder during path planning process.

A CkwsPlusStopRdmBuilderDelegate is created and stored in ChppPlanner.
Upon calling ChppPlanner::roadmapBuilderIthProblem(), the delegate is
passed to the input roadmap builder.

Calling ChppPlanner::interruptPathPlanning() will interrupt the current path
planning process.
parent b5b169e8
hppCore 1.4 released May 13, 2008
41. Added a method to interrupt the roadmap builder during path planning process.
hppCore 1.4 released June 13, 2008
40. In ChppPlanner::solveOneProblem(): if direct path is valid between initial and goal
configurations, add it in the roadmap.
......
......@@ -19,6 +19,8 @@ INCLUDE
#include "hppCore/hppProblem.h"
#include "kwsPlusStopRdmBuilderDelegate.h"
#ifndef WITHOUT_CHPPDEVICE
KIT_PREDEF_CLASS( ChppBody );
#endif
......@@ -269,6 +271,13 @@ class ChppPlanner {
*/
ktStatus solveOneProblem(unsigned int problemId);
/**
\brief Interrupt current roadmap builder.
\note if no roadmap builder is running, this will interrupt the next one that starts.
*/
void interruptPathPlanning();
/**
\brief Optimize a given path
\param inProblemId Id of the problem owning the path.
......@@ -336,7 +345,16 @@ protected:
*/
std::vector< CkcdObjectShPtr > mObstacleList;
// for nortification.
private:
/**
\brief Roadmap builder delegate enabling to interrupt roadmap builder.
*/
CkwsPlusStopRdmBuilderDelegate* attStopRdmBuilderDelegate;
// for notification.
public:
static const CkitNotification::TType ID_HPP_ADD_ROBOT;
static const CkitNotification::TType ID_HPP_SET_CURRENT_CONFIG;
......
......@@ -58,6 +58,8 @@ ChppPlanner::ChppPlanner()
{
attNotificator = CkitNotificator::defaultNotificator();
mObstacleList.clear();
attStopRdmBuilderDelegate = new CkwsPlusStopRdmBuilderDelegate;
}
......@@ -66,7 +68,7 @@ ChppPlanner::ChppPlanner()
ChppPlanner::~ChppPlanner()
{
// delete hppNotificator;
delete attStopRdmBuilderDelegate;
}
// ==========================================================================
......@@ -282,6 +284,10 @@ ktStatus ChppPlanner::roadmapBuilderIthProblem(unsigned int rank,
notification->unsignedIntValue(ChppPlanner::ROADMAP_KEY, rank);
attNotificator->notify(notification);
/*
Add an interruption delegate to the roadmap builder
*/
inRoadmapBuilder->addDelegate(attStopRdmBuilderDelegate);
ChppProblem& hppProblem = hppProblemVector[rank];
hppProblem.roadmapBuilder(inRoadmapBuilder);
......@@ -679,3 +685,12 @@ ktStatus ChppPlanner::solve()
}
return success;
}
void ChppPlanner::interruptPathPlanning()
{
if (attStopRdmBuilderDelegate == NULL) {
ODEBUG1(":interruptPathPlanning: no stop delegate.");
return;
}
attStopRdmBuilderDelegate->shouldStop(true);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment