KDL 1.5.1
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KDL::Tree Class Reference

This class encapsulates a tree kinematic interconnection structure. More...

#include <src/tree.hpp>

Collaboration diagram for KDL::Tree:
Collaboration graph
[legend]

Public Member Functions

 Tree (const std::string &root_name="root")
 The constructor of a tree, a new tree is always empty.
 
 Tree (const Tree &in)
 
Treeoperator= (const Tree &arg)
 
bool addSegment (const Segment &segment, const std::string &hook_name)
 Adds a new segment to the end of the segment with hook_name as segment_name.
 
bool addChain (const Chain &chain, const std::string &hook_name)
 Adds a complete chain to the end of the segment with hook_name as segment_name.
 
bool addTree (const Tree &tree, const std::string &hook_name)
 Adds a complete tree to the end of the segment with hookname as segment_name.
 
unsigned int getNrOfJoints () const
 Request the total number of joints in the tree.
 
unsigned int getNrOfSegments () const
 Request the total number of segments in the tree.
 
SegmentMap::const_iterator getSegment (const std::string &segment_name) const
 Request the segment of the tree with name segment_name.
 
SegmentMap::const_iterator getRootSegment () const
 Request the root segment of the tree.
 
bool getChain (const std::string &chain_root, const std::string &chain_tip, Chain &chain) const
 Request the chain of the tree between chain_root and chain_tip.
 
bool getSubTree (const std::string &segment_name, Tree &tree) const
 Extract a tree having segment_name as root.
 
const SegmentMapgetSegments () const
 
virtual ~Tree ()
 

Private Member Functions

bool addTreeRecursive (SegmentMap::const_iterator root, const std::string &hook_name)
 

Private Attributes

SegmentMap segments
 
unsigned int nrOfJoints
 
unsigned int nrOfSegments
 
std::string root_name
 

Detailed Description

This class encapsulates a tree kinematic interconnection structure.

It is built out of segments.

Constructor & Destructor Documentation

◆ Tree() [1/2]

KDL::Tree::Tree ( const std::string & root_name = "root")
explicit

The constructor of a tree, a new tree is always empty.

References KDL::TreeElement::Root(), root_name, and segments.

Referenced by getSubTree().

◆ Tree() [2/2]

KDL::Tree::Tree ( const Tree & in)

◆ ~Tree()

virtual KDL::Tree::~Tree ( )
inlinevirtual

Member Function Documentation

◆ addChain()

bool KDL::Tree::addChain ( const Chain & chain,
const std::string & hook_name )

Adds a complete chain to the end of the segment with hook_name as segment_name.

Parameters
hook_namename of the segment to connect the chain with.
Returns
false if hook_name could not be found.

References addSegment(), KDL::Segment::getName(), KDL::Chain::getNrOfSegments(), and KDL::Chain::getSegment().

◆ addSegment()

bool KDL::Tree::addSegment ( const Segment & segment,
const std::string & hook_name )

Adds a new segment to the end of the segment with hook_name as segment_name.

Parameters
segmentnew segment to add
hook_namename of the segment to connect this segment with.
Returns
false if hook_name could not be found.

References KDL::Joint::Fixed, KDL::Segment::getJoint(), KDL::Segment::getName(), GetTreeElementChildren, KDL::Joint::getType(), nrOfJoints, nrOfSegments, and segments.

Referenced by addChain(), and addTreeRecursive().

◆ addTree()

bool KDL::Tree::addTree ( const Tree & tree,
const std::string & hook_name )

Adds a complete tree to the end of the segment with hookname as segment_name.

Parameters
treeTree to add
hook_namename of the segment to connect the tree with
Returns
false if hook_name could not be found

References addTreeRecursive(), and getRootSegment().

Referenced by operator=(), and Tree().

◆ addTreeRecursive()

bool KDL::Tree::addTreeRecursive ( SegmentMap::const_iterator root,
const std::string & hook_name )
private

◆ getChain()

