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

WIP: Cost function example #679

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft

WIP: Cost function example #679

wants to merge 16 commits into from

Conversation

sjahr
Copy link
Contributor

@sjahr sjahr commented May 11, 2023

Description

Test code for moveit2#2153 that will evolve into a tutorial once the feature is ready

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • While waiting for someone to review your request, please consider reviewing another open pull request to support the maintainers

planning_component_->setStateCostFunction(
[robot_start_state, group_name, planning_scene](const Eigen::VectorXd& state_vector) mutable {
auto clearance_cost_fn =
moveit::cost_functions::getMinJointDisplacementCostFn(*robot_start_state, group_name, planning_scene);
Copy link
Contributor

@marioprats marioprats Oct 25, 2023

Choose a reason for hiding this comment

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

Related to my comment in moveit/moveit2#2153 (comment), here is where I think you could do:

auto clearance_cost_fn =
                  std::bind(moveit::cost_functions::computeMinJointDisplacementCostFn(*robot_start_state, group_name, planning_scene, std::placeholders::_1));

The advantage is that cost_functions wouldn't have to depend on the planning interface StateCostFn, and the whole process is more transparent: you have a function that computes a cost, and you bind it here into a StateCostFn.

@mergify
Copy link

mergify bot commented Oct 26, 2023

This pull request is in conflict. Could you fix it @sjahr?

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.

2 participants