Class TFSystem
An ITransformSystem implementation that subscribes to a ROS /tf topic
and maintains a live dictionary of TFStream frame objects.
Implements
Inherited Members
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public class TFSystem : ITransformSystem
Constructors
TFSystem(IConnector, string)
Initializes a new TFSystem and begins subscribing to the given /tf topic.
Declaration
public TFSystem(IConnector connection, string tfTopic = "/tf")
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connection | The connector used to subscribe to transform messages. |
| string | tfTopic | The ROS topic name for transform messages. Defaults to |
Properties
Connector
Gets the IConnector used to subscribe to transform messages.
Declaration
public IConnector Connector { get; }
Property Value
| Type | Description |
|---|---|
| IConnector |
Methods
AddListener(Action<TFStream>)
Registers a callback to be invoked whenever a transform stream is updated.
Declaration
public void AddListener(Action<TFStream> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<TFStream> | callback | The action to invoke with the updated TFStream when a transform changes. |
ForceNotifyAll()
Forces all listeners to be notified of all currently tracked transform streams.
Declaration
public void ForceNotifyAll()
ForceNotifyChanged(TFStream)
Forces all listeners to be notified of a change to the specified stream.
Declaration
public void ForceNotifyChanged(TFStream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| TFStream | stream | The TFStream that has changed. |
GetOrCreateFrame(string)
Gets the TFStream for the specified frame ID, creating it if it does not exist.
Declaration
public TFStream GetOrCreateFrame(string frame_id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | frame_id | The ROS frame ID string. |
Returns
| Type | Description |
|---|---|
| TFStream | The existing or newly created TFStream. |
GetTransform(string, long)
Returns the world-space TFFrame for the given frame ID at the given timestamp.
Declaration
public TFFrame GetTransform(string frame_id, long time)
Parameters
| Type | Name | Description |
|---|---|---|
| string | frame_id | The ROS frame ID. |
| long | time | The timestamp in nanoseconds. |
Returns
| Type | Description |
|---|---|
| TFFrame |
GetTransform(HeaderMsg)
Gets the most recent transform frame matching the frame ID in the provided header.
Declaration
public TFFrame GetTransform(HeaderMsg header)
Parameters
| Type | Name | Description |
|---|---|---|
| HeaderMsg | header | The ROS message header containing the target frame ID. |
Returns
| Type | Description |
|---|---|
| TFFrame | The latest TFFrame for the specified frame, or a default value if not found. |
GetTransformNames()
Returns the names of all currently tracked transform frames.
Declaration
public IEnumerable<string> GetTransformNames()
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | An enumerable of frame ID strings. |
GetTransformObject(string)
Gets the GameObject associated with the specified frame ID.
Declaration
public GameObject GetTransformObject(string frame_id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | frame_id | The ROS frame ID string. |
Returns
| Type | Description |
|---|---|
| GameObject | The associated GameObject, or |
GetTransformStream(string)
Gets the TFStream for the specified frame ID.
Declaration
public TFStream GetTransformStream(string frame_id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | frame_id | The ROS frame ID string. |
Returns
| Type | Description |
|---|---|
| TFStream | The TFStream for the frame, or |
GetTransforms()
Returns all currently tracked transform streams.
Declaration
public IEnumerable<TFStream> GetTransforms()
Returns
| Type | Description |
|---|---|
| IEnumerable<TFStream> | An enumerable of all active TFStream instances. |