Skip to content

Commit

Permalink
MoveitCpp - path constraints added from PlanningComponent (backport #752
Browse files Browse the repository at this point in the history
) (#781)

Co-authored-by: Marco Lapolla <marco.lapolla5@gmail.com>
  • Loading branch information
henningkayser and lapo5 authored Nov 4, 2021
1 parent a41876a commit f96c84c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ class PlanningComponent
/** \brief Set the goal constraints generated from a named target state */
bool setGoal(const std::string& named_target);

/** \brief Set the path constraints generated from a moveit msg Constraints */
bool setPathConstraints(const moveit_msgs::msg::Constraints& path_constraints);

/** \brief Run a plan from start or current state to fulfill the last goal constraints provided by setGoal() using
* default parameters. */
PlanSolution plan();
Expand Down Expand Up @@ -205,6 +208,7 @@ class PlanningComponent
// The start state used in the planning motion request
moveit::core::RobotStatePtr considered_start_state_;
std::vector<moveit_msgs::msg::Constraints> current_goal_constraints_;
moveit_msgs::msg::Constraints current_path_constraints_;
PlanRequestParameters plan_request_parameters_;
moveit_msgs::msg::WorkspaceParameters workspace_parameters_;
bool workspace_parameters_set_ = false;
Expand Down
8 changes: 8 additions & 0 deletions moveit_ros/planning/moveit_cpp/src/planning_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ const std::string& PlanningComponent::getPlanningGroupName() const
return group_name_;
}

bool PlanningComponent::setPathConstraints(const moveit_msgs::msg::Constraints& path_constraints)
{
current_path_constraints_ = path_constraints;
return true;
}

PlanningComponent::PlanSolution PlanningComponent::plan(const PlanRequestParameters& parameters)
{
last_plan_solution_.reset(new PlanSolution());
Expand Down Expand Up @@ -155,6 +161,8 @@ PlanningComponent::PlanSolution PlanningComponent::plan(const PlanRequestParamet
}
req.goal_constraints = current_goal_constraints_;

req.path_constraints = current_path_constraints_;

// Run planning attempt
::planning_interface::MotionPlanResponse res;
if (planning_pipeline_names_.find(parameters.planning_pipeline) == planning_pipeline_names_.end())
Expand Down

0 comments on commit f96c84c

Please sign in to comment.