Actin  Version 5.5.2
Software for Robotics Simulation and Control
EcManipulatorAttachmentMap Class Reference

Holds a map describing attachment among manipulators. More...

#include <ecManipulatorAttachmentMap.h>

Inheritance diagram for EcManipulatorAttachmentMap:
[legend]
Collaboration diagram for EcManipulatorAttachmentMap:
[legend]

Public Member Functions

 EcManipulatorAttachmentMap ()
 default constructor
 
virtual ~EcManipulatorAttachmentMap ()
 destructor
 
 EcManipulatorAttachmentMap (const EcManipulatorAttachmentMap &orig)
 copy constructor
 
EcManipulatorAttachmentMapoperator= (const EcManipulatorAttachmentMap &orig)
 assignment operator
 
EcBoolean operator== (const EcManipulatorAttachmentMap &orig) const
 equality operator
 
virtual EcBoolean equality (const EcXmlObject *other) const EC_OVERRIDE
 equality - virtual equality to an EcXmlObject pointer
 
virtual EcXmlObjectnewObject () const EC_OVERRIDE
 virtual new that returns an EcXmlObject
 
virtual EcXmlObjectclone () const EC_OVERRIDE
 clone - a virtual constructor to an EcXmlObject pointer
 
virtual void registerComponents () EC_OVERRIDE
 register components with the parent
 
virtual const EcTokentoken () const EC_OVERRIDE
 gets the xml token used for writing out. More...
 
virtual EcBoolean read (EcXmlReader &stream) EC_OVERRIDE
 read this object from an XML stream
 
virtual const EcManipulatorAttachmentNodeVectorbaseNodes () const
 get the nodes for all base manipulators
 
virtual void setBaseNodes (const EcManipulatorAttachmentNodeVector &value)
 set the nodes for all base manipulators
 
virtual EcBoolean attachManipulator (EcU32 depManipIndex, EcU32 baseManipIndex, const EcString &baseLinkId, const EcCoordinateSystemTransformation &offset, const EcString &name=EcString(), EcBoolean sameAttachmentAsFail=EcTrue)
 attach the base link of one manipulator onto a link of another manipulator More...
 
virtual EcBoolean removeManipulatorAttachment (EcU32 depManipIndex)
 
virtual EcBoolean getRecordAttachmentChanges () const
 get whether to record attachment changes
 
virtual void setRecordAttachmentChanges (EcBoolean value)
 set whether to record attachment changes
 
virtual const EcManipulatorAttachmentChangeVectorattachmentChangeVector () const
 
virtual void resetAttachmentChangeVector ()
 reset/clear the attachment changes
 
virtual EcBoolean removeManipulator (EcU32 manipIndex)
 
virtual EcBoolean getDependentManipulatorInfo (EcU32 depManipIndex, EcU32 &baseManipIndex, EcString &baseLinkId, EcCoordinateSystemTransformation &offset) const
 
virtual EcBoolean getDependentManipulatorsAndOffsets (EcU32 baseManipIndex, const EcString &baseLinkId, EcU32Vector &depManipIndices, EcCoordinateSystemTransformationVector &offsets) const
 
virtual EcU32Vector dependentManipulators (EcU32 baseManipIndex) const
 
virtual EcBoolean calculateBaseLocations (EcU32 baseManipIndex, const EcIndividualManipulatorVector &manips, EcManipulatorActiveStateVector &manipActiveStates, EcXmlU32Vector &dependentManipIndices, EcCoordinateSystemTransformationVector &baseLocations) const
 
virtual EcBoolean calculateBaseLocationsAndVelocities (EcU32 baseManipIndex, const EcIndividualManipulatorVector &manips, EcManipulatorActiveStateVector &manipActiveStates, EcXmlU32Vector &dependentManipIndices, EcCoordinateSystemTransformationVector &baseLocations, EcGeneralVelocityVector &baseVelocities) const
 
virtual EcBoolean calculateBaseLocationsAndVelocities (const EcIndividualManipulatorVector &manips, EcManipulatorActiveStateVector &manipActiveStates, EcXmlU32Vector &dependentManipIndices, EcCoordinateSystemTransformationVector &baseLocations, EcGeneralVelocityVector &baseVelocities) const
 
virtual EcU32 baseManipulatorIndex (EcU32 depManipulatorIndex) const
 
virtual void clear ()
 clear this map
 
