mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
add max_solutions param to plan()
For big problems you just don't want *all* solutions
This commit is contained in:
parent
ac1ccba883
commit
bd1edcbde7
@ -103,7 +103,7 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
/// reset, init scene (if not yet done), and init all stages, then start planning
|
/// 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
|
/// print current task state (number of found solutions and propagated states) to std::cout
|
||||||
void printState(std::ostream &os = std::cout) const;
|
void printState(std::ostream &os = std::cout) const;
|
||||||
|
|
||||||
|
|||||||
@ -208,12 +208,12 @@ void Task::compute()
|
|||||||
stages()->compute();
|
stages()->compute();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Task::plan()
|
bool Task::plan(size_t max_solutions)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
init();
|
init();
|
||||||
|
|
||||||
while(ros::ok() && canCompute()) {
|
while(ros::ok() && canCompute() && (max_solutions == 0 || numSolutions() < max_solutions)) {
|
||||||
compute();
|
compute();
|
||||||
for (const auto& cb : task_cbs_)
|
for (const auto& cb : task_cbs_)
|
||||||
cb(*this);
|
cb(*this);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user