[Bug 781] New: reading over the size of "locked_joints_"

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=781

Summary: reading over the size of "locked_joints_"
Product: KDL
Version: kdl-trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P3
Component: Kinematic Solvers
AssignedTo: orocos-dev [..] ...
ReportedBy: sebastien [dot] rubrecht [..] ...
Estimated Hours: 0.0

Problem with chains having a NrOfJoints smaller than NrOfSegments:
in chainjnttojacsolver.cpp, line 57 the loop :
for (unsigned int i=0;i<chain.getNrOfSegments();i++) {
//Calculate new Frame_base_ee
if(chain.getSegment(i).getJoint().getType()!=Joint::None){
//pose of the new end-point expressed in the base
total = T_tmp*chain.getSegment(i).pose(q_in(j));
//changing base of new segment's twist to base frame if it is
not locked
//t_tmp = T_tmp.M*chain.getSegment(i).twist(1.0);
if(!locked_joints_[i])
t_tmp = T_tmp.M*chain.getSegment(i).twist(q_in(j),1.0);
}else{
total = T_tmp*chain.getSegment(i).pose(0.0);

}

contains a test "locked_joints_[i]". However, if the number of joints is
smaller than the number of segments, i goes over (locked_joints_.size()-1),
which may be dangerous.

Regards,
Séb.

--
Configure bugmail: https://www.fmtc.be/bugzilla/orocos/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>

Ruben Smits's picture

[Bug 781] reading over the size of "locked_joints_"

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=781

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

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

--- Comment #1 from Ruben Smits <ruben [dot] smits [..] ...> 2010-09-17 14:02:49 ---
Thanks for spotting this bug,

we should have used j instead if i there, the same error occurs some lines
further. The following fix has been committed on trunk revision 32863:

Index: src/chainjnttojacsolver.cpp
===================================================================
--- src/chainjnttojacsolver.cpp (revision 32405)
+++ src/chainjnttojacsolver.cpp (working copy)
@@ -61,7 +61,7 @@
total = T_tmp*chain.getSegment(i).pose(q_in(j));
//changing base of new segment's twist to base frame if it is
not locked
//t_tmp = T_tmp.M*chain.getSegment(i).twist(1.0);
- if(!locked_joints_[i])
+ if(!locked_joints_[j])
t_tmp = T_tmp.M*chain.getSegment(i).twist(q_in(j),1.0);
}else{
total = T_tmp*chain.getSegment(i).pose(0.0);
@@ -74,7 +74,7 @@
//Only increase jointnr if the segment has a joint
if(chain.getSegment(i).getJoint().getType()!=Joint::None){
//Only put the twist inside if it is not locked
- if(!locked_joints_[i])
+ if(!locked_joints_[j])
jac.setColumn(k++,t_tmp);
j++;
}