[Bug 1011] New: KDL Tree.NrOfSegments() and SegmentMap.size() disagreement

Darren Earl <[email protected]>
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <[email protected]/>
http://bugs.orocos.org/show_bug.cgi?id=1011

           Summary: KDL Tree.NrOfSegments() and SegmentMap.size()
                    disagreement
           Product: KDL
           Version: kdl-trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Kinematic chains
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
   Estimated Hours: 0.0


In KDL git repository with HEAD==8e450497c70c1a7cec2ff723fc7b482022c1640f
regarding
orocos_kinematics_dynamics/orocos_kdl/src/tree.hpp
orocos_kinematics_dynamics/orocos_kdl/src/tree.cpp

In Class KDL::Tree the NrOfSegments() function reports one less segment than is
in the SegmentMap segment member variable--presumably the root is not included
in the count of segments. The cause is in the constructor (Tree.cpp):

Tree::Tree(const std::string& _root_name) :
nrOfSegments(0), nrOfJoints(0),root_name(_root_name) {
segments.insert(make_pair(root_name, TreeElement::Root(root_name)));
}

Tree::Tree(const Tree& in) {
segments.clear();
nrOfSegments = 0;
nrOfJoints = 0;
root_name = in.root_name;

segments.insert(make_pair(root_name, TreeElement::Root(root_name)));
this->addTree(in, root_name);
}

nrOfSegments is initialized to zero but the root is inserted into segments. 
The behaviour was responsible for an out-of-bounds array error in 3rd party
code.

-- 
Configure bugmail: http://bugs.orocos.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.
-- 
Orocos-Dev mailing list
[email protected]
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.