moveit2
The MoveIt Motion Planning Framework for ROS 2.
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
kinematics::KinematicsBase Class Referenceabstract

Provides an interface for kinematics solvers. More...

#include <kinematics_base.h>

Inheritance diagram for kinematics::KinematicsBase:
Inheritance graph
[legend]

Public Types

using IKCallbackFn = std::function< void(const geometry_msgs::msg::Pose &, const std::vector< double > &, moveit_msgs::msg::MoveItErrorCodes &)>
 Signature for a callback to validate an IK solution. Typically used for collision checking. More...
 
using IKCostFn = std::function< double(const geometry_msgs::msg::Pose &, const moveit::core::RobotState &, moveit::core::JointModelGroup const *, const std::vector< double > &)>
 Signature for a cost function used to evaluate IK solutions. More...
 

Public Member Functions

virtual bool getPositionIK (const geometry_msgs::msg::Pose &ik_pose, const std::vector< double > &ik_seed_state, std::vector< double > &solution, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const =0
 Given a desired pose of the end-effector, compute the joint angles to reach it. More...
 
virtual bool getPositionIK (const std::vector< geometry_msgs::msg::Pose > &ik_poses, const std::vector< double > &ik_seed_state, std::vector< std::vector< double > > &solutions, KinematicsResult &result, const kinematics::KinematicsQueryOptions &options) const
 Given the desired poses of all end-effectors, compute joint angles that are able to reach it. More...
 
virtual bool searchPositionIK (const geometry_msgs::msg::Pose &ik_pose, const std::vector< double > &ik_seed_state, double timeout, std::vector< double > &solution, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const =0
 Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool searchPositionIK (const geometry_msgs::msg::Pose &ik_pose, const std::vector< double > &ik_seed_state, double timeout, const std::vector< double > &consistency_limits, std::vector< double > &solution, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const =0
 Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool searchPositionIK (const geometry_msgs::msg::Pose &ik_pose, const std::vector< double > &ik_seed_state, double timeout, std::vector< double > &solution, const IKCallbackFn &solution_callback, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const =0
 Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool searchPositionIK (const geometry_msgs::msg::Pose &ik_pose, const std::vector< double > &ik_seed_state, double timeout, const std::vector< double > &consistency_limits, std::vector< double > &solution, const IKCallbackFn &solution_callback, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions()) const =0
 Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool searchPositionIK (const std::vector< geometry_msgs::msg::Pose > &ik_poses, const std::vector< double > &ik_seed_state, double timeout, const std::vector< double > &consistency_limits, std::vector< double > &solution, const IKCallbackFn &solution_callback, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions(), const moveit::core::RobotState *context_state=nullptr) const
 Given a set of desired poses for a planning group with multiple end-effectors, search for the joint angles required to reach them. This is useful for e.g. biped robots that need to perform whole-body IK. Not necessary for most robots that have kinematic chains. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool searchPositionIK (const std::vector< geometry_msgs::msg::Pose > &ik_poses, const std::vector< double > &ik_seed_state, double timeout, const std::vector< double > &consistency_limits, std::vector< double > &solution, const IKCallbackFn &solution_callback, const IKCostFn &cost_function, moveit_msgs::msg::MoveItErrorCodes &error_code, const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions(), const moveit::core::RobotState *context_state=nullptr) const
 Given a set of desired poses for a planning group with multiple end-effectors, search for the joint angles required to reach them. This is useful for e.g. biped robots that need to perform whole-body IK. Not necessary for most robots that have kinematic chains. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines). More...
 
virtual bool getPositionFK (const std::vector< std::string > &link_names, const std::vector< double > &joint_angles, std::vector< geometry_msgs::msg::Pose > &poses) const =0
 Given a set of joint angles and a set of links, compute their pose. More...
 
virtual void setValues (const std::string &robot_description, const std::string &group_name, const std::string &base_frame, const std::vector< std::string > &tip_frames, double search_discretization)
 Set the parameters for the solver, for use with non-chain IK solvers. More...
 
virtual bool initialize (const rclcpp::Node::SharedPtr &node, const moveit::core::RobotModel &robot_model, const std::string &group_name, const std::string &base_frame, const std::vector< std::string > &tip_frames, double search_discretization)
 Initialization function for the kinematics, for use with kinematic chain IK solvers. More...
 
virtual const std::string & getGroupName () const
 Return the name of the group that the solver is operating on. More...
 
virtual const std::string & getBaseFrame () const
 Return the name of the frame in which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used. More...
 
virtual const std::string & getTipFrame () const
 Return the name of the tip frame of the chain on which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used. More...
 
virtual const std::vector< std::string > & getTipFrames () const
 Return the names of the tip frames of the kinematic tree on which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used. More...
 
virtual bool setRedundantJoints (const std::vector< unsigned int > &redundant_joint_indices)
 Set a set of redundant joints for the kinematics solver to use. This can fail, depending on the IK solver and choice of redundant joints!. Also, it sets the discretization values for each redundant joint to a default value. More...
 
bool setRedundantJoints (const std::vector< std::string > &redundant_joint_names)
 Set a set of redundant joints for the kinematics solver to use. This function is just a convenience function that calls the previous definition of setRedundantJoints() More...
 
virtual void getRedundantJoints (std::vector< unsigned int > &redundant_joint_indices) const
 Get the set of redundant joints. More...
 
virtual const std::vector< std::string > & getJointNames () const =0
 Return all the joint names in the order they are used internally. More...
 
virtual const std::vector< std::string > & getLinkNames () const =0
 Return all the link names in the order they are represented internally. More...
 
virtual bool supportsGroup (const moveit::core::JointModelGroup *jmg, std::string *error_text_out=nullptr) const
 Check if this solver supports a given JointModelGroup. More...
 
void setSearchDiscretization (double sd)
 Set the search discretization value for all the redundant joints. More...
 
void setSearchDiscretization (const std::map< int, double > &discretization)
 Sets individual discretization values for each redundant joint. More...
 
double getSearchDiscretization (int joint_index=0) const
 Get the value of the search discretization. More...
 
std::vector< DiscretizationMethodgetSupportedDiscretizationMethods () const
 Returns the set of supported kinematics discretization search types. This implementation only supports the DiscretizationMethods::ONE search. More...
 
void setDefaultTimeout (double timeout)
 For functions that require a timeout specified but one is not specified using arguments, a default timeout is used, as set by this function (and initialized to KinematicsBase::DEFAULT_TIMEOUT) More...
 
double getDefaultTimeout () const
 For functions that require a timeout specified but one is not specified using arguments, this default timeout is used. More...
 
virtual ~KinematicsBase ()
 Virtual destructor for the interface. More...
 
 KinematicsBase ()
 

Static Public Attributes

static const rclcpp::Logger LOGGER = rclcpp::get_logger("moveit_kinematics_base.kinematics_base")
 
static const double DEFAULT_SEARCH_DISCRETIZATION = 0.1
 
static const double DEFAULT_TIMEOUT = 1.0
 

Protected Member Functions

template<typename T >
bool lookupParam (const rclcpp::Node::SharedPtr &node, const std::string &param, T &val, const T &default_val) const
 Enables kinematics plugins access to parameters that are defined for the private namespace and inside 'robot_description_kinematics'. Parameters are searched in the following locations and order. More...
 
void storeValues (const moveit::core::RobotModel &robot_model, const std::string &group_name, const std::string &base_frame, const std::vector< std::string > &tip_frames, double search_discretization)
 

Protected Attributes

rclcpp::Node::SharedPtr node_
 
moveit::core::RobotModelConstPtr robot_model_
 
std::string robot_description_
 
std::string group_name_
 
std::string base_frame_
 
std::vector< std::string > tip_frames_
 
double default_timeout_
 
std::vector< unsigned int > redundant_joint_indices_
 
std::map< int, double > redundant_joint_discretization_
 
std::vector< DiscretizationMethodsupported_methods_
 

Detailed Description

Provides an interface for kinematics solvers.

Definition at line 146 of file kinematics_base.h.

Member Typedef Documentation

◆ IKCallbackFn

using kinematics::KinematicsBase::IKCallbackFn = std::function<void(const geometry_msgs::msg::Pose&, const std::vector<double>&, moveit_msgs::msg::MoveItErrorCodes&)>

Signature for a callback to validate an IK solution. Typically used for collision checking.

Definition at line 154 of file kinematics_base.h.

◆ IKCostFn

using kinematics::KinematicsBase::IKCostFn = std::function<double(const geometry_msgs::msg::Pose&, const moveit::core::RobotState&, moveit::core::JointModelGroup const*, const std::vector<double>&)>

Signature for a cost function used to evaluate IK solutions.

Definition at line 158 of file kinematics_base.h.

Constructor & Destructor Documentation

◆ ~KinematicsBase()

kinematics::KinematicsBase::~KinematicsBase ( )
virtualdefault

Virtual destructor for the interface.

◆ KinematicsBase()

kinematics::KinematicsBase::KinematicsBase ( )

Definition at line 146 of file kinematics_base.cpp.

Member Function Documentation

◆ getBaseFrame()

virtual const std::string& kinematics::KinematicsBase::getBaseFrame ( ) const
inlinevirtual

Return the name of the frame in which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used.

Returns
The string name of the frame in which the solver is operating

Definition at line 424 of file kinematics_base.h.

◆ getDefaultTimeout()

double kinematics::KinematicsBase::getDefaultTimeout ( ) const
inline

For functions that require a timeout specified but one is not specified using arguments, this default timeout is used.

Definition at line 568 of file kinematics_base.h.

◆ getGroupName()

virtual const std::string& kinematics::KinematicsBase::getGroupName ( ) const
inlinevirtual

Return the name of the group that the solver is operating on.

Returns
The string name of the group that the solver is operating on

Definition at line 414 of file kinematics_base.h.

Here is the caller graph for this function:

◆ getJointNames()

virtual const std::vector<std::string>& kinematics::KinematicsBase::getJointNames ( ) const
pure virtual

Return all the joint names in the order they are used internally.

Implemented in srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

Here is the caller graph for this function:

◆ getLinkNames()

virtual const std::vector<std::string>& kinematics::KinematicsBase::getLinkNames ( ) const
pure virtual

◆ getPositionFK()

virtual bool kinematics::KinematicsBase::getPositionFK ( const std::vector< std::string > &  link_names,
const std::vector< double > &  joint_angles,
std::vector< geometry_msgs::msg::Pose > &  poses 
) const
pure virtual

Given a set of joint angles and a set of links, compute their pose.

Parameters
link_namesA set of links for which FK needs to be computed
joint_anglesThe state for which FK is being computed
posesThe resultant set of poses (in the frame returned by getBaseFrame())
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

◆ getPositionIK() [1/2]

virtual bool kinematics::KinematicsBase::getPositionIK ( const geometry_msgs::msg::Pose &  ik_pose,
const std::vector< double > &  ik_seed_state,
std::vector< double > &  solution,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions() 
) const
pure virtual

Given a desired pose of the end-effector, compute the joint angles to reach it.

In contrast to the searchPositionIK methods, this one is expected to return the solution closest to the seed state. Randomly re-seeding is explicitly not allowed.

Parameters
ik_posethe desired pose of the link
ik_seed_statean initial guess solution for the inverse kinematics
solutionthe solution vector
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

Here is the caller graph for this function:

◆ getPositionIK() [2/2]

bool kinematics::KinematicsBase::getPositionIK ( const std::vector< geometry_msgs::msg::Pose > &  ik_poses,
const std::vector< double > &  ik_seed_state,
std::vector< std::vector< double > > &  solutions,
KinematicsResult result,
const kinematics::KinematicsQueryOptions options 
) const
virtual

Given the desired poses of all end-effectors, compute joint angles that are able to reach it.

The default implementation returns only one solution and so its result is equivalent to calling 'getPositionIK(...)' with a zero initialized seed.

Some planners (e.g. IKFast) support getting multiple joint solutions for a single pose. This can be enabled using the |DiscretizationMethods| enum and choosing an option that is not |NO_DISCRETIZATION|.

Parameters
ik_posesThe desired pose of each tip link
ik_seed_statean initial guess solution for the inverse kinematics
solutionsA vector of valid joint vectors. This return has two variant behaviors: 1) Return a joint solution for every input |ik_poses|, e.g. multi-arm support 2) Return multiple joint solutions for a single |ik_poses| input, e.g. underconstrained IK TODO(dave): This dual behavior is confusing and should be changed in a future refactor of this API
resultA struct that reports the results of the query
optionsAn option struct which contains the type of redundancy discretization used. This default implementation only supports the KinematicSearches::NO_DISCRETIZATION method; requesting any other will result in failure.
Returns
True if a valid set of solutions was found, false otherwise.

Definition at line 153 of file kinematics_base.cpp.

Here is the call graph for this function:

◆ getRedundantJoints()

virtual void kinematics::KinematicsBase::getRedundantJoints ( std::vector< unsigned int > &  redundant_joint_indices) const
inlinevirtual

Get the set of redundant joints.

Definition at line 474 of file kinematics_base.h.

◆ getSearchDiscretization()

double kinematics::KinematicsBase::getSearchDiscretization ( int  joint_index = 0) const
inline

Get the value of the search discretization.

Definition at line 538 of file kinematics_base.h.

◆ getSupportedDiscretizationMethods()

std::vector<DiscretizationMethod> kinematics::KinematicsBase::getSupportedDiscretizationMethods ( ) const
inline

Returns the set of supported kinematics discretization search types. This implementation only supports the DiscretizationMethods::ONE search.

Definition at line 554 of file kinematics_base.h.

◆ getTipFrame()

virtual const std::string& kinematics::KinematicsBase::getTipFrame ( ) const
inlinevirtual

Return the name of the tip frame of the chain on which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used.

Returns
The string name of the tip frame of the chain on which the solver is operating

Definition at line 434 of file kinematics_base.h.

Here is the caller graph for this function:

◆ getTipFrames()

virtual const std::vector<std::string>& kinematics::KinematicsBase::getTipFrames ( ) const
inlinevirtual

Return the names of the tip frames of the kinematic tree on which the solver is operating. This is usually a link name. No namespacing (e.g., no "/" prefix) should be used.

Returns
The vector of names of the tip frames of the kinematic tree on which the solver is operating

Definition at line 448 of file kinematics_base.h.

Here is the caller graph for this function:

◆ initialize()

bool kinematics::KinematicsBase::initialize ( const rclcpp::Node::SharedPtr &  node,
const moveit::core::RobotModel robot_model,
const std::string &  group_name,
const std::string &  base_frame,
const std::vector< std::string > &  tip_frames,
double  search_discretization 
)
virtual

Initialization function for the kinematics, for use with kinematic chain IK solvers.

Parameters
robot_model- allow the URDF to be loaded much quicker by passing in a pre-parsed model of the robot
group_nameThe group for which this solver is being configured
base_frameThe base frame in which all input poses are expected. This may (or may not) be the root frame of the chain that the solver operates on
tip_framesThe tip of the chain
search_discretizationThe discretization of the search when the solver steps through the redundancy
Returns
true if initialization was successful, false otherwise

Default implementation returns false and issues a warning to implement this new API. TODO: Make this method purely virtual after some soaking time, replacing the fallback.

Reimplemented in srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

Definition at line 84 of file kinematics_base.cpp.

Here is the caller graph for this function:

◆ lookupParam()

template<typename T >
bool kinematics::KinematicsBase::lookupParam ( const rclcpp::Node::SharedPtr &  node,
const std::string &  param,
T &  val,
const T &  default_val 
) const
inlineprotected

Enables kinematics plugins access to parameters that are defined for the private namespace and inside 'robot_description_kinematics'. Parameters are searched in the following locations and order.

~/<group_name>/ ~/ robot_description_kinematics/<group_name>/ robot_description_kinematics/

This order maintains default behavior by keeping the private namespace as the predominant configuration but also allows groupwise specifications.

Definition at line 607 of file kinematics_base.h.

Here is the caller graph for this function:

◆ searchPositionIK() [1/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const geometry_msgs::msg::Pose &  ik_pose,
const std::vector< double > &  ik_seed_state,
double  timeout,
const std::vector< double > &  consistency_limits,
std::vector< double > &  solution,
const IKCallbackFn solution_callback,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions() 
) const
pure virtual

Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posethe desired pose of the link
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
consistency_limitsthe distance that any joint in the solution can be from the corresponding joints in the current seed state
solutionthe solution vector
solution_callbackA callback to validate an IK solution
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

◆ searchPositionIK() [2/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const geometry_msgs::msg::Pose &  ik_pose,
const std::vector< double > &  ik_seed_state,
double  timeout,
const std::vector< double > &  consistency_limits,
std::vector< double > &  solution,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions() 
) const
pure virtual

Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posethe desired pose of the link
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
consistency_limitsthe distance that any joint in the solution can be from the corresponding joints in the current seed state
solutionthe solution vector
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

◆ searchPositionIK() [3/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const geometry_msgs::msg::Pose &  ik_pose,
const std::vector< double > &  ik_seed_state,
double  timeout,
std::vector< double > &  solution,
const IKCallbackFn solution_callback,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions() 
) const
pure virtual

Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posethe desired pose of the link
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
solutionthe solution vector
solution_callbackA callback to validate an IK solution
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

◆ searchPositionIK() [4/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const geometry_msgs::msg::Pose &  ik_pose,
const std::vector< double > &  ik_seed_state,
double  timeout,
std::vector< double > &  solution,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions() 
) const
pure virtual

Given a desired pose of the end-effector, search for the joint angles required to reach it. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posethe desired pose of the link
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
solutionthe solution vector
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
Returns
True if a valid solution was found, false otherwise

Implemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, lma_kinematics_plugin::LMAKinematicsPlugin, kdl_kinematics_plugin::KDLKinematicsPlugin, _NAMESPACE_::IKFastKinematicsPlugin, and pr2_arm_kinematics::PR2ArmKinematicsPlugin.

◆ searchPositionIK() [5/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const std::vector< geometry_msgs::msg::Pose > &  ik_poses,
const std::vector< double > &  ik_seed_state,
double  timeout,
const std::vector< double > &  consistency_limits,
std::vector< double > &  solution,
const IKCallbackFn solution_callback,
const IKCostFn cost_function,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions(),
const moveit::core::RobotState context_state = nullptr 
) const
inlinevirtual

Given a set of desired poses for a planning group with multiple end-effectors, search for the joint angles required to reach them. This is useful for e.g. biped robots that need to perform whole-body IK. Not necessary for most robots that have kinematic chains. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posesthe desired pose of each tip link, in the same order as the getTipFrames() vector
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
consistency_limitsthe distance that any joint in the solution can be from the corresponding joints in the current seed state
solutionthe solution vector
solution_callbackA callback to validate an IK solution
cost_functionA function to evaluate the cost of a particular IK solution
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
context_state(optional) the context in which this request is being made. The position values corresponding to joints in the current group may not match those in ik_seed_state. The values in ik_seed_state are the ones to use. The state is passed to provide the other joint values, in case they are needed for context, like with an IK solver that computes a balanced result for a biped.
Returns
True if a valid solution was found, false otherwise

Definition at line 352 of file kinematics_base.h.

◆ searchPositionIK() [6/6]

virtual bool kinematics::KinematicsBase::searchPositionIK ( const std::vector< geometry_msgs::msg::Pose > &  ik_poses,
const std::vector< double > &  ik_seed_state,
double  timeout,
const std::vector< double > &  consistency_limits,
std::vector< double > &  solution,
const IKCallbackFn solution_callback,
moveit_msgs::msg::MoveItErrorCodes &  error_code,
const kinematics::KinematicsQueryOptions options = kinematics::KinematicsQueryOptions(),
const moveit::core::RobotState context_state = nullptr 
) const
inlinevirtual

Given a set of desired poses for a planning group with multiple end-effectors, search for the joint angles required to reach them. This is useful for e.g. biped robots that need to perform whole-body IK. Not necessary for most robots that have kinematic chains. This particular method is intended for "searching" for a solution by stepping through the redundancy (or other numerical routines).

Parameters
ik_posesthe desired pose of each tip link, in the same order as the getTipFrames() vector
ik_seed_statean initial guess solution for the inverse kinematics
timeoutThe amount of time (in seconds) available to the solver
consistency_limitsthe distance that any joint in the solution can be from the corresponding joints in the current seed state
solutionthe solution vector
solution_callbackA callback to validate an IK solution
error_codean error code that encodes the reason for failure or success
optionscontainer for other IK options. See definition of KinematicsQueryOptions for details.
context_state(optional) the context in which this request is being made. The position values corresponding to joints in the current group may not match those in ik_seed_state. The values in ik_seed_state are the ones to use. The state is passed to provide the other joint values, in case they are needed for context, like with an IK solver that computes a balanced result for a biped.
Returns
True if a valid solution was found, false otherwise

Reimplemented in srv_kinematics_plugin::SrvKinematicsPlugin.

Definition at line 302 of file kinematics_base.h.

◆ setDefaultTimeout()

void kinematics::KinematicsBase::setDefaultTimeout ( double  timeout)
inline

For functions that require a timeout specified but one is not specified using arguments, a default timeout is used, as set by this function (and initialized to KinematicsBase::DEFAULT_TIMEOUT)

Definition at line 561 of file kinematics_base.h.

◆ setRedundantJoints() [1/2]

bool kinematics::KinematicsBase::setRedundantJoints ( const std::vector< std::string > &  redundant_joint_names)

Set a set of redundant joints for the kinematics solver to use. This function is just a convenience function that calls the previous definition of setRedundantJoints()

Parameters
redundant_joint_namesThe set of redundant joint names.
Returns
False if any of the input joint indices are invalid (exceed number of joints)

Definition at line 111 of file kinematics_base.cpp.

Here is the call graph for this function:

◆ setRedundantJoints() [2/2]

bool kinematics::KinematicsBase::setRedundantJoints ( const std::vector< unsigned int > &  redundant_joint_indices)
virtual

Set a set of redundant joints for the kinematics solver to use. This can fail, depending on the IK solver and choice of redundant joints!. Also, it sets the discretization values for each redundant joint to a default value.

Parameters
redundant_joint_indicesThe set of redundant joint indices (corresponding to the list of joints you get from getJointNames()).
Returns
False if any of the input joint indices are invalid (exceed number of joints)

Reimplemented in prbt_manipulator::IKFastKinematicsPlugin, srv_kinematics_plugin::SrvKinematicsPlugin, and _NAMESPACE_::IKFastKinematicsPlugin.

Definition at line 96 of file kinematics_base.cpp.

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

◆ setSearchDiscretization() [1/2]

void kinematics::KinematicsBase::setSearchDiscretization ( const std::map< int, double > &  discretization)
inline

Sets individual discretization values for each redundant joint.

Calling this method replaces previous discretization settings.

Parameters
discretizationa map of joint indices and discretization value pairs.

Definition at line 524 of file kinematics_base.h.

◆ setSearchDiscretization() [2/2]

void kinematics::KinematicsBase::setSearchDiscretization ( double  sd)
inline

Set the search discretization value for all the redundant joints.

Definition at line 510 of file kinematics_base.h.

Here is the caller graph for this function:

◆ setValues()

void kinematics::KinematicsBase::setValues ( const std::string &  robot_description,
const std::string &  group_name,
const std::string &  base_frame,
const std::vector< std::string > &  tip_frames,
double  search_discretization 
)
virtual

Set the parameters for the solver, for use with non-chain IK solvers.

Parameters
robot_descriptionThis parameter can be used as an identifier for the robot kinematics it is computed for; For example, the name of the ROS parameter that contains the robot description;
group_nameThe group for which this solver is being configured
base_frameThe base frame in which all input poses are expected. This may (or may not) be the root frame of the chain that the solver operates on
tip_framesA vector of tips of the kinematic tree
search_discretizationThe discretization of the search when the solver steps through the redundancy

Definition at line 70 of file kinematics_base.cpp.

Here is the call graph for this function:

◆ storeValues()

void kinematics::KinematicsBase::storeValues ( const moveit::core::RobotModel robot_model,
const std::string &  group_name,
const std::string &  base_frame,
const std::vector< std::string > &  tip_frames,
double  search_discretization 
)
protected

Store some core variables passed via initialize().

Parameters
robot_modelRobotModel, this kinematics solver should act on.
group_nameThe group for which this solver is being configured.
base_frameThe base frame in which all input poses are expected.
tip_framesThe tips of the kinematics tree.
search_discretizationThe discretization of the search when the solver steps through the redundancy

Definition at line 52 of file kinematics_base.cpp.

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

◆ supportsGroup()

bool kinematics::KinematicsBase::supportsGroup ( const moveit::core::JointModelGroup jmg,
std::string *  error_text_out = nullptr 
) const
virtual

Check if this solver supports a given JointModelGroup.

Override this function to check if your kinematics solver implementation supports the given group.

The default implementation just returns jmg->isChain(), since solvers written before this function was added all supported only chain groups.

Parameters
jmgthe planning group being proposed to be solved by this IK solver
error_text_outIf this pointer is non-null and the group is not supported, this is filled with a description of why it's not supported.
Returns
True if the group is supported, false if not.

Definition at line 131 of file kinematics_base.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ base_frame_

std::string kinematics::KinematicsBase::base_frame_
protected

Definition at line 585 of file kinematics_base.h.

◆ DEFAULT_SEARCH_DISCRETIZATION

const double kinematics::KinematicsBase::DEFAULT_SEARCH_DISCRETIZATION = 0.1
static

Definition at line 150 of file kinematics_base.h.

◆ DEFAULT_TIMEOUT

const double kinematics::KinematicsBase::DEFAULT_TIMEOUT = 1.0
static

Definition at line 151 of file kinematics_base.h.

◆ default_timeout_

double kinematics::KinematicsBase::default_timeout_
protected

Definition at line 588 of file kinematics_base.h.

◆ group_name_

std::string kinematics::KinematicsBase::group_name_
protected

Definition at line 584 of file kinematics_base.h.

◆ LOGGER

const rclcpp::Logger kinematics::KinematicsBase::LOGGER = rclcpp::get_logger("moveit_kinematics_base.kinematics_base")
static

Definition at line 149 of file kinematics_base.h.

◆ node_

rclcpp::Node::SharedPtr kinematics::KinematicsBase::node_
protected

Definition at line 581 of file kinematics_base.h.

◆ redundant_joint_discretization_

std::map<int, double> kinematics::KinematicsBase::redundant_joint_discretization_
protected

Definition at line 590 of file kinematics_base.h.

◆ redundant_joint_indices_

std::vector<unsigned int> kinematics::KinematicsBase::redundant_joint_indices_
protected

Definition at line 589 of file kinematics_base.h.

◆ robot_description_

std::string kinematics::KinematicsBase::robot_description_
protected

Definition at line 583 of file kinematics_base.h.

◆ robot_model_

moveit::core::RobotModelConstPtr kinematics::KinematicsBase::robot_model_
protected

Definition at line 582 of file kinematics_base.h.

◆ supported_methods_

std::vector<DiscretizationMethod> kinematics::KinematicsBase::supported_methods_
protected

Definition at line 591 of file kinematics_base.h.

◆ tip_frames_

std::vector<std::string> kinematics::KinematicsBase::tip_frames_
protected

Definition at line 586 of file kinematics_base.h.


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