virtual void shiftManipulatorIndices (EcU32 shiftValue)
 shift all the manipulator indices in the map by a given value. Used when merging two systems
 
virtual EcBoolean deleteManipulatorAndShift (EcU32 manipIndex)
 
virtual EcBoolean mergeWith (const EcManipulatorAttachmentMap &other)
 merge operation
 
virtual void convertFromOldFormat (const EcOldManipulatorAttachmentMap &oldMap)
 convert from EcOldManipulatorAttachmentMap for backward compatibility
 
const EcManipulatorAttachmentChangelastAttachmentChange () const
 get the last attachment change
 
virtual const EcManipulatorAttachmentNodefindBaseNode (EcU32 baseIndex) const
 find the base node
 
virtual EcManipulatorAttachmentNodefindNode (EcU32 manipIndex)
 returns a node with a given manipulator index or null if it doesn't exist – non-const version
 
virtual const EcManipulatorAttachmentNodefindNode (EcU32 manipIndex) const
 returns a node with a given manipulator index or null if it doesn't exist – const version
 
virtual EcBoolean dataChanged (const EcManipulatorAttachmentMap &other) const
 
- Public Member Functions inherited from EcXmlCompoundType
 ECDECLARE_BIGFOUR (EcXmlCompoundType)
 
virtual EcBoolean xmlInit () EC_OVERRIDE
 xmlInitialize
 
virtual EcBoolean readAttributes (EcXmlReader &stream)
 read object attributes from an XML stream
 
virtual EcBoolean readElements (EcXmlReader &stream)
 read object elements from an XML stream
 
virtual EcBoolean write (EcXmlWriter &stream) const EC_OVERRIDE
 write object to an XML stream
 
virtual EcBoolean writeAttributes (EcXmlWriter &stream) const
 write object attributes to an XML stream
 
virtual EcBoolean writeElements (EcXmlWriter &stream) const
 write object elements to an XML stream
 
virtual EcBoolean writeSchema (EcXmlSchema &stream) const EC_OVERRIDE
 write schema
 
virtual EcBoolean writeSchemaAttributes (EcXmlSchema &stream) const
 write schema attributes
 
virtual EcBoolean writeSchemaElements (EcXmlSchema &stream) const
 write schema elements
 
virtual void registerComponent (const EcToken &token, EcXmlObject *obj)
 register a single component More...
 
virtual void registerComponent (EcXmlObject *obj)
 register a single component More...
 
virtual void registerComponentReadOnly (const EcToken &token, EcXmlObject *obj)
 register a single component as read-only More...
 
virtual const EcXmlComponentMapcomponentMap () const
 get a reference to the component map
 
virtual void registerAttributeComponent (const EcToken &AttribToken, EcXmlObject *Obj)
 register a single attribute component More...
 
virtual void registerAttributeComponentReadOnly (const EcToken &AttribToken, EcXmlObject *Obj)
 register a single attribute component read-only More...
 
virtual const EcXmlComponentMapattributeComponentMap ()
 get a reference to the component attribute map
 
virtual const EcXmlSpecialDescriptorMapspecialDescriptorMap ()
 get a reference to the special-descriptor map
 
virtual void registerComponentDescriptor (const EcToken &xmlToken, const EcToken &descriptorToken, const EcString &descriptorString)
 register an XML token-string descriptor More...
 
virtual const EcXmlTokenStringDescriptorMapMaptokenStringDescriptorMap ()
 get a reference to the XML token-string descriptor map
 
virtual EcBoolean hasChildren () const
 return EcTrue if there are children components or EcFalse if an empty element.
 
virtual EcBoolean hasAttributes () const
 return EcTrue if there are attributes in the element.
 
- Public Member Functions inherited from EcXmlObject
 ECDECLARE_BIGFOUR (EcXmlObject)
 
virtual EcBoolean readAttribute (EcXmlReader &stream)
 read this attribute from an XML stream
 
virtual EcBoolean createSchema (const EcString &filename, const EcToken &objectName=EcXml::EcDefaultToken) const
 create schema
 
virtual EcBoolean xmlInitialized () const
 get XML initialized flag. This bit is set on initialization.
 
virtual void setXmlInitialized (EcBoolean val=EcTrue)
 set XML initialized flag. This bit is set on initialization.
 
