Go to the documentation of this file.00001 #ifndef _ROBOT_MARKERS_FORWARD_KINEMATICS_H_
00002 #define _ROBOT_MARKERS_FORWARD_KINEMATICS_H_
00003
00004 #include <string>
00005 #include <vector>
00006
00007 #include "geometry_msgs/TransformStamped.h"
00008 #include "kdl/frames.hpp"
00009 #include "kdl/segment.hpp"
00010 #include "kdl/tree.hpp"
00011 #include "urdf/model.h"
00012
00013 namespace robot_markers {
00014 class SegmentPair {
00015 public:
00016 SegmentPair(const KDL::Segment& p_segment, const std::string& p_root,
00017 const std::string& p_tip);
00018
00019 KDL::Segment segment;
00020 std::string root, tip;
00021 };
00022
00026 class ForwardKinematics {
00027 public:
00031 explicit ForwardKinematics(const urdf::Model& model);
00032
00036 void Init();
00037
00044 void GetTransforms(
00045 const std::map<std::string, double>& joint_positions,
00046 std::vector<geometry_msgs::TransformStamped>* transforms) const;
00047
00048 private:
00049 urdf::Model model_;
00050 KDL::Tree tree_;
00051 std::map<std::string, SegmentPair> segments_;
00052
00053 void AddChildren(const KDL::SegmentMap::const_iterator segment);
00054 };
00055 }
00056
00057 #endif // _ROBOT_MARKERS_FORWARD_KINEMATICS_H_