Class BaseVisualFactory<T>
Abstract base class for MonoBehaviour-based visual factories that subscribe to a typed ROS message and create IVisual instances per topic.
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public abstract class BaseVisualFactory<T> : MonoBehaviour, IVisualFactory, IPriority where T : IMessage
Type Parameters
| Name | Description |
|---|---|
| T | The ROS message type this factory handles. |
Fields
m_ID
The scene-persistent unique identifier for this factory instance.
Declaration
[SerializeField]
[HideInInspector]
protected string m_ID
Field Value
| Type | Description |
|---|---|
| string |
m_Topic
The topic.
Declaration
[SerializeField]
protected string m_Topic
Field Value
| Type | Description |
|---|---|
| string |
Properties
AllVisuals
Gets all IVisual instances currently managed by this factory.
Declaration
public IEnumerable<IVisual> AllVisuals { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<IVisual> |
CanShowDrawing
Gets a value indicating whether this factory produces visuals that support 3D drawing output.
Declaration
public abstract bool CanShowDrawing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Connector
Gets the IConnector associated with this factory.
Declaration
public IConnector Connector { get; }
Property Value
| Type | Description |
|---|---|
| IConnector |
ID
Gets the scene-persistent unique identifier for this factory instance.
Declaration
public string ID { get; }
Property Value
| Type | Description |
|---|---|
| string |
Name
Gets the human-readable display name of this factory.
Declaration
public virtual string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Priority
Gets or sets the priority of this object. Higher values take precedence over lower values.
Declaration
public int Priority { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Topic
Gets or sets the topic this factory subscribes to. An empty string registers the factory as a type-wide default.
Declaration
public string Topic { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Awake()
Finds and caches the IConnector for this GameObject.
Declaration
public virtual void Awake()
CreateVisual(string)
Creates a new IVisual instance for the given topic. Called the first time a topic is encountered.
Declaration
protected abstract IVisual CreateVisual(string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topic | ROS topic name. |
Returns
| Type | Description |
|---|---|
| IVisual | A new IVisual for the topic. |
GetOrCreateVisual(IConnector, string)
Returns an existing IVisual for the given topic, or creates one if none exists.
Declaration
public virtual IVisual GetOrCreateVisual(IConnector connector, string topic)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector providing topic subscriptions. |
| string | topic | The ROS topic name. |
Returns
| Type | Description |
|---|---|
| IVisual | The IVisual instance for the topic. |
ListenForMessages(IConnector, string, Action<IMessage>)
Subscribes to incoming messages on the specified topic, using the message type's disambiguator to resolve the subscription.
Declaration
public static void ListenForMessages(IConnector connector, string topic, Action<IMessage> callback)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector to subscribe on. |
| string | topic | ROS topic name. |
| Action<IMessage> | callback | The action invoked when a message arrives. |
Start()
Registers this factory with VisualFactoryRegistry for the configured topic or message type.
Declaration
public virtual void Start()