Go to the documentation of this file.00001 #ifndef KDL_TREE_UTILITIES_H
00002 #define KDL_TREE_UTILITIES_H
00003
00004 #include <kdl/jntarray.hpp>
00005 #include <robodyn_controllers/KdlTreeParser.h>
00006 #include <iostream>
00007
00008 class KdlTreeUtilities : public KdlTreeParser
00009 {
00010 public:
00011 KdlTreeUtilities();
00012 ~KdlTreeUtilities();
00013
00017 inline virtual std::string getBaseName() const
00018 {
00019 return tree.getRootSegment()->first;
00020 }
00021
00025 virtual void getJointNames(std::vector<std::string>& jointNames) const;
00029 inline virtual unsigned int getJointCount() const
00030 {
00031 return tree.getNrOfJoints();
00032 }
00033
00037 void getChainJointNames(const KDL::Chain& chain,
00038 std::vector<std::string>& jointNames) const;
00039
00043 virtual void getChainJointNames(const std::string& toolFrame,
00044 std::vector<std::string>& jointNames) const;
00045
00049 virtual void getChainJointNames(const std::string& baseFrame, const std::string& toolFrame,
00050 std::vector<std::string>& jointNames) const;
00051
00052
00053 bool hasSegment(const std::string& segName) const
00054 {
00055 return getTree().getSegment(segName) != getTree().getSegments().end();
00056 }
00057
00061 virtual bool getChain(const std::string& baseFrame, const std::string& toolFrame, KDL::Chain& chain) const;
00062
00063 virtual void addSegment(const KDL::Segment& segment, const std::string& hookName);
00064
00065 virtual bool removeSegment(const std::string& segName);
00066
00067 bool removeSegRecursive(KDL::Tree& tree, KDL::SegmentMap::const_iterator root, const std::string& hook_name, const std::string& seg_remove_name);
00068
00069 protected:
00070
00071 private:
00072
00073 };
00074
00075 #endif