From f0ae123dacd23551acbe7e1076a81400297d75bf Mon Sep 17 00:00:00 2001 From: Chris Elion Date: Thu, 27 Feb 2020 17:42:16 -0800 Subject: [PATCH] rename to Perceive() --- com.unity.ml-agents/CHANGELOG.md | 2 +- com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs | 2 +- docs/Migrating.md | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index c9b2105f37..5503c01ed6 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -22,7 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - A tutorial on adding custom SideChannels was added (#3391) - The stepping logic for the Agent and the Academy has been simplified (#3448) - Update Barracuda to 0.6.0-preview - - The interface for `RayPerceptionSensor.PerceiveStatic()` was changed to take an input class and write to an output class. + * The interface for `RayPerceptionSensor.PerceiveStatic()` was changed to take an input class and write to an output class, and the method was renamed to `Perceive()`. - The checkpoint file suffix was changed from `.cptk` to `.ckpt` (#3470) - The command-line argument used to determine the port that an environment will listen on was changed from `--port` to `--mlagents-port`. - `DemonstrationRecorder` can now record observations outside of the editor. diff --git a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs index 74aa84f2b1..2e0a218412 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs @@ -347,7 +347,7 @@ public virtual SensorCompressionType GetCompressionType() /// /// Input defining the rays that will be cast. /// Output struct containing the raycast results. - public static RayPerceptionOutput PerceiveStatic(RayPerceptionInput input) + public static RayPerceptionOutput Perceive(RayPerceptionInput input) { RayPerceptionOutput output = new RayPerceptionOutput(); output.rayOutputs = new RayPerceptionOutput.RayOutput[input.angles.Count]; diff --git a/docs/Migrating.md b/docs/Migrating.md index 07d69c1c6f..dcdcc3e3ee 100644 --- a/docs/Migrating.md +++ b/docs/Migrating.md @@ -14,7 +14,7 @@ The versions can be found in * The `SetActionMask` method must now be called on the optional `ActionMasker` argument of the `CollectObservations` method. (We now consider an action mask as a type of observation) * The `Monitor` class has been moved to the Examples Project. (It was prone to errors during testing) * The `MLAgents.Sensor` namespace has been removed. All sensors now belong to the `MLAgents` namespace. -* The interface for `RayPerceptionSensor.PerceiveStatic()` was changed to take an input class and write to an output class. +* The interface for `RayPerceptionSensor.PerceiveStatic()` was changed to take an input class and write to an output class, and the method was renamed to `Perceive()`. * The `SetActionMask` method must now be called on the optional `ActionMasker` argument of the `CollectObservations` method. (We now consider an action mask as a type of observation) * The method `GetStepCount()` on the Agent class has been replaced with the property getter `StepCount` * The `--multi-gpu` option has been removed temporarily. @@ -23,7 +23,8 @@ The versions can be found in * Add the `using MLAgents.Sensors;` in addition to `using MLAgents;` on top of your Agent's script. * Replace your Agent's implementation of `CollectObservations()` with `CollectObservations(VectorSensor sensor)`. In addition, replace all calls to `AddVectorObs()` with `sensor.AddObservation()` or `sensor.AddOneHotObservation()` on the `VectorSensor` passed as argument. * Replace your calls to `SetActionMask` on your Agent to `ActionMasker.SetActionMask` in `CollectObservations` -* If you call `RayPerceptionSensor.PerceiveStatic()` manually, add your inputs to a `RayPerceptionInput`. To get the previous float array output, use `RayPerceptionOutput.ToFloatArray()` +* If you call `RayPerceptionSensor.PerceiveStatic()` manually, add your inputs to a `RayPerceptionInput`. To get the previous float array output, + iterate through `RayPerceptionOutput.rayOutputs` and call `RayPerceptionOutput.RayOutput.ToFloatArray()`. * Re-import all of your `*.NN` files to work with the updated Barracuda package. * Replace all calls to `Agent.GetStepCount()` with `Agent.StepCount`