Class OccupancyGridDefaultVisualizer.OccupancyGridVisual
The IVisual implementation used by OccupancyGridDefaultVisualizer. Subscribes to the topic, maintains a Texture2D from the raw grid data, and draws a textured quad via a Drawing3d.
Implements
Inherited Members
Namespace: Unity.SimulationPro.Foundation.Visualizations
Assembly: Unity.SimulationPro.Foundation.Visualizations.dll
Syntax
public class OccupancyGridDefaultVisualizer.OccupancyGridVisual : IVisual
Constructors
OccupancyGridVisual(IConnector, string, OccupancyGridDefaultVisualizer)
Creates an OccupancyGridDefaultVisualizer.OccupancyGridVisual that subscribes to the given topic and uses the provided factory settings for rendering.
Declaration
public OccupancyGridVisual(IConnector connector, string topic, OccupancyGridDefaultVisualizer settings)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnector | connector | The connector used to subscribe to the topic. |
| string | topic | ROS topic name. |
| OccupancyGridDefaultVisualizer | settings | The factory component that supplies color and material settings. |
Properties
Height
Gets the grid height in cells from the most recently received message.
Declaration
public uint Height { get; }
Property Value
| Type | Description |
|---|---|
| uint |
IsDrawingEnabled
The is drawing enabled.
Declaration
public bool IsDrawingEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Width
Gets the grid width in cells from the most recently received message.
Declaration
public uint Width { get; }
Property Value
| Type | Description |
|---|---|
| uint |
Methods
AddMessage(IMessage)
Handles an incoming message, updating the cached grid data and triggering a redraw if drawing is enabled.
Declaration
public void AddMessage(IMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The incoming OccupancyGridMsg message. |
DeleteDrawing()
Destroys the Drawing3d used to render the occupancy grid mesh.
Declaration
public void DeleteDrawing()
GetTexture()
Returns the grid texture, recreating or resizing it if the grid dimensions have changed since the last call.
Declaration
public Texture2D GetTexture()
Returns
| Type | Description |
|---|---|
| Texture2D | A Texture2D whose pixels represent the raw occupancy values. |
OnGUI()
On GUI.
Declaration
public void OnGUI()
Redraw()
Rebuilds the textured quad mesh from the most recently received grid data and uploads it to the Drawing3d.
Declaration
public void Redraw()
SetDrawingEnabled(bool)
Enables or disables 3D drawing for this visual.
Declaration
public void SetDrawingEnabled(bool enabled)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enabled | Whether drawing should be enabled. |