MIRA
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
FrameworkTransformer Class Reference

#include <fw/FrameworkTransformer.h>

Inheritance diagram for FrameworkTransformer:
Inheritance graph
[legend]

Public Types

typedef FrameworkTransformerNode Node
 The type of a transformation node. More...
 
typedef NodeNodePtr
 The type of a pointer of the actual transformation node. More...
 
typedef TransformerBase::AbstractNodePtr AbstractNodePtr
 The type of a pointer to the AbstractTransformerNode base class. More...
 

Public Member Functions

 FrameworkTransformer (Authority &authority)
 
 ~FrameworkTransformer ()
 
void addLink (const std::string &childID, const std::string &parentID)
 Add a transformation link between the given child and parent. More...
 
void addLink (const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type)
 Add a transformation link between the given child and parent, specifying the type of the transformation. More...
 
template<typename Transform >
void publishTransform (const std::string &nodeID, const Transform &transform, const Time &time=Time::now())
 Publish a transformation for a given node. More...
 
template<typename Transform , typename Filter = NearestNeighborInterpolator>
void publishTransformIndirect (const std::string &nodeID, const std::string &targetID, const std::string &sourceID, const Transform &transform, const Time &time=Time::now(), Filter &&filter=NearestNeighborInterpolator())
 Publish a transformation (nodeID) indirect by specifying a direct transform between two nodes (sourceID and targetID). More...
 
void storeTransformTree (const Path &filename)
 Stores currently known transform tree in a XML config file. More...
 
TransformDesc prepareTransform (NodePtr target, NodePtr source)
 Prepares the computation of a transformation by computing the path between the target and source node. More...
 
TransformDesc prepareTransform (NodePtr target, NodePtr source, NodePtr fixed)
 Prepares the computation of a transformation by computing the path between the 'target' and 'source' node via the 'fixed' node, i.e. More...
 
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime, Filter &&filter)
 Computes and returns a certain transformation that is specified via the TransformDesc. More...
 
Transform getTransform (const TransformDesc &desc, const Time &targetTime, const Time &sourceTime)
 same as above, but using NearestNeighborInterpolator as filter. More...
 
Transform getTransform (const TransformDesc &desc, const Time &time, Filter &&filter)
 same as above, but with the same time for source and target transform. More...
 
