Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to specify planner termination condition. #1695

Merged
merged 13 commits into from
Nov 21, 2019

Conversation

mamoll
Copy link
Contributor

@mamoll mamoll commented Oct 16, 2019

Description

It adds the ability to specify planner termination conditions in the ompl_planning.yaml file. It is mostly useful for optimizing/anytime planners, since it allows you to let them terminate before the timeout occurs (using either the CostConvergence or ExactSolution termination condition) and testing purposes (running for a fixed number of iterations). The default behavior doesn't change.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@v4hn
Copy link
Contributor

v4hn commented Oct 17, 2019

Repeating Robert's comment in #1686, is it (easily) possible to #ifdef this change to succeed at least with OMPL in ROS melodic (or even kinetic)?

@mamoll mamoll changed the title Pr terminationcondition Allow user to specify planner termination condition. Oct 18, 2019
@mamoll
Copy link
Contributor Author

mamoll commented Oct 18, 2019

I added an OMPL version check for backwards compatibility. This feature should probably be documented somewhere. Where?

@rhaschke
Copy link
Contributor

I cannot verify compatibility with released OMPL. Generally looks good to me. Please fix the compiler warning disturbing Travis.

@henningkayser
Copy link
Member

@mamoll #1686 is merged. Could you rebase this PR and fix remaining warnings?

@mamoll
Copy link
Contributor Author

mamoll commented Nov 4, 2019

@mamoll #1686 is merged. Could you rebase this PR and fix remaining warnings?

done.

@mamoll
Copy link
Contributor Author

mamoll commented Nov 13, 2019

@henningkayser can you approve & merge? I need this to add your multi query planner support that touches some of the same code.

Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some documentation, either in the header or in a tutorial would help (not sure if there's a open PR for that already).

@@ -317,6 +317,8 @@ class ModelBasedPlanningContext : public planning_interface::PlanningContext
virtual ob::StateSamplerPtr allocPathConstrainedSampler(const ompl::base::StateSpace* ss) const;
virtual void useConfig();
virtual ob::GoalPtr constructGoal();
virtual ob::PlannerTerminationCondition constructPlannerTerminationCondition(double timeout,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add documentation here, with what params the functions looks at (the spec's "termination condition"), and what it expects/ generates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@davetcoleman davetcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@@ -317,6 +317,8 @@ class ModelBasedPlanningContext : public planning_interface::PlanningContext
virtual ob::StateSamplerPtr allocPathConstrainedSampler(const ompl::base::StateSpace* ss) const;
virtual void useConfig();
virtual ob::GoalPtr constructGoal();
virtual ob::PlannerTerminationCondition constructPlannerTerminationCondition(double timeout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ompl::base::PlannerTerminationCondition ompl_interface::ModelBasedPlanningContext::constructPlannerTerminationCondition(
double timeout, const ompl::time::point& start)
{
auto it = spec_.config_.find("termination_condition");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add code to the setup assistant to add this feature to the OMPL outputOMPLPlanningYAML() config file:
https://github.com/ros-planning/moveit/blob/master/moveit_setup_assistant/src/tools/moveit_config_data.cpp#L206

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an advanced, optional setting. Like optimization_objective it typically doesn't get set explicitly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, as long as its in the tutorials

#include <ompl/base/samplers/UniformValidStateSampler.h>
#include <ompl/base/goals/GoalLazySamples.h>
#include <ompl/tools/config/SelfConfig.h>
#include <ompl/base/spaces/SE3StateSpace.h>
#include <ompl/datastructures/PDF.h>
// \todo remove when ROS Melodic and older are no longer supported
Copy link
Member

@davetcoleman davetcoleman Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// \todo remove when ROS Melodic and older are no longer supported
// TODO(mamoll) remove when ROS Melodic and older are no longer supported

Small style standard that wasnt documented. Now it is:
https://github.com/ros-planning/moveit.ros.org/pull/379/files

ompl::base::PlannerTerminationCondition ompl_interface::ModelBasedPlanningContext::constructPlannerTerminationCondition(
double timeout, const ompl::time::point& start)
{
auto it = spec_.config_.find("termination_condition");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, as long as its in the tutorials

@davetcoleman davetcoleman merged commit f96e127 into moveit:master Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants