Hi Kristof,
On Thu, Jan 20, 2011 at 4:16 AM, Kristof Berx
<
kristof.berx@student.kuleuven.be> wrote:
> for(int i=0;i<chain_.getNrOfJoints();++i)
> {
> cout<<"Segment "<<i<<": "<<chain_.getSegment(i).getName()<<" Joint "<<i<<": "<<chain_.getSegment(i).getJoint().getName()<<endl;
> }
I think the number of joints is not necessarily equal to the number of
segments. I use code similar to this:
for (int i=0; i<int(kdl_chain_.segments.size()); ++i)
{
const KDL::Segment& segment = kdl_chain_.segments[i];
const KDL::Joint& joint = segment.getJoint();
if (joint.getType() != KDL::Joint::None)
{
// do something with this joint
}
}
Hope this helps,
- Mrinal