bool KDL::Tree::getChain ( const std::string & chain_root,
const std::string & chain_tip,
Chain & chain ) const

Request the chain of the tree between chain_root and chain_tip.

The chain_root and chain_tip can be in different branches of the tree, the chain_root can be an ancestor of chain_tip, and chain_tip can be an ancestor of chain_root.

Parameters
chain_rootthe name of the root segment of the chain
chain_tipthe name of the tip segment of the chain
chainthe resulting chain
Returns
success or failure

References KDL::Chain::addSegment(), KDL::Segment::getJoint(), KDL::Joint::getName(), getSegment(), GetTreeElementParent, GetTreeElementSegment, KDL::Joint::getType(), KDL::Frame::Inverse(), KDL::Joint::JointAxis(), KDL::Joint::JointOrigin(), KDL::Frame::M, KDL::Segment::pose(), root_name, KDL::Joint::RotAxis, KDL::Joint::RotX, KDL::Joint::RotY, KDL::Joint::RotZ, segments, KDL::Joint::TransAxis, KDL::Joint::TransX, KDL::Joint::TransY, and KDL::Joint::TransZ.

◆ getNrOfJoints()

unsigned int KDL::Tree::getNrOfJoints ( ) const
inline

Request the total number of joints in the tree.


Important: It is not the same as the total number of segments since a segment does not need to have a joint.

Returns
total nr of joints

References nrOfJoints.

Referenced by KDL::TreeIdSolver_RNE::CartToJnt(), KDL::TreeIkSolverVel_wdls::CartToJnt(), KDL::TreeFkSolverPos_recursive::JntToCart(), KDL::TreeJntToJacSolver::JntToJac(), KDL::TreeIkSolverVel_wdls::TreeIkSolverVel_wdls(), and KDL::TreeIdSolver_RNE::updateInternalDataStructures().

◆ getNrOfSegments()

unsigned int KDL::Tree::getNrOfSegments ( ) const
inline

Request the total number of segments in the tree.

Returns
total number of segments

References nrOfSegments.

Referenced by KDL::TreeIdSolver_RNE::CartToJnt(), and KDL::TreeIdSolver_RNE::updateInternalDataStructures().

◆ getRootSegment()

SegmentMap::const_iterator KDL::Tree::getRootSegment ( ) const
inline

Request the root segment of the tree.

Returns
constant iterator pointing to the root segment

References root_name, and segments.

Referenced by addTree(), KDL::TreeIdSolver_RNE::CartToJnt(), KDL::TreeJntToJacSolver::JntToJac(), KDL::operator<<(), KDL::TreeFkSolverPos_recursive::recursiveFk(), KDL::TreeIdSolver_RNE::rne_step(), and KDL::tree2str().

◆ getSegment()

SegmentMap::const_iterator KDL::Tree::getSegment ( const std::string & segment_name) const
inline

Request the segment of the tree with name segment_name.

Parameters
segment_namethe name of the requested segment
Returns
constant iterator pointing to the requested segment

References segments.

Referenced by getChain(), and KDL::TreeFkSolverPos_recursive::JntToCart().

◆ getSegments()

const SegmentMap & KDL::Tree::getSegments ( ) const
inline

◆ getSubTree()

bool KDL::Tree::getSubTree ( const std::string & segment_name,
Tree & tree ) const

Extract a tree having segment_name as root.

Only child segments of segment_name are added to the new tree.

Parameters
segment_namethe name of the segment to be used as root of the new tree
treethe resulting sub-tree
Returns
success or failure

References addTreeRecursive(), segments, and Tree().

◆ operator=()

Tree & KDL::Tree::operator= ( const Tree & arg)

Member Data Documentation

◆ nrOfJoints

unsigned int KDL::Tree::nrOfJoints
private

◆ nrOfSegments

unsigned int KDL::Tree::nrOfSegments
private

◆ root_name

std::string KDL::Tree::root_name
private

◆ segments

SegmentMap KDL::Tree::segments
private

The documentation for this class was generated from the following files: