Skip to content

Cost function API for MoveIt 2 #2240

@sjahr

Description

@sjahr

This issue summarizes and tracks the ongoing effort to add a custom function API to MoveIt 2 for better support of optimizing planners.

Motivation

In order to get an optimal solution for a specific problem as a user I want to pass cost terms to the planning algorithms that encode soft constraints for a motion planning problem

What is considered the best solution for a motion planning problem is highly application specific. Typical requirements are:

  • collision-free
  • smoothness
  • path lenght
  • min. clearance from collision objects

These requirements can be expressed to a planning algorithm as costs and/or constraints. Currently, we can pass hard constraints to planning algorithms but no cost terms. The supported optimizing planners use implementation-specific cost functions that cannot be re-used by other planners and it is hard to create custom cost terms.

Background

Cost and Constraints

(Hard) Constraints Cost (Soft constraints)
Describe the validity of a state or path Describe the quality of a state or path
Can be modeled as costs with a high fixed (or smoothed) penalty Costs can be modeled as constraints by defining an ideal value
Examples: Collision checking, Joint goal pose Examples: Path length, Path clearance
In MoveIt some constraints (e.g. goal constraints) can have tolerances
Internally, the MoveIt planning algorithms evaluate constraints with an implementation-specific validity checker

Optimizing planners in MoveIt 2

  • OMPL provides a bunch of optimizing planners like RRT*, PRM*, or AnytimePathShortening. The optimization goal can be specified via an OptimizationObjective in the OMPL config .yaml file. At this point it is not possible to combine multiple objectives.

  • STOMP and CHOMP
    Both are optimizing planners. While they would theoretically support it, it is not possible to pass custom optimizations goals to either of them with the currently available MoveIt API Optimizing

Optimizing IK solvers in MoveIt 2

MoveIt 2 supports passing custom cost functions to IK solvers which offers an API for it. Right now the available solvers for this feature are BioIK(ros2 version) and pick_ik

Implementation

The goal of this epic is to extend the existing MoveIt 2 API to enable specifying an application-specific, planner-agnostic cost function and pass it with the MotionPlanRequest to an optimizing planner plugin
A cost function implementation should allow:

  • Concatenating multiple weighted cost terms
  • Generating cost terms from constraints

The implementation is split into the following parts:

  • Adding a planner state cost function API State cost function interface #2153
    • Add state cost function to motion plan request
    • Enabling usage of custom state cost function in OMPL & STOMP plugin
    • Provide implementation for clearance state cost term
    • Create a tutorial that can be used to test the state cost function API WIP: Cost function example moveit2_tutorials#679
  • Create path cost function API
    • Add path cost function to motion plan request
    • Enabling usage of custom path cost function in OMPL & STOMP plugin
    • Provide implementation for path length cost term
    • Enhance existing tutorial to support testing the path cost function API

Happy to hear your feedback and/or additions and to get your reviews 😃

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions