Introduction to sensors
Learn how Simulation Pro sensors capture simulation data and publish it as ROS messages.
Simulation Pro provides a sensor framework for simulating robotics sensors in Unity. Sensors are MonoBehaviour components that produce ROS messages from simulation data.
Sensor base class
All sensors inherit from Sensor, which provides:
InitializeSensor(): called bySensor.Start()to wire up processing nodes and publishers.ShutdownSensor(): called bySensor.OnDestroy()to release resources.SetProperty(key, value): applies named string properties, for example properties set during URDF import.InheritTopicNamespace: optionally inherits a topic namespace prefix from a parentInheritTopicNamespacecomponent.
Each sensor contains one or more nodes (data processing stages) connected by ports (SensorPort<T>). Data flows through the node graph when a sensor fires.
Camera/ArticulationBody
│
[SensorNode] ← reads from Unity physics / rendering
│
[ProcessingNode] ← applies transforms, noise, coordinate conversions
│
[PublisherNode] ← sends via IConnector
│
ROS Topic
Scheduling
The Scheduler class manages time-based firing of sensor nodes relative to Clock.Now. Each sensor node registers itself with the scheduler at InitializeSensor() and fires at the configured update rate.
Noise
Apply Gaussian noise to sensor readings with GaussianNoise. For example, configure IMU noise through ImuSensor.m_ImuNode.Noise:
imuSensor.m_ImuNode.Noise.Mean = 0.0;
imuSensor.m_ImuNode.Noise.Stddev = 0.01;
Image sensors support ImageGaussianNoise for per-pixel noise injection.
Custom material properties
Sensors that depend on depth rendering support custom shader material properties through MaterialPropertiesAsset and the ICustomMaterialProperties interface. Assign a SensorMaterial asset to control which materials in the scene are visible to a specific sensor.
Save sensor output to disk
Use the following utility classes to save sensor output to disk:
| Class | Description |
|---|---|
ImageMessageSaver |
Saves sensor_msgs/Image messages to disk as image files. |
PointCloudMessageSaver |
Saves sensor_msgs/PointCloud2 messages to .pcd or .las files. |
PcdWriter |
Writes PCD-format point cloud files. |
LasWriter |
Writes LAS-format point cloud files. |