virtual EcBoolean specified () const
 get specified flag. This bit is set upon reading from an XML file.
 
virtual void setSpecified (EcBoolean val=EcTrue)
 set specified flag. This bit is set upon reading from an XML file.
 
virtual EcBoolean isBasicType () const
 Return true/false for basic type.
 
virtual EcBoolean equalsDefault () const
 tests equality of XML object with default
 

Protected Attributes

EcManipulatorAttachmentNodeVector m_vBaseNodes
 the nodes for all base manipulators
 
EcManipulatorAttachmentChange m_LastAttachmentChange
 last attachment change
 
EcXmlU32 m_UpdateCounter
 
EcManipulatorAttachmentChangeVector m_AttachmentChangeVector
 
EcBoolean m_RecordAttachmentChanges
 flag indicating whether to record attachment changes
 
- Protected Attributes inherited from EcXmlCompoundType
EcXmlComponentMapm_pComponentMap
 
EcXmlComponentMapm_pAttributeComponentMap
 
EcXmlSpecialDescriptorMapm_pSpecialDescriptorMap
 
EcXmlTokenStringDescriptorMapMapm_pComponentMapTokenStringDescriptor
 
- Protected Attributes inherited from EcXmlObject
EcU8 m_State
 the state of the object - eight boolean flags
 

Additional Inherited Members

- Public Types inherited from EcXmlCompoundType
enum  {
  READONLYCOMPONENT = 0,
  READONLYATTRIBUTE
}
 special-descriptor codes More...
 
- Protected Member Functions inherited from EcXmlCompoundType
virtual EcBoolean readValueFromToken (const EcToken &token, EcXmlReader &stream)
 
virtual EcBoolean readValueFromSpecialToken (const EcToken &token, EcXmlReader &stream)
 read value from unregistered token
 
virtual EcBoolean readAttributeFromToken (const EcToken &token, EcXmlReader &stream)
 
virtual EcXmlComponentMapnewComponentMap () const
 allocate a new componentMap
 
virtual EcXmlSpecialDescriptorMapnewSpecialDescriptorMap ()
 allocate a new specialDescriptorsMap
 
virtual EcXmlTokenStringDescriptorMapMapnewTokenStringDescriptorMap ()
 allocate a new tokenStringDescriptorsMap
 
virtual void createComponentMap () const
 create component map
 
virtual void createAttributeComponentMap ()
 create attribute component map
 
virtual void createSpecialDescriptorMap ()
 create special-descriptors map
 
virtual void createTokenStringDescriptorMap ()
 create token-string descriptor map
 
virtual EcBoolean isReadOnlyComponent (const EcToken token) const
 check to see if the token corresponds to a read-only component
 
virtual EcBoolean isReadOnlyAttribute (const EcToken token) const
 check to see if the token corresponds to a read-only attribute
 
virtual EcXmlObjectlibraryAttribute ()
 
- Static Protected Attributes inherited from EcXmlObject
static const EcU8 m_theXmlInitializedBit
 the bit used to describe xml initialization
 
static const EcU8 m_theSpecifiedBit
 the bit used to describe specification
 

Detailed Description

Holds a map describing attachment among manipulators.

Author
Chalongrath Pholsiri This class holds a map describing attachments among manipulators. For example, one can attach a hand manipulator onto an arm manipulator.

Definition at line 23 of file ecManipulatorAttachmentMap.h.

Member Function Documentation

virtual EcBoolean EcManipulatorAttachmentMap::attachManipulator ( EcU32  depManipIndex,
EcU32  baseManipIndex,
const EcString baseLinkId,
const EcCoordinateSystemTransformation offset,
const EcString name = EcString(),
EcBoolean  sameAttachmentAsFail = EcTrue 
)
virtual

attach the base link of one manipulator onto a link of another manipulator

This will instruct the control and simulation that the base link of a 'dependent' manipulator (identified by depManipIndex) is to be attached to a link (identified by baseLinkId) of a 'base' manipulator (identified by baseManipIndex) with an offset. Note that one base manipulator can support multiple dependent manipulators (for example, there can be two arm manipulators attached on a torso manipulator). However, one dependent manipulator CANNOT be attached to multiple base manipulators. If the dependent manipulator is already attached to anoter manipulator, calling attachManipulator will replace the attachment with the new one.

