KinematicLinkInfo Class Reference

The class modelling a link in the Kinematic Chain. More...

Inheritance diagram for KinematicLinkInfo:

Public Slots

void setDesideredPosition (real desideredAngle)
 Sets the desidered link angle.
 
void setDesideredVelocity (real velocity)
 Sets the desidered velocity.
 
void setiKinLinkLimits (real min, real max)
 Sets limits on the iKinLink object.
 
void setLinkAngle (real newAngle)
 Sets the new link angle.
 
void updateLink ()
 Updates the link.
 

Public Member Functions

 KinematicLinkInfo ()
 Constructor.
 
 KinematicLinkInfo (iCub::iKin::iKinLimb *chain, unsigned int linkID)
 Constructor.
 
 KinematicLinkInfo (const KinematicLinkInfo &other)
 Copy constructor.
 
virtual ~KinematicLinkInfo ()
 Destructor.
 
const wVectorgetAxis () const
 Returns the axis of the link in the frame of reference of the kinematic chain.
 
wVector getAxisWorld () const
 Returns the axis of the link in the world frame of reference.
 
const wVectorgetBottom () const
 Returns the center of the frame of reference for the link before this one in the frame of reference of the kinematic chain.
 
wVector getBottomWorld () const
 Returns the center of the frame of reference for the link before this one in the root frame of reference.
 
real getHeight () const
 Returns the distance between m_top and m_bottom.
 
const iCub::iKin::iKinLink & getiKinLink () const
 Returns a reference to the iKinLink object for this link.
 
PhyJointgetJoint () const
 Returns the joint associated with this link.
 
unsigned int getJointDOF () const
 Returns the dof of the joint associated with this link.
 
const wVectorgetRotAxis () const
 Returns the axis around which this link rotates in the link frame of reference.
 
wVector getRotAxisWObject () const
 Returns the axis around which this link rotates in the wObject frame of reference.
 
const wVectorgetRotCenter () const
 Returns the application point for m_rotAxis in the link frame of reference.
 
wVector getRotCenterWObject () const
 Returns the application point for m_rotAxis in the wObject frame of reference.
 
const wVectorgetTop () const
 Returns the center of the frame of reference for this link in the frame of reference of the kinematic chain.
 
wVector getTopWorld () const
 Returns the center of the frame of reference for this link in the frame of reference of the kinematic chain.
 
WObjectgetWObject () const
 Returns the world object corresponding to this link.
 
const wMatrixgetWObjectMatrix () const
 Returns the matrix to place the object in the frame of reference of the link.
 
const wMatrixgetWorldMatrix () const
 Returns the matrix to transform coordinates relative to the kinematic chain root frame to the world root frame.
 
yarp::sig::Matrix getYarpMatrix () const
 Returns the yarp matrix for the link.
 
wMatrix getYarpMatrixAswMatrix () const
 Returns the yarp matrix for the link converted into a wMatrix.
 
KinematicLinkInfooperator= (const KinematicLinkInfo &other)
 Copy operator.
 
void setBuddies (QSet< KinematicLinkInfo * > buddies)
 Sets the list of buddies of this link.
 
void setJoint (PhyJoint *joint, bool invertedJointAxis=true, unsigned int dof=0, bool doConnection=true, Qt::ConnectionType connType=Qt::DirectConnection)
 Sets the joint associated with this link.
 
void setWObject (WObject *wObject, const wMatrix &m=s_identityMatrix)
 Sets the world object corresponding to this link.
 
void setWorldMatrix (const wMatrix *mtr)
 Sets the matrix to transform coordinates relative to the kinematic chain root frame to the world root frame.
 
void updateInformationFromiKin ()
 Updates link information from iKin.
 
void updateMatrixFromiKin ()
 Updates the world object matrix by setting it to the one we get from iKin (in the world frame of reference)
 

Detailed Description

The class modelling a link in the Kinematic Chain.

