Class GenericMetric
General metric class used to record simulation metrics. This class can report values of many primitive types along with any struct/class implementing the IMessageProducer interface. For most use cases, using this class will be suitable for metric reporting.
Namespace: UnityEngine.Perception.GroundTruth.DataModel
Syntax
public class GenericMetric : Metric, IMessageProducer
Constructors
GenericMetric(Boolean, MetricDefinition, String, String)
Creates a new metric containing a boolean value.
Declaration
public GenericMetric(bool value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | The boolean metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Boolean[], MetricDefinition, String, String)
Creates a new metric containing an array of booleans.
Declaration
public GenericMetric(bool[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Boolean[] | values | The boolean metric values |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Int32, MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(int value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Int32[], MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(int[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | values | |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Single, MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(float value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Single | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Single[], MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(float[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Single[] | values | |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(String, MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(string value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
String | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(String[], MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(string[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
String[] | values | |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(UInt32, MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(uint value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(UInt32[], MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(uint[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
UInt32[] | values | |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(IMessageProducer, MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(IMessageProducer value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageProducer | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(IMessageProducer[], MetricDefinition, String, String)
Creates a new metric.
Declaration
public GenericMetric(IMessageProducer[] values, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
IMessageProducer[] | values | |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
GenericMetric(Vector3, MetricDefinition, String, String)
Creates a new float array metric from a vector3 value. The array will store the values as [x, y, z] in the array.
Declaration
public GenericMetric(Vector3 value, MetricDefinition definition, string sensorId = null, string annotationId = null)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | The metric value |
MetricDefinition | definition | The metric definition |
String | sensorId | The sensor ID, set as default for a metric not associated with a sensor |
String | annotationId | The annotation ID associated with this metric, set as default for a metric not associated to an annotation |
Methods
GetValues<T>()
Retrieves an array of the metric values.
Declaration
public override T[] GetValues<T>()
Returns
Type | Description |
---|---|
T[] |
Type Parameters
Name | Description |
---|---|
T |
Overrides
IsValid()
Is the component valid?
Declaration
public override bool IsValid()
Returns
Type | Description |
---|---|
Boolean | Is the component valid? |
Overrides
ToMessage(IMessageBuilder)
Convert contents int a message.
Declaration
public override void ToMessage(IMessageBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
IMessageBuilder | builder | The message builder that will convert the class's contents into a message |