The class modelling a link in the Kinematic Chain. More...
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 wVector & | getAxis () 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 wVector & | getBottom () 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. | |
PhyJoint * | getJoint () const |
Returns the joint associated with this link. | |
unsigned int | getJointDOF () const |
Returns the dof of the joint associated with this link. | |
const wVector & | getRotAxis () 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 wVector & | getRotCenter () 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 wVector & | getTop () 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. | |
WObject * | getWObject () const |
Returns the world object corresponding to this link. | |
const wMatrix & | getWObjectMatrix () const |
Returns the matrix to place the object in the frame of reference of the link. | |
const wMatrix & | getWorldMatrix () 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. | |
KinematicLinkInfo & | operator= (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
-
chain the kinematic chain to which this link belogs (not const because functions to get the current matrix recalculate it every time) linkID the ID of this link in the chain
Definition at line 372 of file phyicubhelpers.cpp.
References KinematicLinkInfo::updateInformationFromiKin().
KinematicLinkInfo | ( | const KinematicLinkInfo & | other | ) |
Copy constructor.
- Parameters
-
other the object to copy
Definition at line 396 of file phyicubhelpers.cpp.
|
virtual |
Destructor.
Definition at line 466 of file phyicubhelpers.cpp.
Member Function Documentation
|
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().
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
Returns the joint associated with this link.
- Returns
- the joint associated with this link
Definition at line 853 of file phyicubhelpers.h.
|
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.
|
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().
|
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.
|
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.
|
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().
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
-
other the 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
-
buddies the list of buddies of this link
Definition at line 474 of file phyicubhelpers.cpp.
Referenced by PhyiCub::PhyiCub().
|
slot |
Sets the desidered link angle.
- Parameters
-
desideredAngle the desidered angle (in radiants)
Definition at line 572 of file phyicubhelpers.cpp.
|
slot |
Sets the desidered velocity.
- Parameters
-
velocity the desidered velocity (in radiants per second)
Definition at line 581 of file phyicubhelpers.cpp.
|
slot |
Sets limits on the iKinLink object.
- Parameters
-
min the minimum allowed value for the angle max the 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
-
joint the joint associated with this link invertedJointAxis if true the joint axis has been inverted during joint creation dof the id of the DOF to connect doConnection if true, also connects the changedPosition signal of the DOF dof of the joint to our setLinkAngle slot with a connection type connType connType the type of connection to use between the setLinkAngle signal of the DOF and our setLinkAngle slot
Definition at line 552 of file phyicubhelpers.cpp.
|
slot |
Sets the new link angle.
- Parameters
-
newAngle the new link angle (in radiants)
Definition at line 563 of file phyicubhelpers.cpp.
Referenced by PhyiCub::configurePosture().
Sets the world object corresponding to this link.
- Parameters
-
wObject the world object corresponding to this link m the 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
-
mtr a 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().
|
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:
- worldsim/include/phyicubhelpers.h
- worldsim/src/phyicubhelpers.cpp