ERC CISST - cisst software

prmTransformationManager Class Reference

#include <prmTransformationManager.h>

Inheritance diagram for prmTransformationManager:

Inheritance graph
[legend]
Collaboration diagram for prmTransformationManager:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class is intended to support computation of relationships between different coordinate systems in a CIS system. The tree consists of nodes (various coordinate systems ) and the edges (static or dynamic transformations between the connected coordinate systems). Transformations between coordinate systems are retrieved using a user provided command.
See also:
mtsCommandRead.
Examples:

setup joints transformation vctFrm3 setupPos; setupPos.Translation() = vct3(10.0, 4.0, 3.0); prmTransformationFixed setupFrame("Setup frame", setupPos);

robot transformation prmTransformationDynamic robotFrame("Robot frame", setupFrame, robot.GetCommandRead("GetTipPosition"));

add a camera defined in world frame vctFrm3 cameraPos; cameraPos.Translation() = vct3(-10.0, 3.4, 5.34); vctRandom(cameraPos.Rotation()); // artificial move! prmTransformationFixed cameraFrame("Camera frame", cameraPos);

Get the position of the camera wrt to the robot std::cout << prmWRTReference(cameraFrame, robotFrame) << std::endl;

Compute the robot motion wrt its base so that the tip moves in the x direction of the camera. vctFrm3 moveWRTCamera; PositionCartesianArg goalArgs;

move.Translation() = vct3(1.0, 0.0, 0.0); vctFrm3 moveWRTRobot = prmWRTReference(cameraFrame, setupFrame) * move; goalArgs.SetGoal(moveWRTRobot); myRobot.MovePositionCart(goalArgs);

Note:
There can only be one transformation manager per application, hence this class is implemented as a singleton.

Definition at line 80 of file prmTransformationManager.h.

Public Types

Static Public Member Functions

Static Public Attributes

Static Protected Member Functions

Static Protected Attributes

Friends


Member Function Documentation

static bool prmTransformationManager::Attach ( const prmTransformationBasePtr attachPoint,
const prmTransformationBasePtr newFrame 
) [static, protected]

Add the frame to the tree in the transformation manager. This method is private and can only be accessed by the "friend" class prmTransformationBase.

Parameters:
attachPoint prmTransformationBasePtr pointer to the new frame
newFrame prmTransformationBasePtr pointer to parent in the tree
Returns:
bool success/failure boolean status.

static bool prmTransformationManager::Detach ( const prmTransformationBasePtr frame  )  [static, protected]

Remove the frame from the tree Internally calls ReplaceReference(frame, theWorld).

Parameters:
frame prmTransformationBase* pointer to the frame to be discarded.
Returns:
bool success/failure code (When do we define status codes?)

static void prmTransformationManager::Clear (  )  [static]

A method to clean up a transformation tree. Deletes all nodes and restores clean state. This should never need to be used as every node should attach or detach itself. It is primarily meant for testing and debugging purposes.

static bool prmTransformationManager::NodeCreatesCycle ( const prmTransformationBasePtr attachPoint,
const prmTransformationBasePtr newFrame 
) [static]

Test if attaching a reference frame at a particular node will introduce a circular dependency. The implementation is a simple depth first search, that returns true if a node is revisited more than once.

Parameters:
attachPoint prmTransformationBasePr new parent
newFrame prmTransformationBasePtr candidate frame
Returns:
bool true if a newFrame node is already present in the tree AND is an ancestor of the attachPoint.

static vctFrm3 prmTransformationManager::WRTReference ( const prmTransformationBasePtr tipFrame,
const prmTransformationBasePtr refFrame 
) [static]

Compute the transformation between two frames (WRT = With Respect To). The computation will use registered get mtsCommandRead methods for the nodes on the path from node refFrame to node tipFrame. The implementation is a breadth first search from refFrame to tipFrame.

Parameters:
tipFrame prmTransformationBasePtr the frame transform to be computed
refFrame prmTransformationBasePtr the reference frame chosen
Returns:
vctFrame3 homogenous transform representing current relationship between tipFrame and refFrame.

Referenced by prmWRTReference(), and prmWRTWorld().

static unsigned int prmTransformationManager::ReplaceReference ( const prmTransformationBasePtr nodePtr,
const prmTransformationBasePtr newReference 
) [static]

Update all frames using a given frame as reference.

May be useful before a call to prmTransformationManager::Detach or its equivalent prmTransformationBase::~prmTransformationBase

Parameters:
currentReference prmTransformationBase* old Reference frame
newReference prmTransformationBase* new Reference frame
Returns:
number of frames modified.

static void prmTransformationManager::ToStreamDot ( std::ostream &  outputStream  )  [static]

Print the tree to a graphviz dot file

If you have graphviz then "dot -Tjpg -o tree.jpg tree.dot" where tree.dot is the output of this function will print a tree representation of the transformation tree.

Parameters:
outputStream std::ostream stream to dump dot file
Returns:
void

static void prmTransformationManager::ToStreamDotHelper ( std::ostream &  outputStream,
prmTransformationBasePtr  parent 
) [static]

Helper function for printing the tree to a graphviz dot file

Returns:
void

static bool prmTransformationManager::FindPath ( const prmTransformationBasePtr target,
const prmTransformationBasePtr reference 
) [static]

Helper function for computing transformations. Traverses the tree and stores the path between target and reference in path

Returns:
bool true if path exists

static bool prmTransformationManager::FindPathConnectedTree ( const prmTransformationBasePtr target,
const prmTransformationBasePtr reference 
) [static]

Helper function for computing transformations. In contrast to above, this assumes a path exists and only merges two traversals from target/reference to tree root

Returns:
bool true if path exists

static prmTransformationBasePtr prmTransformationManager::GetTransformationNodePtr ( const std::string  pName  )  [static]

Helper function for attaching with names

Referenced by prmWRTReference().

static void prmTransformationManager::PathToStreamDot ( std::ostream &  outputStream  )  [static]

Print the path for last reference computation to a graphviz dot file

Returns:
void


Member Data Documentation

NodeListType prmTransformationManager::Path [static, protected]

List of modes on the last transformation computed.

Definition at line 90 of file prmTransformationManager.h.

NodeListType prmTransformationManager::VisitedNodes [static, protected]

Tree traversal helper

Definition at line 92 of file prmTransformationManager.h.

prmTransformationFixed prmTransformationManager::TheWorld [static]

Frame used as reference for all other frames, root of the tree. All other frames are attached/detached by application code.

Definition at line 118 of file prmTransformationManager.h.

Referenced by prmWRTWorld().


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu