31 nrOfJoints(0), nrOfSegments(0) {
33 std::pair<std::string, TreeElement> val(
"root", root);
42 std::pair<std::string, TreeElement> val(
"root", root);
53 std::pair<std::string, TreeElement> val(
"root", root);
60 const std::string& hook_name) {
61 SegmentMap::iterator parent = segments.find(hook_name);
63 if (parent == segments.end())
65 pair<SegmentMap::iterator, bool> retval;
68 std::pair<std::string, TreeElement> val(segment_name, elem);
70 retval = segments.insert(val);
75 parent->second.children.push_back(retval.first);
79 nrOfJoints +=
segment.getJoint().getNDof();
84 const std::string& hook_name) {
85 string parent_name = hook_name;
87 ostringstream segment_name;
88 segment_name << chain_name <<
"Segment" << i;
91 parent_name = segment_name.str();
99 const std::string& hook_name) {
100 return this->addTreeRecursive(
tree.getSegment(
"root"), tree_name, hook_name);
103 bool Tree::addTreeRecursive(SegmentMap::const_iterator root,
104 const std::string& tree_name,
const std::string& hook_name) {
106 SegmentMap::const_iterator child;
108 for (
unsigned int i = 0; i < root->second.children.size(); i++) {
109 child = root->second.children[i];
111 if (this->
addSegment(child->second.segment, tree_name + child->first,
114 if (!(this->addTreeRecursive(child, tree_name, tree_name
This class encapsulates a serial kinematic interconnection structure. It is build out of segments.
const Segment & getSegment(unsigned int nr) const
unsigned int getNrOfSegments() const
This class encapsulates a simple segment, that is a "rigid body" (i.e., a frame and an inertia) with...
This class encapsulates a tree kinematic interconnection structure. It is build out of segments.
Tree & operator=(const Tree &arg)
bool addTree(const Tree &tree, const std::string &tree_name, const std::string &hook_name)
bool addSegment(const Segment &segment, const std::string &segment_name, const std::string &hook_name)
bool addChain(const Chain &chain, const std::string &chain_name, const std::string &hook_name)
Segment< FEdge *, Vec3r > segment