Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
kdl_fwd_kin_chain.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_KINEMATICS_KDL_FWD_KINEMATIC_CHAIN_H
27#define TESSERACT_KINEMATICS_KDL_FWD_KINEMATIC_CHAIN_H
28
31#include <kdl/tree.hpp>
32#include <kdl/chain.hpp>
33#include <kdl/chainfksolverpos_recursive.hpp>
34#include <kdl/chainjnttojacsolver.hpp>
35#include <unordered_map>
36#include <console_bridge/console.h>
37#include <mutex>
38
41
44
46{
47static const std::string KDL_FWD_KIN_CHAIN_SOLVER_NAME = "KDLFwdKinChain";
48
56{
57public:
58 // LCOV_EXCL_START
59 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60 // LCOV_EXCL_STOP
61
62 using Ptr = std::shared_ptr<KDLFwdKinChain>;
63 using ConstPtr = std::shared_ptr<const KDLFwdKinChain>;
64 using UPtr = std::unique_ptr<KDLFwdKinChain>;
65 using ConstUPtr = std::unique_ptr<const KDLFwdKinChain>;
66
67 ~KDLFwdKinChain() override = default;
68 KDLFwdKinChain(const KDLFwdKinChain& other);
72
82 const std::string& base_link,
83 const std::string& tip_link,
84 std::string solver_name = KDL_FWD_KIN_CHAIN_SOLVER_NAME);
85
94 const std::vector<std::pair<std::string, std::string> >& chains,
95 std::string solver_name = KDL_FWD_KIN_CHAIN_SOLVER_NAME);
96
97 tesseract_common::TransformMap calcFwdKin(const Eigen::Ref<const Eigen::VectorXd>& joint_angles) const override final;
98
99 Eigen::MatrixXd calcJacobian(const Eigen::Ref<const Eigen::VectorXd>& joint_angles,
100 const std::string& joint_link_name) const override final;
101
102 std::string getBaseLinkName() const override final;
103 std::vector<std::string> getJointNames() const override final;
104 std::vector<std::string> getTipLinkNames() const override final;
105 Eigen::Index numJoints() const override final;
106 std::string getSolverName() const override final;
107 ForwardKinematics::UPtr clone() const override final;
108
109private:
111 std::string name_;
112 std::unique_ptr<KDL::ChainFkSolverPos_recursive> fk_solver_;
113 std::unique_ptr<KDL::ChainJntToJacSolver> jac_solver_;
115 mutable std::mutex mutex_;
118 tesseract_common::TransformMap calcFwdKinHelperAll(const Eigen::Ref<const Eigen::VectorXd>& joint_angles) const;
119
121 bool calcJacobianHelper(KDL::Jacobian& jacobian,
122 const Eigen::Ref<const Eigen::VectorXd>& joint_angles,
123 int segment_num = -1) const;
124
125}; // class KDLKinematicChain
126
127} // namespace tesseract_kinematics
128#endif // TESSERACT_KDL_KINEMATIC_CHAIN_H
#define vector(a, b, c)
Definition: FloatMath.inl:3227
Forward kinematics functions.
Definition: forward_kinematics.h:47
KDL kinematic chain implementation.
Definition: kdl_fwd_kin_chain.h:56
bool calcJacobianHelper(KDL::Jacobian &jacobian, const Eigen::Ref< const Eigen::VectorXd > &joint_angles, int segment_num=-1) const
calcJacobian helper function
Definition: kdl_fwd_kin_chain.cpp:107
std::shared_ptr< const KDLFwdKinChain > ConstPtr
Definition: kdl_fwd_kin_chain.h:63
KDLFwdKinChain & operator=(const KDLFwdKinChain &other)
Definition: kdl_fwd_kin_chain.cpp:66
std::string solver_name_
Name of this solver.
Definition: kdl_fwd_kin_chain.h:114
std::mutex mutex_
KDL is not thread safe due to mutable variables in Joint Class.
Definition: kdl_fwd_kin_chain.h:115
std::unique_ptr< KDLFwdKinChain > UPtr
Definition: kdl_fwd_kin_chain.h:64
std::shared_ptr< KDLFwdKinChain > Ptr
Definition: kdl_fwd_kin_chain.h:62
Eigen::MatrixXd calcJacobian(const Eigen::Ref< const Eigen::VectorXd > &joint_angles, const std::string &joint_link_name) const override final
Calculates the Jacobian matrix for a given joint state in the reference frame of the specified link.
Definition: kdl_fwd_kin_chain.cpp:131
std::string getSolverName() const override final
Get the name of the solver. Recommend using the name of the class.
Definition: kdl_fwd_kin_chain.cpp:157
std::unique_ptr< KDL::ChainFkSolverPos_recursive > fk_solver_
Definition: kdl_fwd_kin_chain.h:112
KDLFwdKinChain(KDLFwdKinChain &&)=delete
KDLChainData kdl_data_
Definition: kdl_fwd_kin_chain.h:110
KDLFwdKinChain & operator=(KDLFwdKinChain &&)=delete
ForwardKinematics::UPtr clone() const override final
Clone the forward kinematics object.
Definition: kdl_fwd_kin_chain.cpp:63
Eigen::Index numJoints() const override final
Number of joints in robot.
Definition: kdl_fwd_kin_chain.cpp:151
std::string name_
Definition: kdl_fwd_kin_chain.h:111
std::vector< std::string > getTipLinkNames() const override final
Get list of tip link names for kinematic object.
Definition: kdl_fwd_kin_chain.cpp:155
std::vector< std::string > getJointNames() const override final
Get list of joint names for kinematic object.
Definition: kdl_fwd_kin_chain.cpp:149
tesseract_common::TransformMap calcFwdKinHelperAll(const Eigen::Ref< const Eigen::VectorXd > &joint_angles) const
calcFwdKin helper function
Definition: kdl_fwd_kin_chain.cpp:77
std::string getBaseLinkName() const override final
Get the robot base link name.
Definition: kdl_fwd_kin_chain.cpp:153
std::unique_ptr< const KDLFwdKinChain > ConstUPtr
Definition: kdl_fwd_kin_chain.h:65
std::unique_ptr< KDL::ChainJntToJacSolver > jac_solver_
Definition: kdl_fwd_kin_chain.h:113
tesseract_common::TransformMap calcFwdKin(const Eigen::Ref< const Eigen::VectorXd > &joint_angles) const override final
Calculates the transform for each tip link in the kinematic group.
Definition: kdl_fwd_kin_chain.cpp:100
Definition: graph.h:125
Forward kinematics functions.
A basic scene graph using boost.
auto scene_graph
Definition: ikfast_kinematics_7dof_unit.cpp:51
Tesseract KDL utility functions.
Eigen::MatrixXd jacobian
Definition: kinematics_core_unit.cpp:153
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
AlignedMap< std::string, Eigen::Isometry3d > TransformMap
Definition: types.h:66
Definition: forward_kinematics.h:44
static const std::string KDL_FWD_KIN_CHAIN_SOLVER_NAME
Definition: kdl_fwd_kin_chain.h:47
The KDLChainData struct.
Definition: kdl_utils.h:95
Link base_link("base_link")