Class VectorSensor
A sensor implementation for vector observations.
Implements
Inherited Members
Namespace: Unity.MLAgents.Sensors
Assembly: solution.dll
Syntax
public class VectorSensor : ISensor
Constructors
| Name | Description |
|---|---|
| VectorSensor(int, string, ObservationType) | Initializes the sensor. |
Methods
| Name | Description |
|---|---|
| AddObservation(bool) | Adds a boolean observation to the vector observation of the agent. |
| AddObservation(IList<float>) | Adds a list or array of float observations to the vector observations of the agent. |
| AddObservation(int) | Adds an integer observation to the vector observations of the agent. |
| AddObservation(float) | Adds a float observation to the vector observations of the agent. |
| AddObservation(Quaternion) | Adds a quaternion observation to the vector observations of the agent. |
| AddObservation(Vector2) | Adds an Vector2 observation to the vector observations of the agent. |
| AddObservation(Vector3) | Adds an Vector3 observation to the vector observations of the agent. |
| AddOneHotObservation(int, int) | Adds a one-hot encoding observation. |
| GetBuiltInSensorType() | Return the corresponding BuiltInSensorType for the sensor. |
| GetCompressedObservation() | Return a compressed representation of the observation. For small observations, this should generally not be implemented. However, compressing large observations (such as visual results) can significantly improve model training time. |
| GetCompressionSpec() | Return information on the compression type being used. If no compression is used, return Default(). |
| GetName() | Get the name of the sensor. This is used to ensure deterministic sorting of the sensors on an Agent, so the naming must be consistent across all sensors and agents. |
| GetObservationSpec() | Returns a description of the observations that will be generated by the sensor. See ObservationSpec for more details, and helper methods to create one. |
| Reset() | Resets the internal state of the sensor. This is called at the end of an Agent's episode. Most implementations can leave this empty. |
| Update() | Update any internal state of the sensor. This is called once per each agent step. |
| Write(ObservationWriter) | Write the observation data directly to the ObservationWriter. Note that this (and GetCompressedObservation()) may be called multiple times per agent step, so should not mutate any internal state. |