Struct SensorHandle
A handle to a sensor managed by the DatasetCapture. It can be used to check whether the sensor is expected to capture this frame and report captures, annotations, and metrics regarding the sensor.
Namespace: UnityEngine.Perception.GroundTruth
Syntax
public struct SensorHandle : IDisposable, IEquatable<SensorHandle>
Properties
Id
The Id of the sensor
Declaration
public readonly string Id { get; }
Property Value
Type | Description |
---|---|
String |
IsNil
Returns true if this SensorHandle was default-instantiated.
Declaration
public readonly bool IsNil { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsValid
Returns whether this SensorHandle is valid in the current simulation. Nil SensorHandles are never valid.
Declaration
public readonly bool IsValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
ShouldCaptureThisFrame
Whether the sensor should capture this frame. Sensors are expected to call this method each frame to determine whether they should capture during the frame. Captures should only be reported when this is true.
Declaration
public readonly bool ShouldCaptureThisFrame { get; }
Property Value
Type | Description |
---|---|
Boolean |
valid
Declaration
public readonly bool valid { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Dispose()
Dispose this SensorHandle.
Declaration
public void Dispose()
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Equals(SensorHandle)
Declaration
public bool Equals(SensorHandle other)
Parameters
Type | Name | Description |
---|---|---|
SensorHandle | other |
Returns
Type | Description |
---|---|
Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
ReportAnnotation(AnnotationDefinition, Annotation)
Reports an annotation for the sensor.
Declaration
public AnnotationHandle ReportAnnotation(AnnotationDefinition definition, Annotation annotation)
Parameters
Type | Name | Description |
---|---|---|
AnnotationDefinition | definition | The annotation definition |
Annotation | annotation | The annotation value |
Returns
Type | Description |
---|---|
AnnotationHandle |
ReportAnnotationAsync(AnnotationDefinition)
Creates an async annotation for reporting the values for an annotation during a future frame.
Declaration
public AsyncFuture<Annotation> ReportAnnotationAsync(AnnotationDefinition annotationDefinition)
Parameters
Type | Name | Description |
---|---|---|
AnnotationDefinition | annotationDefinition | The AnnotationDefinition of this annotation. |
Returns
Type | Description |
---|---|
AsyncFuture<Annotation> | Returns a handle to the AsyncFuture<T>, which can be used to report annotation data during a subsequent frame. |
ReportMetric(MetricDefinition, Metric)
Reports a metric on the current frame.
Declaration
public void ReportMetric(MetricDefinition definition, Metric metric)
Parameters
Type | Name | Description |
---|---|---|
MetricDefinition | definition | The metric definition |
Metric | metric | The metric value |
ReportMetricAsync(MetricDefinition)
Start an async metric for reporting metric values for this frame in a subsequent frame.
Declaration
public AsyncFuture<Metric> ReportMetricAsync(MetricDefinition metricDefinition)
Parameters
Type | Name | Description |
---|---|---|
MetricDefinition | metricDefinition | The MetricDefinition of the metric |
Returns
Type | Description |
---|---|
AsyncFuture<Metric> | An AsyncFuture<T> which should be used to report the metric values, potentially in a later frame |
ReportSensor(Sensor)
Reports a sensor capture immediately for the current frame
Declaration
public void ReportSensor(Sensor sensor)
Parameters
Type | Name | Description |
---|---|---|
Sensor | sensor | The capture to report |
ReportSensorAsync()
Creates an async sensor for reporting the values for a sensor during a future frame.
Declaration
public AsyncFuture<Sensor> ReportSensorAsync()
Returns
Type | Description |
---|---|
AsyncFuture<Sensor> | Returns a handle to the AsyncFuture<T>, which can be used to report annotation data during a subsequent frame. |
RequestCapture()
Requests a capture from this sensor on the next rendered frame. Can only be used with manual capture mode (Manual).
Declaration
public void RequestCapture()
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Operators
Equality(SensorHandle, SensorHandle)
Compares two SensorHandle instances for equality.
Declaration
public static bool operator ==(SensorHandle left, SensorHandle right)
Parameters
Type | Name | Description |
---|---|---|
SensorHandle | left | The first SensorHandle. |
SensorHandle | right | The second SensorHandle. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the two SensorHandles refer to the same sensor. |
Inequality(SensorHandle, SensorHandle)
Compares two SensorHandle instances for inequality.
Declaration
public static bool operator !=(SensorHandle left, SensorHandle right)
Parameters
Type | Name | Description |
---|---|---|
SensorHandle | left | The first SensorHandle. |
SensorHandle | right | The second SensorHandle. |
Returns
Type | Description |
---|---|
Boolean | Returns false if the two SensorHandles refer to the same sensor. |