Transform getTransform (const TransformDesc &desc, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter. More...
 
Transform getTransform (NodePtr target, NodePtr source, const Time &time, Filter &&filter)
 Computes and returns a certain transformation between the specified target and source node. More...
 
Transform getTransform (NodePtr target, NodePtr source, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter More...
 
Transform getTransform (NodePtr target, const Time &targetTime, NodePtr source, const Time &sourceTime, NodePtr fixed, Filter &&filter)
 Computes and returns a certain transformation between the specified target and source node via the 'fixed' node, i.e. More...
 
Transform getTransform (NodePtr target, const Time &targetTime, NodePtr source, const Time &sourceTime, NodePtr fixed)
 same as above, but using NearestNeighborInterpolator as filter More...
 
Transform inferTransform (NodePtr node, NodePtr target, NodePtr source, const Transform &transform, const Time &time, Filter &&filter)
 Infers a transform by specifying a direct transform between two nodes, which are connected indirectly over the transformation, that shall be infered. More...
 
Transform inferTransform (NodePtr node, NodePtr target, NodePtr source, const Transform &transform, const Time &time)
 same as above, but using NearestNeighborInterpolator as filter More...
 
NodePtr getNode (const std::string &nodeID)
 Returns a pointer to the node with the given ID or nullptr if it does not exist. More...
 
bool addLink (AbstractNodePtr child, AbstractNodePtr parent)
 Adds a link between the specified child and its parent. More...
 
void removeLink (AbstractNodePtr child, AbstractNodePtr parent)
 Removes an existing link between the specified child node and the given parent node. More...
 
std::list< AbstractNodePtrgetNodes ()
 Returns all nodes that are known by this transformer. More...
 
std::list< std::pair< AbstractNodePtr, AbstractNodePtr > > getLinks ()
 Returns all links (as parent,child-pairs) that are known by this transformer. More...
 
const std::list< AbstractNodePtrgetRootNodes ()
 Returns a list of all nodes, that have no ancestor, e.g. More...
 
void getTransformChain (AbstractNodePtr target, AbstractNodePtr source, Chain &oChain)
 
bool isTransformAvailable (AbstractNodePtr target, AbstractNodePtr source)
 Checks if a transformation between 'target' and 'source' node is available: More...
 
void reflect (Reflector &r)
 

Static Public Attributes

static const int MAX_TREE_DEPTH = 1000
 The max. More...
 

Protected Types

typedef std::map< std::string, AbstractNodePtrIDToNodeMap
 

Protected Member Functions

void registerInterface (const std::string &interface, const std::string &otherTransformer)
 
bool createLink (const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type)
 
void notifyTransformerOfLink (const std::string &otherTransformer, const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type)
 
void notifyTransformerOfLink (const std::string &otherTransformer, bool implementsLinkType, const std::string &childID, const std::string &parentID, FrameworkTransformerNode::Type type)
 
Transform getTransform (const Chain &chain, const Time &time, Filter &&filter)
 Computes the resulting transform by applying all transforms according to the specified transform chain. More...
 
void addNode (AbstractNodePtr node)
 An exception that is thrown when errors related to transformations occur. More...
 

Static Protected Member Functions

static NodePtr castNode (AbstractNodePtr node)
 Casts an abstract node pointer to the actual used Node. This is safe. More...
 

Protected Attributes

IDToNodeMap mNodes
 maps from ids to nodes that were added to us More...
 

Friends

class IFrameworkTransformer< FrameworkTransformer >
 

Member Typedef Documentation

◆ Node

typedef FrameworkTransformerNode Node
inherited

The type of a transformation node.

◆ NodePtr

typedef Node* NodePtr
inherited

The type of a pointer of the actual transformation node.

◆ AbstractNodePtr

The type of a pointer to the AbstractTransformerNode base class.

◆ IDToNodeMap

typedef std::map<std::string, AbstractNodePtr> IDToNodeMap
protectedinherited

Constructor & Destructor Documentation

◆ FrameworkTransformer()

FrameworkTransformer ( Authority authority)

◆ ~FrameworkTransformer()

Member Function Documentation

◆ addLink() [1/3]

void addLink ( const std::string &  childID,
const std::string &  parentID 
)

Add a transformation link between the given child and parent.

Creates child and/or parent if not existing, unlinks an existing different parent if necessary. The type is not specified. This method exists for backward compatibility.

Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent

◆ addLink() [2/3]

void addLink ( const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
)

Add a transformation link between the given child and parent, specifying the type of the transformation.

Creates child and/or parent if not existing, unlinks an existing different parent if necessary.

Parameters
[in]childIDThe frame id of the child
[in]parentIDThe frame id of the parent
[in]typeLink type fixed/moving
Note
: If this method is called for a specific childID concurrently with different parentID and/or type, the resulting link and type are unspecified, may even result in parentID from one call and type from other call. However, an application non-consistently adding transformation links is not considered well-formed.

◆ publishTransform()

void publishTransform ( const std::string &  nodeID,
const Transform &  transform,
const Time time = Time::now() 
)
inline

Publish a transformation for a given node.

Parameters
[in]nodeIDThe id of the node
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation

◆ publishTransformIndirect()

void publishTransformIndirect ( const std::string &  nodeID,
const std::string &  targetID,
const std::string &  sourceID,
const Transform &  transform,
const Time time = Time::now(),
Filter &&  filter = NearestNeighborInterpolator() 
)
inline

Publish a transformation (nodeID) indirect by specifying a direct transform between two nodes (sourceID and targetID).

These two nodes are connected indirectly over the transformation (nodeID) This is, the transformation (nodeID) is inferred. In the case you know the direct transform between 'targetID' and 'sourceID' you can use this method to publish the desired transform on the link 'nodeID' at the specified 'time' and using the specified 'filter' for interpolation.

Exceptions
XRuntimeif either the frame, target or source node does not exist
Parameters
[in]nodeIDThe id of the frame to publish indirectly
[in]targetIDThe frame id of the target node
[in]sourceIDThe frame id of the source node
[in]transformEither a 2d or 3d transformation
[in]timeThe time of the transformation
[in]filterThe filter used to interpolate between the transforms

◆ storeTransformTree()

void storeTransformTree ( const Path filename)

Stores currently known transform tree in a XML config file.

◆ registerInterface()

void registerInterface ( const std::string &  interface,
const std::string &  otherTransformer 
)
protected

◆ createLink()

bool createLink ( const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
)
protected

◆ notifyTransformerOfLink() [1/2]

void notifyTransformerOfLink ( const std::string &  otherTransformer,
const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
)
protected

◆ notifyTransformerOfLink() [2/2]

void notifyTransformerOfLink ( const std::string &  otherTransformer,
bool  implementsLinkType,
const std::string &  childID,
const std::string &  parentID,
FrameworkTransformerNode::Type  type 
)
protected

◆ prepareTransform() [1/2]

TransformDesc prepareTransform ( NodePtr  target,
NodePtr  source 
)
inlineinherited

Prepares the computation of a transformation by computing the path between the target and source node.

The returned TransformDesc can be used in a call to the getTransform() method.

◆ prepareTransform() [2/2]

TransformDesc prepareTransform ( NodePtr  target,
NodePtr  source,
NodePtr  fixed 
)
inlineinherited

Prepares the computation of a transformation by computing the path between the 'target' and 'source' node via the 'fixed' node, i.e.

target->fixed->source. The returned TransformDesc can be used in a call to the getTransform() method.

◆ getTransform() [1/9]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime,
Filter &&  filter 
)
inlineinherited

Computes and returns a certain transformation that is specified via the TransformDesc.

Moreover, the timestamps of the transformations is taken into account, therefore the timestamps of the target and source transforms must be specified. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [2/9]

Transform getTransform ( const TransformDesc desc,
const Time targetTime,
const Time sourceTime 
)
inlineinherited

same as above, but using NearestNeighborInterpolator as filter.

◆ getTransform() [3/9]

Transform getTransform ( const TransformDesc desc,
const Time time,
Filter &&  filter 
)
inlineinherited

same as above, but with the same time for source and target transform.

◆ getTransform() [4/9]

Transform getTransform ( const TransformDesc desc,
const Time time 
)
inlineinherited

same as above, but using NearestNeighborInterpolator as filter.

◆ getTransform() [5/9]

Transform getTransform ( NodePtr  target,
NodePtr  source,
const Time time,
Filter &&  filter 
)
inlineinherited

Computes and returns a certain transformation between the specified target and source node.

Moreover, the timestamps of the transformations is taken into account. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [6/9]

Transform getTransform ( NodePtr  target,
NodePtr  source,
const Time time 
)
inlineinherited

same as above, but using NearestNeighborInterpolator as filter

◆ getTransform() [7/9]

Transform getTransform ( NodePtr  target,
const Time targetTime,
NodePtr  source,
const Time sourceTime,
NodePtr  fixed,
Filter &&  filter 
)
inlineinherited

Computes and returns a certain transformation between the specified target and source node via the 'fixed' node, i.e.

target->fixed->source. Moreover, the timestamps of the transformations is taken into account, therefore the timestamps of the target and source transforms must be specified. Additionally, a filter can be specified that can be used to interpolate or filter the transforms according to the specified timestamps.

◆ getTransform() [8/9]

Transform getTransform ( NodePtr  target,
const Time targetTime,
NodePtr  source,
const Time sourceTime,
NodePtr  fixed 
)
inlineinherited

same as above, but using NearestNeighborInterpolator as filter

◆ getTransform() [9/9]

Transform getTransform ( const Chain chain,
const Time time,
Filter &&  filter 
)
inlineprotectedinherited

Computes the resulting transform by applying all transforms according to the specified transform chain.

◆ inferTransform() [1/2]

Transform inferTransform ( NodePtr  node,
NodePtr  target,
NodePtr  source,
const Transform &  transform,
const Time time,
Filter &&  filter 
)
inlineinherited

Infers a transform by specifying a direct transform between two nodes, which are connected indirectly over the transformation, that shall be infered.

Imagine the following example, were the transformation node 'p' is directly connected to the transformation node 'node'. Additionally, both nodes are connected via certain paths with the nodes 'source' and 'target', respectively:

  p ---- x ---- source
  |
  |
  |
  v
  node --- y --- target

Now imagine, you want to compute the transformation between 'p' and 'node', but all you know is the direct transformation between the nodes 'source' and 'target' which are however not directly connected:

  p ---- x ---- source
  |                .
  | ???            . this 'transform'
  |                . is known
  v                v
  node --- y --- target

In this case you can use this method. It computes and returns the desired transform on the link towards 'node' given the 'transform' between the nodes 'target' and 'source' at the specified 'time' and using the specified 'filter' for interpolation.

◆ inferTransform() [2/2]

Transform inferTransform ( NodePtr  node,
NodePtr  target,
NodePtr  source,
const Transform &  transform,
const Time time 
)
inlineinherited

same as above, but using NearestNeighborInterpolator as filter

◆ getNode()

NodePtr getNode ( const std::string &  nodeID)
inlineinherited

Returns a pointer to the node with the given ID or nullptr if it does not exist.

◆ castNode()

static NodePtr castNode ( AbstractNodePtr  node)
inlinestaticprotectedinherited

Casts an abstract node pointer to the actual used Node. This is safe.

◆ addLink() [3/3]

bool addLink ( AbstractNodePtr  child,
AbstractNodePtr  parent 
)
inherited

Adds a link between the specified child and its parent.

Both nodes must have been added to this Transformer. If both nodes are connected to each other already this method has no effect. If the child was connected to another parent before it is unlinked from its current parent first and then linked to the new one. Returns true, if the link was new. If the link was already known, false is returned.

◆ removeLink()

void removeLink ( AbstractNodePtr  child,
AbstractNodePtr  parent 
)
inherited

Removes an existing link between the specified child node and the given parent node.

If both nodes are not connected, this method does nothing.

◆ getNodes()

std::list<AbstractNodePtr> getNodes ( )
inherited

Returns all nodes that are known by this transformer.

◆ getLinks()

std::list<std::pair<AbstractNodePtr, AbstractNodePtr> > getLinks ( )
inherited

Returns all links (as parent,child-pairs) that are known by this transformer.

◆ getRootNodes()

const std::list<AbstractNodePtr> getRootNodes ( )
inherited

Returns a list of all nodes, that have no ancestor, e.g.

that are root nodes of a transform tree.

◆ getTransformChain()

void getTransformChain ( AbstractNodePtr  target,
AbstractNodePtr  source,
Chain oChain 
)
inherited
Exceptions
ThrowsXTransform, if source and target are not connected or if there is a loop in the transform tree.

◆ isTransformAvailable()

bool isTransformAvailable ( AbstractNodePtr  target,
AbstractNodePtr  source 
)
inherited

Checks if a transformation between 'target' and 'source' node is available:

  • Is a path between 'target' and 'source' available
  • Does every Node along the path contain data

◆ addNode()

void addNode ( AbstractNodePtr  node)
protectedinherited

An exception that is thrown when errors related to transformations occur.

Adds the specified node to the internal node map

◆ reflect()

void reflect ( Reflector &  r)
inlineinherited

Friends And Related Function Documentation

◆ IFrameworkTransformer< FrameworkTransformer >

Member Data Documentation

◆ MAX_TREE_DEPTH

const int MAX_TREE_DEPTH = 1000
staticinherited

The max.

allowed number of levels within a transformation tree. It is used by collectNodesUpwardsToRoot() that is applied to find the "lowest common ancestor" in getTransformChain() to detect loops within the transformation tree.

◆ mNodes

IDToNodeMap mNodes
protectedinherited

maps from ids to nodes that were added to us


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