Parameters
[in]depManipIndexThe index of the dependent manipulator.
[in]baseManipIndexThe index of the base manipulator.
[in]baseLinkIdThe identifier of the base link.
[in]offsetThe offset of the primary frame of depLinkId link relative to the primary frame of baseLinkIde link.
[in]nameOptionally, the name of this attachment.
[in]sameAttachmentAsFailIf true, then trying to attach the same attachment will return false. Otherwise, it'll return true.
Returns
True if successful or false otherwise. If it returns true, the attachmentChangeVector will be updated if getRecordAttachmentChanges is true. The failure can take place if (1) depManipIndex and baseManipIndex are the same, (2) Adding the attachment would create a circular chain. For example, manip 1 is attached to 0 that is attached to 2 that is attached back to 1. (3) The same attachment (same depManipIndex, baseManipIndex, baseLinkId, and offset) is already present. The reason that this returns false in this case is to break a potential infinite loop when attachment is set from different places. This in only if sameAttachmentAsFail is set to true.
virtual const EcManipulatorAttachmentChangeVector& EcManipulatorAttachmentMap::attachmentChangeVector ( ) const
virtual

get recording of attachment changes from calls to attachManipulator and removeManipulatorAttachment.

virtual EcU32 EcManipulatorAttachmentMap::baseManipulatorIndex ( EcU32  depManipulatorIndex) const
virtual

get the index of the base manipulator at the top of the chain. If the manipulator identified by depManipulatorIndex is not attached to any manipulator, then it returns the same index (depManipulatorIndex).

virtual EcBoolean EcManipulatorAttachmentMap::calculateBaseLocations ( EcU32  baseManipIndex,
const EcIndividualManipulatorVector manips,
EcManipulatorActiveStateVector manipActiveStates,
EcXmlU32Vector dependentManipIndices,
EcCoordinateSystemTransformationVector baseLocations 
) const
virtual

Calculate the base locations of all the manipulators that are attachend to a given base manipulator. This includes all the manipulators attached in the chain.

Parameters
[in]baseManipIndexThe index of the base manipulator of interest.
[in]manipsThe vector of all manipulators in the system.
[in,out]manipActiveStatesThe manipulator active states of all manipulators.
[out]dependentManipIndicesA vector of indices of all manipulators attached to the base manipulator. The returned vector is empty if there's no manipulator attached to the base manipulator.
[out]baseLocationsA vector of the base locations of all manipulators attached to the base manipulator.
Returns
True if successful or false otherwise. Success if the base manipulator has at least one dependent manipulator, all indices of both base manipulator and dependent manipulators are valid (not exceed the size of manips), and all the base links are valid. If successful, the size of dependentManipIndices and baseLocations will be identical and they can be used to set the base locations in the position states.
virtual EcBoolean EcManipulatorAttachmentMap::calculateBaseLocationsAndVelocities ( EcU32  baseManipIndex,
const EcIndividualManipulatorVector manips,
EcManipulatorActiveStateVector manipActiveStates,
EcXmlU32Vector dependentManipIndices,
EcCoordinateSystemTransformationVector baseLocations,
EcGeneralVelocityVector baseVelocities 
) const
virtual

Calculate the base locations and velocities of all the manipulators that are attachend to a given base manipulator. This includes all the manipulators attached in the chain.

Parameters
[in]manipsThe vector of all manipulators in the system.
[in,out]manipActiveStatesThe manipulator active states of all manipulators.
[out]dependentManipIndicesA vector of indices of all manipulators attached to the base manipulator.
[out]baseLocationsA vector of the base locations of all manipulators attached to the base manipulator.
[out]baseVelocitiesA vector of the base velocities of all manipulators attached to the base manipulator.
virtual EcBoolean EcManipulatorAttachmentMap::calculateBaseLocationsAndVelocities ( const EcIndividualManipulatorVector manips,
EcManipulatorActiveStateVector manipActiveStates,
EcXmlU32Vector dependentManipIndices,
EcCoordinateSystemTransformationVector baseLocations,
EcGeneralVelocityVector baseVelocities 
) const
virtual

Calculate the base locations and velocities of all the manipulators in the map.

Parameters
[in]manipsThe vector of all manipulators in the system.
[in,out]manipActiveStatesThe manipulator active states of all manipulators.
[out]dependentManipIndicesA vector of indices of all manipulators in the map.
[out]baseLocationsA vector of the base locations of all manipulators in the map.
[out]baseVelocitiesA vector of the base velocities of all manipulators in the map.
virtual EcBoolean EcManipulatorAttachmentMap::dataChanged ( const EcManipulatorAttachmentMap other) const
virtual

