Classes | |
class | SearchNode< V > |
class | TFCallback |
Public Member Functions | |
StampedTransform | lookupTransform (String targetFrameID, String sourceFrameID, Time time) |
StampedTransform | lookupTransform (String targetID, Time targetTime, String sourceID, Time sourceTime, String fixedID) |
void | transformPoint (String targetFrameID, Stamped< Point3d > stampedIn, Stamped< Point3d > stampedOut) |
void | transformPoint (String targetFrameID, Time targetTime, Stamped< Point3d > stampedIn, String fixedFrameID, Stamped< Point3d > stampedOut) |
void | transformPose (String targetFrameID, Stamped< Matrix4d > stampedIn, Stamped< Matrix4d > stampedOut) |
void | transformPose (String targetFrameID, Time targetTime, Stamped< Matrix4d > stampedIn, String fixedFrameID, Stamped< Matrix4d > stampedOut) |
Static Public Member Functions | |
static synchronized TFListener | getInstance () |
Static Public Attributes | |
static final long | MAX_STORAGE_TIME = (new Duration(10, 0)).totalNsecs() |
Protected Member Functions | |
boolean | initListener () |
void | initRos (String node_name) |
boolean | lookupLists (Frame targetFrame, Frame sourceFrame, long time, LinkedList< TransformStorage > inverseTransforms, LinkedList< TransformStorage > forwardTransforms) |
Frame | lookupOrInsertFrame (String frameID) |
boolean | setTransform (TransformStamped transform) |
void | spinInSeperateThread () |
StampedTransform | StorageToStampedTransform (TransformStorage ts) |
TFListener () | |
TransformStamped | TFToTransformStampedMsg (TransformStorage tf) |
TransformStorage | transformStampedMsgToTF (TransformStamped msg) |
Protected Attributes | |
HashMap< String, Frame > | frames |
String | tfPrefix = "" |
Static Protected Attributes | |
static TFListener | instance |
static Ros | ros |
static NodeHandle | rosNode |
Private Member Functions | |
String | assertResolved (String prefix, String frameID) |
Static Private Member Functions | |
static String | resolve (String prefix, String frameID) |
A client that listens to the /tf topic, stores transforms in a buffer and allows transformation lookups from one frame to another.
The listener runs in a seperate thread. All tf messages published on the /tf topic are stored in a buffer, first sorted by child frame, then by parent frame, then by time stamp. This allows fast lookup of transformations. Tf's that are MAX_STORAGE_TIME older than the newest tf in the corresponding time cache are ignored.
To calculate a transformation from some source frame S to a target frame T at time t, TFListener uses a graph search to find the best path from S to T. At the moment, 'best' means that the largest difference between the time stamps of the transformations on the path and time t is minimized. If the tf graph is a tree, as is the case with original C++-implementation of tf, the graph will simply return the only path available (if any).
TFlistener is implemented as a singleton, which guarantees that at any time at most one client per system is listening to the /tf topic.
Definition at line 68 of file TFListener.java.
tfjava.TFListener.TFListener | ( | ) | [inline, protected] |
Class constructor. Initializes ROS, creates a node handle, initializes the listener and runs it in a separate thread.
Definition at line 102 of file TFListener.java.
String tfjava.TFListener.assertResolved | ( | String | prefix, |
String | frameID | ||
) | [inline, private] |
Returns the resolves version of the given frame ID, and asserts a debug message if the name was not fully resolved.
Definition at line 566 of file TFListener.java.
static synchronized TFListener tfjava.TFListener.getInstance | ( | ) | [inline, static] |
Returns the TFListener instance.
Definition at line 87 of file TFListener.java.
boolean tfjava.TFListener.initListener | ( | ) | [inline, protected] |
Initializes the listener.
Definition at line 125 of file TFListener.java.
void tfjava.TFListener.initRos | ( | String | node_name | ) | [inline, protected] |
Initializes ROS.
Definition at line 113 of file TFListener.java.
boolean tfjava.TFListener.lookupLists | ( | Frame | targetFrame, |
Frame | sourceFrame, | ||
long | time, | ||
LinkedList< TransformStorage > | inverseTransforms, | ||
LinkedList< TransformStorage > | forwardTransforms | ||
) | [inline, protected] |
Performs a bi-directional best-first graph search on the tf graph to try to find a path from sourceFrame to targetFrame, at the given time. One priority queue is used to keep a sorted list of all search nodes (from both directions, ordered descending by their potential of contributing to a good solution). At the moment, the cost of the path from A to B is defined as the largest absolute difference between the time stamps of the transforms from A to B and the given time point. This corresponds to searching for a transform path that needs the least amount of inter- and extrapolation.
Note: often in search, if we talk about expanding a search node, we say that the node expands and its _children_ are added to the queue. Yet, the tf graph is stored by linking child frames to their _parent_ frames, not the other way around. So, if a search node is expanded, the _parent_ frames are added to the queue. This may be a bit confusing.
Definition at line 370 of file TFListener.java.
Frame tfjava.TFListener.lookupOrInsertFrame | ( | String | frameID | ) | [inline, protected] |
Looks up and returns the frame belonging to the given frame ID. If the frame does not exist yet, it is first added to the map.
Definition at line 216 of file TFListener.java.
StampedTransform tfjava.TFListener.lookupTransform | ( | String | targetFrameID, |
String | sourceFrameID, | ||
Time | time | ||
) | [inline] |
Returns the transform from the specified source frame to the target frame at a given time; returns null if no transformation could be found.
Definition at line 280 of file TFListener.java.
StampedTransform tfjava.TFListener.lookupTransform | ( | String | targetID, |
Time | targetTime, | ||
String | sourceID, | ||
Time | sourceTime, | ||
String | fixedID | ||
) | [inline] |
Returns the transform from the specified source frame at sourceTime to the target frame at a given targetTime, based on a given fixed frame; returns null if no transformation could be found.
Definition at line 343 of file TFListener.java.
static String tfjava.TFListener.resolve | ( | String | prefix, |
String | frameID | ||
) | [inline, static, private] |
Returns the resolves version of the given frame ID.
Definition at line 575 of file TFListener.java.
boolean tfjava.TFListener.setTransform | ( | TransformStamped | transform | ) | [inline, protected] |
Converts transform (a geometry msg) to a TransformStorage object and adds it to the buffer.
Definition at line 172 of file TFListener.java.
void tfjava.TFListener.spinInSeperateThread | ( | ) | [inline, protected] |
Spin the ROS node in a seperate thread. This way, lookups and transforms are allowed while listening to the /tf topic.
Definition at line 156 of file TFListener.java.
StampedTransform tfjava.TFListener.StorageToStampedTransform | ( | TransformStorage | ts | ) | [inline, protected] |
Converts the TransformStorage datastructure (represented by quaternion and vector) to the StampedTransform datastructure (represented by a 4x4 matrix)
Definition at line 557 of file TFListener.java.
TransformStamped tfjava.TFListener.TFToTransformStampedMsg | ( | TransformStorage | tf | ) | [inline, protected] |
Converts the given TransformStorage datastructure to a TransformStamped message
Definition at line 532 of file TFListener.java.
void tfjava.TFListener.transformPoint | ( | String | targetFrameID, |
Stamped< Point3d > | stampedIn, | ||
Stamped< Point3d > | stampedOut | ||
) | [inline] |
Transforms a stamped point to the given target frame, and returns the result in stampedOut.
Definition at line 232 of file TFListener.java.
void tfjava.TFListener.transformPoint | ( | String | targetFrameID, |
Time | targetTime, | ||
Stamped< Point3d > | stampedIn, | ||
String | fixedFrameID, | ||
Stamped< Point3d > | stampedOut | ||
) | [inline] |
Transforms a stamped point to the given target frame and time, based on a given fixed frame, and returns the result in stampedOut.
Definition at line 243 of file TFListener.java.
void tfjava.TFListener.transformPose | ( | String | targetFrameID, |
Stamped< Matrix4d > | stampedIn, | ||
Stamped< Matrix4d > | stampedOut | ||
) | [inline] |
Transforms a stamped pose to the given target frame, and returns the result in stampedOut.
Definition at line 253 of file TFListener.java.
void tfjava.TFListener.transformPose | ( | String | targetFrameID, |
Time | targetTime, | ||
Stamped< Matrix4d > | stampedIn, | ||
String | fixedFrameID, | ||
Stamped< Matrix4d > | stampedOut | ||
) | [inline] |
Transforms a stamped pose to the given target frame and time, based on a given fixed frame, and returns the result in stampedOut.
Definition at line 264 of file TFListener.java.
TransformStorage tfjava.TFListener.transformStampedMsgToTF | ( | TransformStamped | msg | ) | [inline, protected] |
Converts the given TransformStamped message to the TransformStorage datastructure
Definition at line 515 of file TFListener.java.
HashMap<String, Frame> tfjava.TFListener.frames [protected] |
Map that maps frame ID's (names) to frames
Definition at line 80 of file TFListener.java.
TFListener tfjava.TFListener.instance [static, protected] |
The singleton instance
Definition at line 78 of file TFListener.java.
final long tfjava.TFListener.MAX_STORAGE_TIME = (new Duration(10, 0)).totalNsecs() [static] |
Maximum buffer storage time
Definition at line 71 of file TFListener.java.
Ros tfjava.TFListener.ros [static, protected] |
Reference to ROS
Definition at line 74 of file TFListener.java.
NodeHandle tfjava.TFListener.rosNode [static, protected] |
Ros node handle
Definition at line 76 of file TFListener.java.
String tfjava.TFListener.tfPrefix = "" [protected] |
TF name prefix, currently not used (TODO)
Definition at line 82 of file TFListener.java.