Skip to content

Commit 1a25119

Browse files
mpowelsonLevi-Armstrong
authored andcommitted
Add ManipulatorManager update method
1 parent 8ec7791 commit 1a25119

20 files changed

+93
-4
lines changed

tesseract/tesseract/include/tesseract/manipulator_manager.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class ManipulatorManager
5555

5656
bool init(tesseract_environment::Environment::ConstPtr environment, tesseract_scene_graph::SRDFModel::Ptr srdf_model);
5757

58+
/**
59+
* @brief Updates all of the stored solvers
60+
* @return True if successful
61+
*/
62+
bool update();
63+
5864
/**
5965
* @brief This will clone the manager and assign the new environment object
6066
* @param environment The environment the clone is associated with.
@@ -303,13 +309,13 @@ class ManipulatorManager
303309
tesseract_kinematics::ForwardKinematicsFactory::ConstPtr fwd_kin_tree_default_factory_;
304310
tesseract_kinematics::InverseKinematicsFactory::ConstPtr inv_kin_chain_default_factory_;
305311
std::unordered_map<std::string, tesseract_kinematics::ForwardKinematicsFactory::ConstPtr> fwd_kin_factories_;
306-
std::map<std::pair<std::string, std::string>, tesseract_kinematics::ForwardKinematics::ConstPtr>
312+
std::map<std::pair<std::string, std::string>, tesseract_kinematics::ForwardKinematics::Ptr>
307313
fwd_kin_manipulators_;
308-
std::unordered_map<std::string, tesseract_kinematics::ForwardKinematics::ConstPtr> fwd_kin_manipulators_default_;
314+
std::unordered_map<std::string, tesseract_kinematics::ForwardKinematics::Ptr> fwd_kin_manipulators_default_;
309315
std::unordered_map<std::string, tesseract_kinematics::InverseKinematicsFactory::ConstPtr> inv_kin_factories_;
310-
std::map<std::pair<std::string, std::string>, tesseract_kinematics::InverseKinematics::ConstPtr>
316+
std::map<std::pair<std::string, std::string>, tesseract_kinematics::InverseKinematics::Ptr>
311317
inv_kin_manipulators_;
312-
std::unordered_map<std::string, tesseract_kinematics::InverseKinematics::ConstPtr> inv_kin_manipulators_default_;
318+
std::unordered_map<std::string, tesseract_kinematics::InverseKinematics::Ptr> inv_kin_manipulators_default_;
313319

314320
bool registerDefaultChainSolver(const std::string& group_name, const tesseract_scene_graph::ChainGroup& chain_group);
315321
bool registerDefaultJointSolver(const std::string& group_name, const tesseract_scene_graph::JointGroup& joint_group);

tesseract/tesseract/src/manipulator_manager.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ bool ManipulatorManager::init(tesseract_environment::Environment::ConstPtr envir
7676
return success;
7777
}
7878

79+
bool ManipulatorManager::update()
80+
{
81+
bool success = true;
82+
for (auto& fk : fwd_kin_manipulators_)
83+
success &= fk.second->update();
84+
85+
for (auto& ik : inv_kin_manipulators_)
86+
success &= ik.second->update();
87+
88+
return success;
89+
}
90+
7991
ManipulatorManager::Ptr ManipulatorManager::clone(tesseract_environment::Environment::ConstPtr environment) const
8092
{
8193
auto cloned_manager = std::make_shared<ManipulatorManager>(*this);

tesseract/tesseract_kinematics/include/tesseract_kinematics/core/forward_kinematics.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class ForwardKinematics
5858
ForwardKinematics(ForwardKinematics&&) = delete;
5959
ForwardKinematics& operator=(ForwardKinematics&&) = delete;
6060

61+
/**
62+
* @brief Updates kinematics if kinematic parameters have changed
63+
* @return True if successful
64+
*/
65+
virtual bool update() = 0;
66+
6167
/**
6268
* @brief Calculates tool pose of robot chain
6369
* @param pose Transform of end-of-tip relative to root

tesseract/tesseract_kinematics/include/tesseract_kinematics/core/inverse_kinematics.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class InverseKinematics
5757
InverseKinematics(InverseKinematics&&) = delete;
5858
InverseKinematics& operator=(InverseKinematics&&) = delete;
5959

60+
/**
61+
* @brief Updates kinematics if kinematic parameters have changed
62+
* @return True if successful
63+
*/
64+
virtual bool update() = 0;
65+
6066
/**
6167
* @brief Calculates joint solutions given a pose.
6268
* @param solutions A vector of solutions, so check the size of the vector to determine the number of solutions

tesseract/tesseract_kinematics/include/tesseract_kinematics/core/rep_inverse_kinematics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class RobotWithExternalPositionerInvKin : public InverseKinematics
6161

6262
InverseKinematics::Ptr clone() const override;
6363

64+
bool update() override;
65+
6466
bool calcInvKin(Eigen::VectorXd& solutions,
6567
const Eigen::Isometry3d& pose,
6668
const Eigen::Ref<const Eigen::VectorXd>& seed) const override;

tesseract/tesseract_kinematics/include/tesseract_kinematics/core/rop_inverse_kinematics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class RobotOnPositionerInvKin : public InverseKinematics
5959

6060
InverseKinematics::Ptr clone() const override;
6161

62+
bool update() override;
63+
6264
bool calcInvKin(Eigen::VectorXd& solutions,
6365
const Eigen::Isometry3d& pose,
6466
const Eigen::Ref<const Eigen::VectorXd>& seed) const override;

tesseract/tesseract_kinematics/include/tesseract_kinematics/ikfast/ikfast_inv_kin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class IKFastInvKin : public InverseKinematics
9595

9696
InverseKinematics::Ptr clone() const override;
9797

98+
bool update() override;
99+
98100
bool calcInvKin(Eigen::VectorXd& solutions,
99101
const Eigen::Isometry3d& pose,
100102
const Eigen::Ref<const Eigen::VectorXd>& seed) const override;

tesseract/tesseract_kinematics/include/tesseract_kinematics/ikfast/impl/ikfast_inv_kin.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ InverseKinematics::Ptr IKFastInvKin::clone() const
5050
return std::move(cloned_invkin);
5151
}
5252

53+
bool IKFastInvKin::update()
54+
{
55+
return init(name_, base_link_name_, tip_link_name_, joint_names_, link_names_, active_link_names_, limits_);
56+
}
57+
5358
bool IKFastInvKin::calcInvKin(Eigen::VectorXd& solutions,
5459
const Eigen::Isometry3d& pose,
5560
const Eigen::Ref<const Eigen::VectorXd>& seed) const

tesseract/tesseract_kinematics/include/tesseract_kinematics/kdl/kdl_fwd_kin_chain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class KDLFwdKinChain : public ForwardKinematics
6666

6767
ForwardKinematics::Ptr clone() const override;
6868

69+
bool update() override;
70+
6971
bool calcFwdKin(Eigen::Isometry3d& pose, const Eigen::Ref<const Eigen::VectorXd>& joint_angles) const override;
7072

7173
bool calcFwdKin(tesseract_common::VectorIsometry3d& poses,

tesseract/tesseract_kinematics/include/tesseract_kinematics/kdl/kdl_fwd_kin_tree.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class KDLFwdKinTree : public ForwardKinematics
6464

6565
ForwardKinematics::Ptr clone() const override;
6666

67+
bool update() override;
68+
6769
bool calcFwdKin(Eigen::Isometry3d& pose, const Eigen::Ref<const Eigen::VectorXd>& joint_angles) const override;
6870

6971
bool calcFwdKin(tesseract_common::VectorIsometry3d& poses,
@@ -137,6 +139,7 @@ class KDLFwdKinTree : public ForwardKinematics
137139
std::string solver_name_{ "KDLFwdKinTree" }; /**< Name of this solver */
138140
std::vector<std::string> joint_list_; /**< List of joint names */
139141
KDL::JntArray start_state_; /**< Intial state of the tree. Should include all joints in the model. */
142+
std::unordered_map<std::string, double> input_start_state_; /**< Input start state before it has been translated into KDL types */
140143
std::vector<int> joint_qnr_; /**< The kdl segment number corrisponding to joint in joint_lists_ */
141144
std::unordered_map<std::string, unsigned int> joint_to_qnr_; /**< The tree joint name to qnr */
142145
std::vector<std::string> link_list_; /**< List of link names */

0 commit comments

Comments
 (0)