MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
pose_ik Namespace Reference

Classes

struct  PoseTarget
 

Typedefs

using IKValidationFunction = std::function< bool(const Eigen::VectorXd &solution)>
 

Functions

bool emptyValidationFunction (const Eigen::VectorXd &)
 
tl::expected< Eigen::VectorXd, std::string > solveIK (moveit_pro::base::RobotState &robot_state, const moveit_pro::base::JointModelGroup &group, const std::vector< PoseTarget > &targets, const Eigen::VectorXd &seed, const rclcpp::Duration &timeout, const IKValidationFunction &validation_fn, const Params &params)
 Computes pose inverse kinematics for the given group and set of targets.
 
tl::expected< void, std::string > checkPreconditions (const moveit_pro::base::JointModelGroup &group, const std::vector< PoseTarget > &targets, const Eigen::VectorXd &seed)
 
bool unwindAndCheckLimits (const moveit_pro::base::JointModelGroup &group, Eigen::VectorXd &joint_values)
 

Variables

constexpr auto kSolveModeFirstFound = "first_found"
 
constexpr auto kSolveModeOptimizeDistance = "optimize_distance"
 
constexpr double kMaxJointCost = 50.0
 

Typedef Documentation

◆ IKValidationFunction

using pose_ik::IKValidationFunction = typedef std::function<bool(const Eigen::VectorXd& solution)>

Function Documentation

◆ checkPreconditions()

tl::expected< void, std::string > pose_ik::checkPreconditions ( const moveit_pro::base::JointModelGroup &  group,
const std::vector< PoseTarget > &  targets,
const Eigen::VectorXd &  seed 
)

◆ emptyValidationFunction()

bool pose_ik::emptyValidationFunction ( const Eigen::VectorXd &  )
inline

◆ solveIK()

tl::expected< Eigen::VectorXd, std::string > pose_ik::solveIK ( moveit_pro::base::RobotState &  robot_state,
const moveit_pro::base::JointModelGroup &  group,
const std::vector< PoseTarget > &  targets,
const Eigen::VectorXd &  seed,
const rclcpp::Duration &  timeout,
const IKValidationFunction validation_fn,
const Params &  params 
)

Computes pose inverse kinematics for the given group and set of targets.

This implements a Jacobian-based Newton-Raphson IK solver. The random sequence used internally is deterministic: given the same inputs, the solver will always find the same solution.

Parameters
robot_stateA robot state, used to compute FK. It will be updated to the solution, if a solution is found, or arbitrarily if not.
groupThe joint model group to compute IK for.
targetsThe target poses to compute IK for.
seedA joint configuration to be used as a first seed, before starting taking random configurations.
timeoutSearch timeout in seconds.
paramsOther IK parameters like tolerance, etc. params.joint_costs optionally holds one cost multiplier per active joint of group, in JointModelGroup::getActiveJointModelNames() order. A joint's cost scales how expensive it is to move away from seed, so raising it biases the solver toward solutions that move that joint less. Every entry must be finite and at least 1.0, the unbiased baseline; an empty list means "no bias", and kMaxJointCost is the accepted maximum — see that constant for why. Prefer the smallest cost that produces the bias you want. Costs only take effect when params.solve_mode is optimize_distance — see the error note below.
Returns
a joint-space solution that brings tip_link to root_pose_tip, or an error message if the preconditions are not met. Supplying non-empty params.joint_costs with params.solve_mode == "first_found" is an error rather than a no-op: that mode returns the first valid solution without ranking candidates, so the costs would otherwise be silently discarded. For the same reason, non-empty costs combined with a params.optimization_distance_gain that is not finite and strictly positive are also an error: zero flattens every candidate's cost, and a negative gain reverses the bias. That gain remains valid at zero when no costs are supplied, which is what the parameter's own validation allows.

◆ unwindAndCheckLimits()

bool pose_ik::unwindAndCheckLimits ( const moveit_pro::base::JointModelGroup &  group,
Eigen::VectorXd &  joint_values 
)

Variable Documentation

◆ kMaxJointCost

constexpr double pose_ik::kMaxJointCost = 50.0
inlineconstexpr

◆ kSolveModeFirstFound

constexpr auto pose_ik::kSolveModeFirstFound = "first_found"
inlineconstexpr

◆ kSolveModeOptimizeDistance

constexpr auto pose_ik::kSolveModeOptimizeDistance = "optimize_distance"
inlineconstexpr