Go to the documentation of this file.
26 #ifndef TESSERACT_STATE_SOLVER_KDL_STATE_SOLVER_H
27 #define TESSERACT_STATE_SOLVER_KDL_STATE_SOLVER_H
31 #include <kdl/tree.hpp>
32 #include <kdl/jntarray.hpp>
33 #include <kdl/treejnttojacsolver.hpp>
47 using Ptr = std::shared_ptr<KDLStateSolver>;
48 using ConstPtr = std::shared_ptr<const KDLStateSolver>;
49 using UPtr = std::unique_ptr<KDLStateSolver>;
50 using ConstUPtr = std::unique_ptr<const KDLStateSolver>;
62 void setState(
const Eigen::Ref<const Eigen::VectorXd>& joint_values,
64 void setState(
const std::unordered_map<std::string, double>& joint_values,
66 void setState(
const std::vector<std::string>& joint_names,
67 const Eigen::Ref<const Eigen::VectorXd>& joint_values,
71 SceneState
getState(
const Eigen::Ref<const Eigen::VectorXd>& joint_values,
73 SceneState
getState(
const std::unordered_map<std::string, double>& joint_values,
75 SceneState
getState(
const std::vector<std::string>& joint_names,
76 const Eigen::Ref<const Eigen::VectorXd>& joint_values,
80 SceneState
getState() const override final;
84 Eigen::MatrixXd
getJacobian(const Eigen::Ref<const Eigen::VectorXd>& joint_values,
85 const std::
string& link_name,
88 Eigen::MatrixXd
getJacobian(
const std::unordered_map<std::string, double>& joint_values,
89 const std::string& link_name,
91 Eigen::MatrixXd
getJacobian(
const std::vector<std::string>& joint_names,
92 const Eigen::Ref<const Eigen::VectorXd>& joint_values,
93 const std::string& link_name,
96 std::vector<std::string>
getJointNames() const override final;
104 std::vector<std::
string>
getLinkNames() const override final;
112 bool hasLinkName(const std::
string& link_name) const override final;
116 Eigen::Isometry3d
getLinkTransform(const std::
string& link_name) const override final;
119 const std::
string& to_link_name) const override final;
134 const KDL::JntArray& q_in,
135 const KDL::SegmentMap::const_iterator& it,
136 const Eigen::Isometry3d& parent_frame) const;
139 const KDL::JntArray& q_in,
140 const KDL::SegmentMap::const_iterator& it,
141 const Eigen::Isometry3d& parent_frame) const;
143 bool setJointValuesHelper(KDL::JntArray& q, const std::
string& joint_name, const
double& joint_value) const;
145 bool calcJacobianHelper(KDL::Jacobian& jacobian, const KDL::JntArray& kdl_joints, const std::
string& link_name) const;
148 KDL::JntArray
getKDLJntArray(const std::vector<std::
string>& joint_names,
149 const Eigen::Ref<const Eigen::VectorXd>& joint_values) const;
150 KDL::JntArray
getKDLJntArray(const std::unordered_map<std::
string,
double>& joint_values) const;
156 #endif // TESSERACT_STATE_SOLVER_KDL_STATE_SOLVER_H
std::shared_ptr< const KDLStateSolver > ConstPtr
AlignedVector< Eigen::Isometry3d > VectorIsometry3d
SceneState getState() const override final
Get the current state of the scene.
std::unique_ptr< const KDLStateSolver > ConstUPtr
void calculateTransforms(SceneState &state, const KDL::JntArray &q_in, const KDL::SegmentMap::const_iterator &it, const Eigen::Isometry3d &parent_frame) const
Tesseract Scene Graph State Solver Interface.
tesseract_common::VectorIsometry3d getLinkTransforms() const override final
Get all of the links transforms.
tesseract_common::KinematicLimits getLimits() const override final
Getter for kinematic limits.
std::mutex mutex_
KDL is not thread safe due to mutable variables in Joint Class.
bool setJointValuesHelper(KDL::JntArray &q, const std::string &joint_name, const double &joint_value) const
Eigen::MatrixXd getJacobian(const Eigen::Ref< const Eigen::VectorXd > &joint_values, const std::string &link_name, const tesseract_common::TransformMap &floating_joint_values={}) const override final
Get the jacobian of the solver given the joint values.
bool isActiveLinkName(const std::string &link_name) const override final
Check if link is an active link.
std::vector< int > joint_qnr_
bool hasLinkName(const std::string &link_name) const override final
Check if link name exists.
void calculateTransformsHelper(SceneState &state, const KDL::JntArray &q_in, const KDL::SegmentMap::const_iterator &it, const Eigen::Isometry3d &parent_frame) const
std::vector< std::string > getActiveLinkNames() const override final
Get the vector of active link names.
AlignedMap< std::string, Eigen::Isometry3d > TransformMap
Eigen::Isometry3d getLinkTransform(const std::string &link_name) const override final
Get the transform corresponding to the link.
~KDLStateSolver() override=default
std::unique_ptr< KDLStateSolver > UPtr
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
SceneState current_state_
std::unordered_map< std::string, unsigned int > joint_to_qnr_
tesseract_common::KinematicLimits limits_
std::vector< std::string > getJointNames() const override final
Get the vector of joint names.
std::string getBaseLinkName() const override final
Get the base link name.
std::shared_ptr< KDLStateSolver > Ptr
SceneState getRandomState() const override final
Get the random state of the environment.
Eigen::Isometry3d getRelativeLinkTransform(const std::string &from_link_name, const std::string &to_link_name) const override final
Get transform between two links using the current state.
KDLStateSolver & operator=(const KDLStateSolver &other)
KDLStateSolver(const tesseract_scene_graph::SceneGraph &scene_graph)
std::vector< std::string > getFloatingJointNames() const override final
Get the vector of floating joint names.
std::unique_ptr< StateSolver > UPtr
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
void setState(const Eigen::Ref< const Eigen::VectorXd > &joint_values, const tesseract_common::TransformMap &floating_joint_values={}) override final
Set the current state of the solver.
KDL::JntArray kdl_jnt_array_
StateSolver::UPtr clone() const override
This should clone the object so it may be used in a multi threaded application where each thread woul...
std::vector< std::string > getActiveJointNames() const override final
Get the vector of joint names which align with the limits.
bool calcJacobianHelper(KDL::Jacobian &jacobian, const KDL::JntArray &kdl_joints, const std::string &link_name) const
KDL::JntArray getKDLJntArray(const std::vector< std::string > &joint_names, const Eigen::Ref< const Eigen::VectorXd > &joint_values) const
Get an updated kdl joint array.
std::unique_ptr< KDL::TreeJntToJacSolver > jac_solver_
std::vector< std::string > getLinkNames() const override final
Get the vector of link names.
std::vector< std::string > getStaticLinkNames() const override final
Get a vector of static link names in the environment.
bool processKDLData(const tesseract_scene_graph::SceneGraph &scene_graph)