26 #ifndef INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_UTILS_KINEMATICS_H_ 27 #define INDUSTRIAL_MOVEIT_STOMP_MOVEIT_INCLUDE_STOMP_MOVEIT_UTILS_KINEMATICS_H_ 30 #include <Eigen/Geometry> 31 #include <Eigen/StdVector> 37 #include <moveit_msgs/Constraints.h> 38 #include <moveit_msgs/PositionConstraint.h> 39 #include <moveit_msgs/OrientationConstraint.h> 41 #include <boost/optional.hpp> 46 typedef std::vector<Eigen::Affine3d, Eigen::aligned_allocator<Eigen::Affine3d>>
vector_Affine3d;
96 bool solve(
const Eigen::VectorXd& seed,
const Eigen::Affine3d& tool_pose,Eigen::VectorXd& solution,
97 Eigen::VectorXd tol = Eigen::VectorXd::Constant(6,0.005)) ;
107 bool solve(
const std::vector<double>& seed,
const Eigen::Affine3d& tool_pose,std::vector<double>& solution,
108 std::vector<double> tol = std::vector<double>(6,0.005)) ;
117 bool solve(
const std::vector<double>& seed,
const moveit_msgs::Constraints& tool_constraints,std::vector<double>& solution);
126 bool solve(
const Eigen::VectorXd& seed,
const moveit_msgs::Constraints& tool_constraints,Eigen::VectorXd& solution);
130 std::shared_ptr<TRAC_IK::TRAC_IK> ik_solver_impl_;
131 moveit::core::RobotModelConstPtr robot_model_;
132 moveit::core::RobotStatePtr robot_state_;
133 std::string group_name_;
134 Eigen::Affine3d tf_base_to_root_;
154 boost::optional<moveit_msgs::Constraints>
curateCartesianConstraints(
const moveit_msgs::Constraints& c,
const Eigen::Affine3d& ref_pose,
155 double default_pos_tol = 0.0005,
double default_rot_tol =
M_PI);
167 Eigen::Affine3d& tool_pose, std::vector<double>& tolerance, std::string target_frame =
"");
179 Eigen::Affine3d& tool_pose, Eigen::VectorXd& tolerance,std::string target_frame =
"");
189 const std::vector<double> sampling_resolution = {0.05, 0.05, 0.05,
M_PI_2,
M_PI_2,M_PI_2},
190 int max_samples =20 );
203 const Eigen::Affine3d& pf,
204 const Eigen::ArrayXi& nullity,Eigen::VectorXd& twist);
213 const std::vector<int>& indices,Eigen::MatrixXd& jacb_reduced);
223 double eps = 0.011,
double lambda = 0.01);
236 const Eigen::ArrayXi& constrained_dofs,
const Eigen::VectorXd& joint_pose,
237 Eigen::MatrixXd& jacb_nullspace);
std::vector< Eigen::Affine3d, Eigen::aligned_allocator< Eigen::Affine3d > > vector_Affine3d
bool computeJacobianNullSpace(moveit::core::RobotStatePtr state, std::string group, std::string tool_link, const Eigen::ArrayXi &constrained_dofs, const Eigen::VectorXd &joint_pose, Eigen::MatrixXd &jacb_nullspace)
Convenience function to calculate the Jacobian's null space matrix for an under constrained tool cart...
EigenSTL::vector_Affine3d sampleCartesianPoses(const moveit_msgs::Constraints &c, const std::vector< double > sampling_resolution={0.05, 0.05, 0.05, M_PI_2, M_PI_2, M_PI_2}, int max_samples=20)
Creates cartesian poses in accordance to the constraint and sampling resolution values.
void reduceJacobian(const Eigen::MatrixXd &jacb, const std::vector< int > &indices, Eigen::MatrixXd &jacb_reduced)
Convenience function to remove entire rows of the Jacobian matrix.
MOVEIT_CLASS_FORWARD(AllowedCollisionMatrix)
void computeTwist(const Eigen::Affine3d &p0, const Eigen::Affine3d &pf, const Eigen::ArrayXi &nullity, Eigen::VectorXd &twist)
Computes the twist vector [vx vy vz wx wy wz]' relative to the current tool coordinate system...
boost::optional< moveit_msgs::Constraints > curateCartesianConstraints(const moveit_msgs::Constraints &c, const Eigen::Affine3d &ref_pose, double default_pos_tol=0.0005, double default_rot_tol=M_PI)
Populates the missing parts of a Cartesian constraints in order to provide a constraint that can be u...
static const double LAMBDA
Used in dampening the matrix pseudo inverse calculation.
bool isCartesianConstraints(const moveit_msgs::Constraints &c)
Checks if the constraint structured contains valid data from which a proper cartesian constraint can ...
bool decodeCartesianConstraint(moveit::core::RobotModelConstPtr model, const moveit_msgs::Constraints &constraints, Eigen::Affine3d &tool_pose, Eigen::VectorXd &tolerance, std::string target_frame="")
Extracts the cartesian data from the constraint message.
Wrapper around an IK solver implementation.
void calculateDampedPseudoInverse(const Eigen::MatrixXd &jacb, Eigen::MatrixXd &jacb_pseudo_inv, double eps=0.011, double lambda=0.01)
Calculates the damped pseudo inverse of a matrix using singular value decomposition.