Last active
February 16, 2018 16:53
Revisions
-
lucascoelhof revised this gist
Feb 16, 2018 . 1 changed file with 16 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,21 @@ #include <geometry_msgs/Pose.h> #include <kdl/tree.hpp> bool getTransformFromKDL(KDL::Tree tree, std::string root, std::string child, geometry_msgs::Pose& pose) { try { KDL::Chain chain; tree.getChain(root, child, chain); KDL::Frame frame = chain.getSegment(0).getFrameToTip(); pose.position.x = frame.p[0]; pose.position.y = frame.p[1]; pose.position.z = frame.p[2]; frame.M.GetQuaternion(pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w); return true; } catch(std::exception& e) { return false; } } -
lucascoelhof created this gist
Feb 16, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #include <geometry_msgs/Pose.h> #include <kdl/tree.hpp> void getTransformFromKDL(KDL::Tree tree, std::string root, std::string child, geometry_msgs::Pose& pose) { KDL::Chain chain; tree.getChain(root, child, chain); KDL::Frame frame = chain.getSegment(0).getFrameToTip(); pose.position.x = frame.p[0]; pose.position.y = frame.p[1]; pose.position.z = frame.p[2]; frame.M.GetQuaternion(pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w); }