Commit 93fe1f26 authored by florent's avatar florent Committed by florent
Browse files

ChppProblem: add feature to select wether path optimizer should always be called

	* include/hppCore/hppPlanner.h: add comment,
	* include/hppCore/hppProblem.h,
	* src/hppProblem.cpp:
	add attribute to store whether or not path optimizer should
	be called even when the path resulting from path planning includes
	only one direct path.
parent 407f53b1
......@@ -328,10 +328,13 @@ class ChppPlanner {
/**
\brief Solve a problem in the vector.
\param inRank the rank of the problem in vector.
\return KD_OK or KD_ERROR
If successful, the function stores the resulting path in the hppProblem (hppProblemVector[inRank].addPath()).
See ChppProblem::solve() for more information.
If successful, the function stores the resulting path in the hppProblem.
*/
virtual ktStatus solveOneProblem(unsigned int inRank);
......
......@@ -173,6 +173,18 @@ class ChppProblem
*/
CkwsPathOptimizerShPtr pathOptimizer() ;
/**
\brief Determine whether the path optimizer should always be called
In the default behaviour, ChppProblem::solve() does not call the path
optimizer if the path resulting from path planning includes one single
direct path. This behaviour can be changed by calling this function
with true as an argument.
*/
void alwaysOptimize(bool inAlwaysOptimize) {
attAlwaysOptimize = inAlwaysOptimize;
};
/**
\brief Set configuration extractor
\param inConfigExtractor
......@@ -202,6 +214,18 @@ class ChppProblem
/**
\brief Solve the problem
This function successively performs the following steps
\li check that the problem is well defined,
\li solve the path planning problem
\li optimize the resulting path if success.
The path planning step performs the following operations:
\li call the steering method and validate the resulting path,
\li if failure, call the roadmap builder.
Unless otherwise specified (see ChppProblem::alwaysOptimize()), a path
containing only one direct path is not optimized.
\return KD_OK if success, KD_ERROR if failure
*/
ktStatus solve();
......@@ -310,6 +334,11 @@ class ChppProblem
*/
double attPenetration;
/**
\brief Whether the path optimizer should be called anyway
*/
bool attAlwaysOptimize;
public:
// for notification:
static const CkitNotification::TType ID_HPP_ADD_PATH;
......
......@@ -57,7 +57,8 @@ const std::string ChppProblem::DEVICE_KEY ( "device" );
ChppProblem::ChppProblem ( CkppDeviceComponentShPtr inRobot, double inPenetration ) :
attNotificator ( CkitNotificator::defaultNotificator() ),
attRobot ( inRobot ),
attPenetration(inPenetration)
attPenetration(inPenetration),
attAlwaysOptimize(false)
{
/*
Set the input penetration in the direct path collision validator of the robot
......@@ -73,7 +74,8 @@ ChppProblem::ChppProblem (CkppDeviceComponentShPtr inRobot,
double inPenetration) :
attNotificator ( CkitNotificator::defaultNotificator() ),
attRobot ( inRobot ),
attPenetration(inPenetration)
attPenetration(inPenetration),
attAlwaysOptimize(false)
{
/*
Set the input penetration in the direct path collision validator of the robot
......@@ -97,7 +99,8 @@ ChppProblem::ChppProblem(const ChppProblem& inProblem) :
attObstacleList(inProblem.attObstacleList),
attPathVector(inProblem.attPathVector),
attMapOuter(inProblem.attMapOuter),
attPenetration(inProblem.attPenetration)
attPenetration(inProblem.attPenetration),
attAlwaysOptimize(inProblem.attAlwaysOptimize)
{
}
......
Markdown is supported
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