an inexpensive way to determine whether the data inside this map compared to the other may have changed by comparing the update counters of the two.

Returns
True if the two counters are not the same value (i.e. either this map or the other map may have changed) or false otherwise. Note that even if it returns true, the internal data between the two is not guaranteed to be different.
virtual EcBoolean EcManipulatorAttachmentMap::deleteManipulatorAndShift ( EcU32  manipIndex)
virtual

delete a manipulator: remove all the attachment related to it and shift indices of all the manipulators with index greater than the deleted this is only used for deleting a manipulator from the system

virtual EcU32Vector EcManipulatorAttachmentMap::dependentManipulators ( EcU32  baseManipIndex) const
virtual

Returns the indices of all manipulators attached to a given base manipulator. This includes all the manipulators attached in the chain.

Parameters
[in]baseManipIndexThe index of the base manipulator of interest.
Returns
A vector of indices of all manipulators attached to the base manipulator. The returned vector is empty if there's no manipulator attached to the base manipulator.
virtual EcBoolean EcManipulatorAttachmentMap::getDependentManipulatorInfo ( EcU32  depManipIndex,
EcU32 baseManipIndex,
EcString baseLinkId,
EcCoordinateSystemTransformation offset 
) const
virtual

Get the information on the dependent manipulator.

Parameters
[in]depManipIndexThe index of the dependent manipulator in query.
[out]baseManipIndexThe index of the base manipulator.
[out]baseLinkIdThe identifier of the base link.
[out]offsetThe offset of the primary frame of depLinkId link relative to the primary frame of baseLinkIde link.
Returns
True if the manipulator identified by manipIndex is dependent on another manipulator. False otherwise. Note that if this method returns false, then all the output parameters will not have been set.
virtual EcBoolean EcManipulatorAttachmentMap::getDependentManipulatorsAndOffsets ( EcU32  baseManipIndex,
const EcString baseLinkId,
EcU32Vector depManipIndices,
EcCoordinateSystemTransformationVector offsets 
) const
virtual

Returns the indices and offsets of all manipulators directly attached to a given link. That is, it doesn't include any attachment from below in the chain.

Parameters
[in]baseManipIndexThe index of the manipulator of interest.
[in]baseLinkIdThe label of the link of interest.
[out]depManipIndicesThe indices of all manipulators attached to a given link.
[out]offsetsThe attachment offsets. Same size as depManipIndices.
Returns
True if there's at at least one manipulator attached to the link or false otherwise.
virtual EcBoolean EcManipulatorAttachmentMap::removeManipulator ( EcU32  manipIndex)
virtual

Remove ALL references to manipIndex in the map. Do not use this to simply remove an attachment since this will not update the attachmentChangeVector. Use removeManipulatorAttachment instead. Use this method, say, when a manipulator is deleted from the system.

Parameters
[in]manipIndexThe index of the manipulator.
Returns
True if successful or false if manipIndex doesn't exist in the map.
virtual EcBoolean EcManipulatorAttachmentMap::removeManipulatorAttachment ( EcU32  depManipIndex)
virtual

Remove the manipulator attachment of the dependent manipulator identified by depManipIndex from the map. This, however, preserves attachment to the dependent manipulator, if any.

Parameters
[in]depManipIndexThe index of the dependent manipulator.
Returns
True if successful or false if depManipIndex doesn't exist in the map. If true, the attachmentChangeVector will be udpated if getRecordAttachmentChanges is true.
virtual const EcToken& EcManipulatorAttachmentMap::token ( ) const
virtual

gets the xml token used for writing out.

Implements EcXmlObject.

Member Data Documentation

EcManipulatorAttachmentChangeVector EcManipulatorAttachmentMap::m_AttachmentChangeVector
protected

recording of attachment changes from calls to attachManipulator and removeManipulatorAttachment

Definition at line 349 of file ecManipulatorAttachmentMap.h.

EcXmlU32 EcManipulatorAttachmentMap::m_UpdateCounter
protected

the counter increments every time there's a change in the map Can be used as an efficient way to determine if there's a change between two maps

Definition at line 344 of file ecManipulatorAttachmentMap.h.


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