moveit2
The MoveIt Motion Planning Framework for ROS 2.
Public Member Functions | Static Public Member Functions | List of all members
constraint_samplers::ConstraintSamplerManager Class Reference

This class assists in the generation of a ConstraintSampler for a particular group from a moveit_msgs::msg::Constraints. More...

#include <constraint_sampler_manager.h>

Public Member Functions

 ConstraintSamplerManager ()
 Empty constructor. More...
 
void registerSamplerAllocator (const ConstraintSamplerAllocatorPtr &sa)
 Allows the user to specify an alternate ConstraintSamplerAllocation. More...
 
ConstraintSamplerPtr selectSampler (const planning_scene::PlanningSceneConstPtr &scene, const std::string &group_name, const moveit_msgs::msg::Constraints &constr) const
 Selects among the potential sampler allocators. More...
 

Static Public Member Functions

static ConstraintSamplerPtr selectDefaultSampler (const planning_scene::PlanningSceneConstPtr &scene, const std::string &group_name, const moveit_msgs::msg::Constraints &constr)
 Default logic to select a ConstraintSampler given a constraints message. More...
 

Detailed Description

This class assists in the generation of a ConstraintSampler for a particular group from a moveit_msgs::msg::Constraints.

It contains logic that will generate either a JointConstraintSampler, an IKConstraintSampler, or a UnionConstraintSampler depending on the contents of the Constraints message and the group in question.

Definition at line 59 of file constraint_sampler_manager.h.

Constructor & Destructor Documentation

◆ ConstraintSamplerManager()

constraint_samplers::ConstraintSamplerManager::ConstraintSamplerManager ( )
inline

Empty constructor.

Definition at line 66 of file constraint_sampler_manager.h.

Member Function Documentation

◆ registerSamplerAllocator()

void constraint_samplers::ConstraintSamplerManager::registerSamplerAllocator ( const ConstraintSamplerAllocatorPtr &  sa)
inline

Allows the user to specify an alternate ConstraintSamplerAllocation.

Parameters
saThe constraint sampler allocator that will be used

Definition at line 74 of file constraint_sampler_manager.h.

◆ selectDefaultSampler()

ConstraintSamplerPtr constraint_samplers::ConstraintSamplerManager::selectDefaultSampler ( const planning_scene::PlanningSceneConstPtr &  scene,
const std::string &  group_name,
const moveit_msgs::msg::Constraints &  constr 
)
static

Default logic to select a ConstraintSampler given a constraints message.

This function will generate a sampler using the joint_constraint, position_constraint, and orientation_constraint vectors from the Constraints argument. The type of constraint sampler that is produced depends on which constraint vectors have been populated. The following rules are applied:

  • If every joint in the group indicated by group_name is constrained by a valid joint constraint in the joint_constraints vector, a JointConstraintSampler with all bounded joints in returned.
  • If not every joint is constrained, but no position and orientation constraints are specified, or no valid IKConstraintSampler can be created, then a JointConstraintSampler with some unbounded joints is returned.
  • If position and orientation constraints are present and there is an IKSolver for the group, the function will attempt to create an IKConstraintSampler.
  • If there is no direct IK solver for the group, or no valid IKConstraintSampler could be generated, and there are subgroup IKSolvers, the function will attempt to generate a sampler from the various subgroup solvers.
    • It will attempt to determine which constraints act on the IK link for the sub-group IK solvers, and attempts to create ConstraintSampler functions by recursively calling selectDefaultSampler for the sub-group.
    • If any samplers are valid, it adds them to a vector of type ConstraintSamplerPtr.
    • Once it has iterated through each sub-group, if any samplers are valid, they are returned in a UnionConstraintSampler, along with a JointConstraintSampler if one exists.
      Parameters
      sceneThe planning scene that will be used to create the ConstraintSampler
      group_nameThe group name for which to create a sampler
      constrThe set of constraints for which to create a sampler
      Returns
      A valid ConstraintSamplerPtr if one could be allocated, and otherwise an empty ConstraintSamplerPtr

Definition at line 60 of file constraint_sampler_manager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectSampler()

ConstraintSamplerPtr constraint_samplers::ConstraintSamplerManager::selectSampler ( const planning_scene::PlanningSceneConstPtr &  scene,
const std::string &  group_name,
const moveit_msgs::msg::Constraints &  constr 
) const

Selects among the potential sampler allocators.

This function will iterate through the constraint sampler allocators, trying to find one that can service the constraints. The first one that can service the request will be called. If no allocators can service the Constraints, or there are no allocators, the selectDefaultSampler will be called.

Parameters
sceneThe planning scene that will be passed into the constraint sampler
group_nameThe group name for which to allocate the constraint sampler
constrThe constraints
Returns
An allocated ConstraintSamplerPtr, or an empty pointer if none could be allocated

Definition at line 48 of file constraint_sampler_manager.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: