Commit a5b62016 authored by florent's avatar florent
Browse files

Validate config before solving problem in ChppPlanner::solveOneProblem.

parent 2681590f
47. Validate config before solving problem in ChppPlanner::solveOneProblem.
46. Before validating direct path, set penetration in validatorDPCollision.
45. Make ChppPlanner::roadmapBuilderIthProblem() virtual.
44. In ChppPlanner::solveOneProblem, test direct path with all validators of device.
......
......@@ -347,6 +347,11 @@ protected:
private:
/**
\brief Validate configuration and track validation reports.
*/
ktStatus validateConfig(CkppDeviceComponentShPtr inDevice, const CkwsConfigShPtr& inConfig);
/**
\brief Roadmap builder delegate enabling to interrupt roadmap builder.
*/
......
......@@ -480,6 +480,16 @@ ktStatus ChppPlanner::solveOneProblem(unsigned int problemId)
return KD_ERROR ;
}
/*
Test that configurations are valid
*/
if (validateConfig(hppDevice, initConfig) != KD_OK) {
return KD_ERROR;
}
if (validateConfig(hppDevice, goalConfig) != KD_OK) {
return KD_ERROR;
}
double penetration = hppProblem.roadmapBuilder()->penetration();
/*
......@@ -550,7 +560,9 @@ ktStatus ChppPlanner::solveOneProblem(unsigned int problemId)
}
// solve the problem with the roadmapBuilder
/*
solve the problem with the roadmapBuilder
*/
if (hppProblem.roadmapBuilder()) {
if(KD_OK == hppProblem.roadmapBuilder()->solveProblem( *initConfig , *goalConfig , kwsPath)) {
......@@ -726,3 +738,34 @@ void ChppPlanner::interruptPathPlanning()
}
attStopRdmBuilderDelegate->shouldStop(true);
}
ktStatus ChppPlanner::validateConfig(CkppDeviceComponentShPtr inDevice,
const CkwsConfigShPtr& inConfig)
{
inDevice->configValidators()->validate(*inConfig);
if (inConfig->isValid()) {
return KD_OK;
}
for(unsigned int i=0; i<inConfig->countReports(); ++i) {
std::string theValidatorName;
CkwsValidationReportConstShPtr theReport(inConfig->report(i, theValidatorName));
if(!theReport->isValid()) {
ODEBUG1(" " << theValidatorName <<
" failed at validating the configuration.");
// If this is a CkwsDofReport then we can retrieve more information...
CkwsReportCfgDofConstShPtr theDofReport;
theDofReport = KIT_DYNAMIC_PTR_CAST(CkwsReportCfgDof const, theReport);
if(theDofReport) {
for(unsigned int j=0; j<theDofReport->countDofs(); ++j) {
if(!theDofReport->isDofValid(j)) {
ODEBUG1(" Dof #" << j << " is invalid.");
}
}
}
}
}
return KD_ERROR;
}
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