add max_solutions param to plan()

For big problems you just don't want *all* solutions
This commit is contained in:
v4hn 2018-05-30 16:07:33 +02:00
parent ac1ccba883
commit bd1edcbde7
2 changed files with 3 additions and 3 deletions

View File

@ -103,7 +103,7 @@ public:
void init();
/// reset, init scene (if not yet done), and init all stages, then start planning
bool plan();
bool plan(size_t max_solutions = 0);
/// print current task state (number of found solutions and propagated states) to std::cout
void printState(std::ostream &os = std::cout) const;

View File

@ -208,12 +208,12 @@ void Task::compute()
stages()->compute();
}
bool Task::plan()
bool Task::plan(size_t max_solutions)
{
reset();
init();
while(ros::ok() && canCompute()) {
while(ros::ok() && canCompute() && (max_solutions == 0 || numSolutions() < max_solutions)) {
compute();
for (const auto& cb : task_cbs_)
cb(*this);