[Bug 814] New: Hard-coded root

http://bugs.orocos.org/show_bug.cgi?id=814

Summary: Hard-coded root
Product: KDL
Version: kdl-trunk
Platform: i386 Compatible
OS/Version: GNU/Linux
Status: NEW
Severity: major
Priority: P5
Component: Kinematic Solvers
AssignedTo: orocos-dev [..] ...
ReportedBy: stuff [..] ...
Estimated Hours: 0.0

Created attachment 630
--> http://bugs.orocos.org/attachment.cgi?id=630
removes 'getSegment("root")', adds 'getRootSegment()'

In treefksolverpos_recursive.cpp and treejnttojacsolver.cpp the root segment
gets obtained by 'tree.getSegment("root")'. If the root of the tree has a
different name this results in an error. Instead 'tree.getRootSegment()' should
be used.

Ruben Smits's picture

[Bug 814] Hard-coded root

http://bugs.orocos.org/show_bug.cgi?id=814

Ruben Smits <ruben [dot] smits [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |ruben [dot] smits [..] ...en.b
| |e
Resolution| |FIXED

--- Comment #1 from Ruben Smits <ruben [dot] smits [..] ...> 2011-02-09 21:25:43 CET ---
Thanks for the patch, applied on the master branch of
http://git.mech.kuleuven.be/robotics/orocos_kinematics_dynamics.git:

commit 178f0ca63f89efc8e7c0213a7ebe4fa28cce84d2
Author: Ruben Smits <ruben [dot] smits [..] ...>
Date: Wed Feb 9 21:21:35 2011 +0100

kdl: fix bug 814: Hard-coded root

Applied patch 630 From: Marcus Liebhardt <stuff [..] ...>

Signed-off-by: Ruben Smits <ruben [dot] smits [..] ...>

diff --git a/kdl/src/treefksolverpos_recursive.cpp
b/kdl/src/treefksolverpos_recursive.cpp
index 08039f0..87d1615 100644
--- a/kdl/src/treefksolverpos_recursive.cpp
+++ b/kdl/src/treefksolverpos_recursive.cpp
@@ -52,7 +52,7 @@ namespace KDL {
const TreeElement& currentElement = it->second;
Frame currentFrame =
currentElement.segment.pose(q_in(currentElement.q_nr));

- SegmentMap::const_iterator rootIterator =
tree.getSegment("root");
+ SegmentMap::const_iterator rootIterator =
tree.getRootSegment();
if(it == rootIterator){
return currentFrame;
}
diff --git a/kdl/src/treejnttojacsolver.cpp b/kdl/src/treejnttojacsolver.cpp
index 761a790..1c2eaef 100644
--- a/kdl/src/treejnttojacsolver.cpp
+++ b/kdl/src/treejnttojacsolver.cpp
@@ -33,7 +33,7 @@ int TreeJntToJacSolver::JntToJac(const JntArray& q_in,
Jacobian& jac, const std:
//Let's make the jacobian zero:
SetToZero(jac);

- SegmentMap::const_iterator root = tree.getSegments().find("root");
+ SegmentMap::const_iterator root = tree.getRootSegment();

Frame T_total = Frame::Identity();
//Lets recursively iterate until we are in the root segment