This wraps an iKinLink, but also contains info about the whole kinematic link to be able to calculate and export stuffs like the position of the beginning of the link, its length, axis and so on. Everything is extracted from kinematic parameters stored in iKin. This also stores a pointer to the corresponding WObject. A link can have one or more buddy links. When one link is updated (i.e. setWObject, setWorldMatrix, updateInformationFromiKin, setJoint or setLinkAngle is called), all buddies are updated (i.e. the same function with the same parameters is called on all of them). If an object A is buddy of B, then also B is buddy of A (this is enforced by the setBuddies function). When you set the list of buddies for one link, all buddies properties are updated with the ones of the link on which the setBuddies function has been called.

Note
The updateMatrixFromiKin function is called on all buddies, but only the objects having the m_isMasterBuddy property set to true effectively change the transformation matrix of the object. This works this way because, even if a link is shared among different kinematic chains, the actual transformation matrix for a shared link can be different on two chains (this happends on the last common link, because the frame of reference is on the subsequent joint and that is different for the two chains).Only the object on which you have called setBuddies and its copies have m_isMasterBuddy set to true. This also means that if you destroy all the objects having m_isMasterBuddy set to true, the object is no longer moved. Moreover all objects having m_isMasterBuddy set to true must refer to the same link (and this should always be the case, as they are copies) and the object transformation matrix should be relative to the matrix of those objects.
To avoid setLinkAngle to be called more than necessary, the joint dof changedPosition signal is only connected to one of the buddies (which then updates all the others). Remember this when connecting a signal to setLinkAngle manually.
A link can be in one buddy group at a time (i.e. all buddies have the same list of buddies, except for themselves)
This only works with hinge joints (and all iCub joints are hinges)
The copy constructor and copy operator of this class do not call parent copy constructor or copy operator on purpose (they cannot be called and we don't want to copy the QObject part)
Joint axis is normally inverted because the child object in the chain is the parent in the physical link. This means that for those few joints for which we have to use a non-inverted axis, we have to invert all angles and angular velocities

Definition at line 515 of file phyicubhelpers.h.

Constructor & Destructor Documentation

Constructor.

This builds an invalid chain. This is here just to be able to use this class in containers such as QVector

Note
Use of classes created with this constructror will probably lead to a crash (we have a NULL chain and that is not supported)

Definition at line 349 of file phyicubhelpers.cpp.

KinematicLinkInfo ( iCub::iKin::iKinLimb *  chain,
unsigned int  linkID 
)

Constructor.

This also initializes all values from the kinematic link, so for values to be valid, the link should be in a valid configuration (otherwise you can always call updateInformationFromiKin() later)

Parameters
chainthe kinematic chain to which this link belogs (not const because functions to get the current matrix recalculate it every time)
linkIDthe ID of this link in the chain

Definition at line 372 of file phyicubhelpers.cpp.

References KinematicLinkInfo::updateInformationFromiKin().

Copy constructor.

Parameters
otherthe object to copy

Definition at line 396 of file phyicubhelpers.cpp.

~KinematicLinkInfo ( )
virtual

Destructor.

Definition at line 466 of file phyicubhelpers.cpp.

Member Function Documentation

const wVector& getAxis ( ) const
inline

Returns the axis of the link in the frame of reference of the kinematic chain.

This is the vector from the center of the frame of reference for link (m_linkID-1) to this link

Returns
the axis of the link

Definition at line 612 of file phyicubhelpers.h.

Referenced by PhyiCub::PhyiCub().

wVector getAxisWorld ( ) const
inline

Returns the axis of the link in the world frame of reference.

This is the vector from the center of the frame of reference for link (m_linkID-1) to this link

Returns
the axis of the link

Definition at line 625 of file phyicubhelpers.h.

const wVector& getBottom ( ) const
inline

Returns the center of the frame of reference for the link before this one in the frame of reference of the kinematic chain.

This is called bottom because if the link is represented as a cylinder, this is the center of the bottom base of the cylinder

Returns
the center of the frame of reference for the link before this one

Definition at line 641 of file phyicubhelpers.h.

wVector getBottomWorld ( ) const
inline

Returns the center of the frame of reference for the link before this one in the root frame of reference.

This is called bottom because if the link is represented as a cylinder, this is the center of the bottom base of the cylinder

Returns
the center of the frame of reference for the link before this one

Definition at line 656 of file phyicubhelpers.h.

real getHeight ( ) const
inline

Returns the distance between m_top and m_bottom.

This is called height because if the link is represented as a cylinder, this is the height of the cylinder

Returns
the distance between m_top and m_bottom

Definition at line 694 of file phyicubhelpers.h.

const iCub::iKin::iKinLink& getiKinLink ( ) const
inline

Returns a reference to the iKinLink object for this link.

Returns
a reference to the iKinLink object for this link

Definition at line 812 of file phyicubhelpers.h.

PhyJoint* getJoint ( ) const
inline

Returns the joint associated with this link.

Returns
the joint associated with this link

Definition at line 853 of file phyicubhelpers.h.

unsigned int getJointDOF ( ) const
inline

Returns the dof of the joint associated with this link.

Returns
the dof of the joint associated with this link

Definition at line 863 of file phyicubhelpers.h.

const wVector& getRotAxis ( ) const
inline

Returns the axis around which this link rotates in the link frame of reference.

Returns
the axis around which this link rotates in the link frame of reference

Definition at line 706 of file phyicubhelpers.h.

Referenced by PhyiCub::PhyiCub().

wVector getRotAxisWObject ( ) const
inline

Returns the axis around which this link rotates in the wObject frame of reference.

Returns
the axis around which this link rotates in the wObject frame of reference

Definition at line 718 of file phyicubhelpers.h.

const wVector& getRotCenter ( ) const
inline

Returns the application point for m_rotAxis in the link frame of reference.

This link rotates around an axis oriented like m_rotAxis passing through the point m_rotCenter

Returns
the application point for m_rotAxis in the link frame of reference

Definition at line 732 of file phyicubhelpers.h.

wVector getRotCenterWObject ( ) const
inline

Returns the application point for m_rotAxis in the wObject frame of reference.

This link rotates around an axis oriented like m_rotAxis passing through the point m_rotCenter

Returns
the application point for m_rotAxis in the wObject frame of reference

Definition at line 746 of file phyicubhelpers.h.

Referenced by PhyiCub::PhyiCub().

const wVector& getTop ( ) const
inline

Returns the center of the frame of reference for this link in the frame of reference of the kinematic chain.

This is called top because if the link is represented as a cylinder, this is the center of the top base of the cylinder

Returns
the center of the frame of reference for this link

Definition at line 669 of file phyicubhelpers.h.

wVector getTopWorld ( ) const
inline

Returns the center of the frame of reference for this link in the frame of reference of the kinematic chain.

This is called top because if the link is represented as a cylinder, this is the center of the top base of the cylinder

Returns
the center of the frame of reference for this link

Definition at line 682 of file phyicubhelpers.h.

WObject* getWObject ( ) const
inline

Returns the world object corresponding to this link.

Returns
the world object corresponding to this link

Definition at line 587 of file phyicubhelpers.h.

const wMatrix& getWObjectMatrix ( ) const
inline

Returns the matrix to place the object in the frame of reference of the link.

Returns
the matrix to place the object in the frame of reference of the link

Definition at line 599 of file phyicubhelpers.h.

const wMatrix& getWorldMatrix ( ) const
inline

Returns the matrix to transform coordinates relative to the kinematic chain root frame to the world root frame.

See setWorldMatrix() for an explanation

Returns
the matrix to transform coordinates relative to the kinematic chain root frame to the world root frame

Definition at line 774 of file phyicubhelpers.h.

yarp::sig::Matrix getYarpMatrix ( ) const
inline

Returns the yarp matrix for the link.

The matrix is obtained directly through iKin, so it is relative to the root frame of the kinematic chain (i.e. the root frame of the iCub)

Definition at line 786 of file phyicubhelpers.h.

wMatrix getYarpMatrixAswMatrix ( ) const
inline

Returns the yarp matrix for the link converted into a wMatrix.

The matrix is obtained directly through iKin, so it is relative to the root frame of the kinematic chain (i.e. the root frame of the iCub)

Definition at line 799 of file phyicubhelpers.h.

Referenced by PhyiCub::PhyiCub().

KinematicLinkInfo & operator= ( const KinematicLinkInfo other)

Copy operator.

Parameters
otherthe object to copy

Definition at line 427 of file phyicubhelpers.cpp.

void setBuddies ( QSet< KinematicLinkInfo * >  buddies)

Sets the list of buddies of this link.

See class description for more information. This function also calls setBuddies of buddies

Parameters
buddiesthe list of buddies of this link

Definition at line 474 of file phyicubhelpers.cpp.

Referenced by PhyiCub::PhyiCub().

void setDesideredPosition ( real  desideredAngle)
slot

Sets the desidered link angle.

Parameters
desideredAnglethe desidered angle (in radiants)

Definition at line 572 of file phyicubhelpers.cpp.

void setDesideredVelocity ( real  velocity)
slot

Sets the desidered velocity.

Parameters
velocitythe desidered velocity (in radiants per second)

Definition at line 581 of file phyicubhelpers.cpp.

void setiKinLinkLimits ( real  min,
real  max 
)
slot

Sets limits on the iKinLink object.

Parameters
minthe minimum allowed value for the angle
maxthe maximum allowed value for the angle

Definition at line 590 of file phyicubhelpers.cpp.

Referenced by PhyiCub::PhyiCub().

void setJoint ( PhyJoint joint,
bool  invertedJointAxis = true,
unsigned int  dof = 0,
bool  doConnection = true,
Qt::ConnectionType  connType = Qt::DirectConnection 
)

Sets the joint associated with this link.

Parameters
jointthe joint associated with this link
invertedJointAxisif true the joint axis has been inverted during joint creation
dofthe id of the DOF to connect
doConnectionif true, also connects the changedPosition signal of the DOF dof of the joint to our setLinkAngle slot with a connection type connType
connTypethe type of connection to use between the setLinkAngle signal of the DOF and our setLinkAngle slot

Definition at line 552 of file phyicubhelpers.cpp.

void setLinkAngle ( real  newAngle)
slot

Sets the new link angle.

Parameters
newAnglethe new link angle (in radiants)

Definition at line 563 of file phyicubhelpers.cpp.

Referenced by PhyiCub::configurePosture().

void setWObject ( WObject wObject,
const wMatrix m = s_identityMatrix 
)

Sets the world object corresponding to this link.

Parameters
wObjectthe world object corresponding to this link
mthe matrix to place the object in the frame of reference of the link

Definition at line 510 of file phyicubhelpers.cpp.

References KinematicLinkInfo::updateMatrixFromiKin().

Referenced by PhyiCub::PhyiCub().

void setWorldMatrix ( const wMatrix mtr)

Sets the matrix to transform coordinates relative to the kinematic chain root frame to the world root frame.

Here we keep a pointer to the matrix, so that the same matrix can be shared among different (all) chain links. A change to that matrix externally is enough to have all *World methods to return objects in the world frame of reference. Note that this is not the H0 of the chain (which is never changed).

Parameters
mtra pointer to the new world matrix (if NULL we use an identity matrix)

Definition at line 522 of file phyicubhelpers.cpp.

References KinematicLinkInfo::updateMatrixFromiKin().

Referenced by KinematicLimb< iCub::iKin::iCubArm >::setWorldMatrix().

void updateInformationFromiKin ( )

Updates link information from iKin.

This only updates the information about the link (top, bottom, height, axis), it doesn't touch the WObject matrix.

Definition at line 534 of file phyicubhelpers.cpp.

Referenced by KinematicLinkInfo::KinematicLinkInfo().

void updateLink ( )
slot

Updates the link.

Call this after setDesideredPosition or setDesideredVelocity to effectively change the angle

Definition at line 599 of file phyicubhelpers.cpp.

void updateMatrixFromiKin ( )

Updates the world object matrix by setting it to the one we get from iKin (in the world frame of reference)

Definition at line 543 of file phyicubhelpers.cpp.

Referenced by KinematicLinkInfo::setWObject(), and KinematicLinkInfo::setWorldMatrix().


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