From 4868e4e670189b22adca834d9a494033d9e43d73 Mon Sep 17 00:00:00 2001 From: vincentpierre Date: Wed, 26 Feb 2020 14:25:40 -0800 Subject: [PATCH 1/3] Reintroduced the namespace MLAgents.Sensors --- .../Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs | 1 + .../ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs | 1 + Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs | 1 + .../Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs | 1 + .../Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs | 1 + .../Examples/FoodCollector/Scripts/FoodCollectorAgent.cs | 1 + .../Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs | 1 + .../Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs | 1 + .../Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs | 1 + .../Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs | 1 + .../ML-Agents/Examples/Template/Scripts/TemplateAgent.cs | 1 + .../Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs | 1 + .../Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs | 1 + .../ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs | 2 +- com.unity.ml-agents/Editor/BehaviorParametersEditor.cs | 2 +- .../Editor/RayPerceptionSensorComponentBaseEditor.cs | 2 +- com.unity.ml-agents/Runtime/Agent.cs | 1 + .../Runtime/Demonstrations/DemonstrationWriter.cs | 1 + com.unity.ml-agents/Runtime/Grpc/GrpcExtensions.cs | 1 + com.unity.ml-agents/Runtime/Grpc/RpcCommunicator.cs | 1 + com.unity.ml-agents/Runtime/ICommunicator.cs | 1 + .../Runtime/InferenceBrain/BarracudaModelParamLoader.cs | 2 +- com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs | 1 + com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs | 2 +- com.unity.ml-agents/Runtime/InferenceBrain/TensorGenerator.cs | 1 + com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs | 1 + com.unity.ml-agents/Runtime/Policy/HeuristicPolicy.cs | 1 + com.unity.ml-agents/Runtime/Policy/IPolicy.cs | 1 + com.unity.ml-agents/Runtime/Policy/RemotePolicy.cs | 1 + com.unity.ml-agents/Runtime/Sensor/CameraSensor.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/CameraSensorComponent.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/ISensor.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/Observation.cs | 3 +-- com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs | 2 +- .../Runtime/Sensor/RayPerceptionSensorComponent2D.cs | 2 +- .../Runtime/Sensor/RayPerceptionSensorComponent3D.cs | 2 +- .../Runtime/Sensor/RayPerceptionSensorComponentBase.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/RenderTextureSensor.cs | 2 +- .../Runtime/Sensor/RenderTextureSensorComponent.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/SensorBase.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/SensorComponent.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/SensorShapeValidator.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/StackingSensor.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/VectorSensor.cs | 2 +- com.unity.ml-agents/Runtime/Sensor/WriteAdapter.cs | 2 +- com.unity.ml-agents/Runtime/Utilities.cs | 1 + com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs | 1 + com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs | 1 + .../Tests/Editor/Sensor/FloatVisualSensorTests.cs | 2 +- .../Tests/Editor/Sensor/RayPerceptionSensorTests.cs | 1 + com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs | 2 +- com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs | 1 + com.unity.ml-agents/Tests/Editor/Sensor/WriterAdapterTests.cs | 2 +- 53 files changed, 53 insertions(+), 25 deletions(-) diff --git a/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs b/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs index 4fdcd74bfe..a40702ad49 100644 --- a/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs +++ b/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class Ball3DAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs b/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs index bc1777c4fb..730e725f26 100644 --- a/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs +++ b/Project/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DHardAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class Ball3DHardAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs b/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs index e4face4e73..75653e5c5f 100644 --- a/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Basic/Scripts/BasicAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class BasicAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs b/Project/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs index bd8f19e4ff..36ef24bb95 100644 --- a/Project/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Bouncer/Scripts/BouncerAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class BouncerAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs b/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs index 8a3788eca5..dc326f9fb4 100644 --- a/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Crawler/Scripts/CrawlerAgent.cs @@ -1,6 +1,7 @@ using UnityEngine; using MLAgents; using MLAgentsExamples; +using MLAgents.Sensors; [RequireComponent(typeof(JointDriveController))] // Required to set joint forces public class CrawlerAgent : Agent diff --git a/Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs b/Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs index 48de78becc..42208ae639 100644 --- a/Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs +++ b/Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/FoodCollectorAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class FoodCollectorAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs b/Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs index aa3b712edd..53502c89c8 100644 --- a/Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs +++ b/Project/Assets/ML-Agents/Examples/GridWorld/Scripts/GridAgent.cs @@ -2,6 +2,7 @@ using UnityEngine; using System.Linq; using MLAgents; +using MLAgents.Sensors; using UnityEngine.Serialization; public class GridAgent : Agent diff --git a/Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs b/Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs index 9f13889747..30bd2ef683 100644 --- a/Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Hallway/Scripts/HallwayAgent.cs @@ -1,6 +1,7 @@ using System.Collections; using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class HallwayAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs b/Project/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs index 60b1260b44..4a49e62b56 100644 --- a/Project/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Pyramids/Scripts/PyramidAgent.cs @@ -3,6 +3,7 @@ using UnityEngine; using Random = UnityEngine.Random; using MLAgents; +using MLAgents.Sensors; public class PyramidAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs b/Project/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs index 25c11ff546..3c15944e3b 100644 --- a/Project/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class ReacherAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Template/Scripts/TemplateAgent.cs b/Project/Assets/ML-Agents/Examples/Template/Scripts/TemplateAgent.cs index 0c6b1a99d9..737e4a278b 100644 --- a/Project/Assets/ML-Agents/Examples/Template/Scripts/TemplateAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Template/Scripts/TemplateAgent.cs @@ -1,5 +1,6 @@ using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class TemplateAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs b/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs index fb6ec9920d..fdfe39b2ac 100644 --- a/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Tennis/Scripts/TennisAgent.cs @@ -1,6 +1,7 @@ using UnityEngine; using UnityEngine.UI; using MLAgents; +using MLAgents.Sensors; public class TennisAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs b/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs index 44df4f8260..eae715131e 100644 --- a/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs +++ b/Project/Assets/ML-Agents/Examples/Walker/Scripts/WalkerAgent.cs @@ -1,6 +1,7 @@ using UnityEngine; using MLAgents; using MLAgentsExamples; +using MLAgents.Sensors; public class WalkerAgent : Agent { diff --git a/Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs b/Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs index ff74c035c3..8822dd9f91 100644 --- a/Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs +++ b/Project/Assets/ML-Agents/Examples/WallJump/Scripts/WallJumpAgent.cs @@ -4,7 +4,7 @@ using UnityEngine; using MLAgents; using Barracuda; - +using MLAgents.Sensors; public class WallJumpAgent : Agent { diff --git a/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs b/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs index 17265bca21..4ef36e3271 100644 --- a/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs +++ b/com.unity.ml-agents/Editor/BehaviorParametersEditor.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using MLAgents.Sensors; using UnityEditor; using Barracuda; diff --git a/com.unity.ml-agents/Editor/RayPerceptionSensorComponentBaseEditor.cs b/com.unity.ml-agents/Editor/RayPerceptionSensorComponentBaseEditor.cs index e0fed982fa..fd4e2a37d8 100644 --- a/com.unity.ml-agents/Editor/RayPerceptionSensorComponentBaseEditor.cs +++ b/com.unity.ml-agents/Editor/RayPerceptionSensorComponentBaseEditor.cs @@ -1,6 +1,6 @@ using UnityEngine; using UnityEditor; -using Barracuda; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Agent.cs b/com.unity.ml-agents/Runtime/Agent.cs index c1022c7b32..78e77a1d39 100644 --- a/com.unity.ml-agents/Runtime/Agent.cs +++ b/com.unity.ml-agents/Runtime/Agent.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using Barracuda; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs b/com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs index b866b9d088..9f2bc1b975 100644 --- a/com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs +++ b/com.unity.ml-agents/Runtime/Demonstrations/DemonstrationWriter.cs @@ -1,6 +1,7 @@ using System.IO; using Google.Protobuf; using System.Collections.Generic; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Grpc/GrpcExtensions.cs b/com.unity.ml-agents/Runtime/Grpc/GrpcExtensions.cs index a622d36d5f..f08384aad9 100644 --- a/com.unity.ml-agents/Runtime/Grpc/GrpcExtensions.cs +++ b/com.unity.ml-agents/Runtime/Grpc/GrpcExtensions.cs @@ -5,6 +5,7 @@ using MLAgents.CommunicatorObjects; using UnityEngine; using System.Runtime.CompilerServices; +using MLAgents.Sensors; [assembly: InternalsVisibleTo("Unity.ML-Agents.Editor")] [assembly: InternalsVisibleTo("Unity.ML-Agents.Editor.Tests")] diff --git a/com.unity.ml-agents/Runtime/Grpc/RpcCommunicator.cs b/com.unity.ml-agents/Runtime/Grpc/RpcCommunicator.cs index 6d9e9683ea..dd8e44f56e 100644 --- a/com.unity.ml-agents/Runtime/Grpc/RpcCommunicator.cs +++ b/com.unity.ml-agents/Runtime/Grpc/RpcCommunicator.cs @@ -9,6 +9,7 @@ using System.Linq; using UnityEngine; using MLAgents.CommunicatorObjects; +using MLAgents.Sensors; using System.IO; using Google.Protobuf; diff --git a/com.unity.ml-agents/Runtime/ICommunicator.cs b/com.unity.ml-agents/Runtime/ICommunicator.cs index 9eb33b48c3..e57632ad80 100644 --- a/com.unity.ml-agents/Runtime/ICommunicator.cs +++ b/com.unity.ml-agents/Runtime/ICommunicator.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/InferenceBrain/BarracudaModelParamLoader.cs b/com.unity.ml-agents/Runtime/InferenceBrain/BarracudaModelParamLoader.cs index 47a57a5f6d..51792d968c 100644 --- a/com.unity.ml-agents/Runtime/InferenceBrain/BarracudaModelParamLoader.cs +++ b/com.unity.ml-agents/Runtime/InferenceBrain/BarracudaModelParamLoader.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using Barracuda; -using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.InferenceBrain { diff --git a/com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs b/com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs index f98775b5cc..a2c104f20b 100644 --- a/com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs +++ b/com.unity.ml-agents/Runtime/InferenceBrain/GeneratorImpl.cs @@ -3,6 +3,7 @@ using Barracuda; using MLAgents.InferenceBrain.Utils; using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.InferenceBrain { diff --git a/com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs b/com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs index 299accfd5a..d26e84a55f 100644 --- a/com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs +++ b/com.unity.ml-agents/Runtime/InferenceBrain/ModelRunner.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using Barracuda; using UnityEngine.Profiling; -using System; +using MLAgents.Sensors; namespace MLAgents.InferenceBrain { diff --git a/com.unity.ml-agents/Runtime/InferenceBrain/TensorGenerator.cs b/com.unity.ml-agents/Runtime/InferenceBrain/TensorGenerator.cs index b95d8da4ee..ac19693e31 100644 --- a/com.unity.ml-agents/Runtime/InferenceBrain/TensorGenerator.cs +++ b/com.unity.ml-agents/Runtime/InferenceBrain/TensorGenerator.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Barracuda; +using MLAgents.Sensors; namespace MLAgents.InferenceBrain { diff --git a/com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs b/com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs index 361a882b14..ecab3f0b5f 100644 --- a/com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs +++ b/com.unity.ml-agents/Runtime/Policy/BarracudaPolicy.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using MLAgents.InferenceBrain; using System; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Policy/HeuristicPolicy.cs b/com.unity.ml-agents/Runtime/Policy/HeuristicPolicy.cs index 77acd43845..61d2466a2a 100644 --- a/com.unity.ml-agents/Runtime/Policy/HeuristicPolicy.cs +++ b/com.unity.ml-agents/Runtime/Policy/HeuristicPolicy.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Policy/IPolicy.cs b/com.unity.ml-agents/Runtime/Policy/IPolicy.cs index 58d9cc4d6a..8bd8ea2f15 100644 --- a/com.unity.ml-agents/Runtime/Policy/IPolicy.cs +++ b/com.unity.ml-agents/Runtime/Policy/IPolicy.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Policy/RemotePolicy.cs b/com.unity.ml-agents/Runtime/Policy/RemotePolicy.cs index 5b2245a339..19ffbd7446 100644 --- a/com.unity.ml-agents/Runtime/Policy/RemotePolicy.cs +++ b/com.unity.ml-agents/Runtime/Policy/RemotePolicy.cs @@ -1,6 +1,7 @@ using UnityEngine; using System.Collections.Generic; using System; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Runtime/Sensor/CameraSensor.cs b/com.unity.ml-agents/Runtime/Sensor/CameraSensor.cs index f4e6dc7c33..4fc250f064 100644 --- a/com.unity.ml-agents/Runtime/Sensor/CameraSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/CameraSensor.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A sensor that wraps a Camera object to generate visual observations for an agent. diff --git a/com.unity.ml-agents/Runtime/Sensor/CameraSensorComponent.cs b/com.unity.ml-agents/Runtime/Sensor/CameraSensorComponent.cs index 35a6763f0e..2cde34be5d 100644 --- a/com.unity.ml-agents/Runtime/Sensor/CameraSensorComponent.cs +++ b/com.unity.ml-agents/Runtime/Sensor/CameraSensorComponent.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A SensorComponent that creates a . diff --git a/com.unity.ml-agents/Runtime/Sensor/ISensor.cs b/com.unity.ml-agents/Runtime/Sensor/ISensor.cs index fac46d205b..fccbe37417 100644 --- a/com.unity.ml-agents/Runtime/Sensor/ISensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/ISensor.cs @@ -1,4 +1,4 @@ -namespace MLAgents +namespace MLAgents.Sensors { /// /// The compression setting for visual/camera observations. diff --git a/com.unity.ml-agents/Runtime/Sensor/Observation.cs b/com.unity.ml-agents/Runtime/Sensor/Observation.cs index 5f8bb4401b..f2c2e7a476 100644 --- a/com.unity.ml-agents/Runtime/Sensor/Observation.cs +++ b/com.unity.ml-agents/Runtime/Sensor/Observation.cs @@ -1,7 +1,6 @@ using System; -using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { internal struct Observation { diff --git a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs index 63d8235586..74aa84f2b1 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensor.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// Determines which dimensions the sensor will perform the casts in. diff --git a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent2D.cs b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent2D.cs index 6e78d01a1a..23de98229f 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent2D.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent2D.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A component for 2D Ray Perception. diff --git a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent3D.cs b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent3D.cs index e7ccafa7b4..a4e444c42d 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent3D.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponent3D.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.Serialization; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A component for 3D Ray Perception. diff --git a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponentBase.cs b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponentBase.cs index 085feed675..7b3a5e46c4 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponentBase.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RayPerceptionSensorComponentBase.cs @@ -3,7 +3,7 @@ using UnityEngine; using UnityEngine.Serialization; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A base class to support sensor components for raycast-based sensors. diff --git a/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensor.cs b/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensor.cs index bd28bb86a2..29780a3f47 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensor.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// Sensor class that wraps a instance. diff --git a/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensorComponent.cs b/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensorComponent.cs index 0d4315e9fe..18132dc86d 100644 --- a/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensorComponent.cs +++ b/com.unity.ml-agents/Runtime/Sensor/RenderTextureSensorComponent.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// Component that wraps a . diff --git a/com.unity.ml-agents/Runtime/Sensor/SensorBase.cs b/com.unity.ml-agents/Runtime/Sensor/SensorBase.cs index b96a71ff75..7ec7f5d8f8 100644 --- a/com.unity.ml-agents/Runtime/Sensor/SensorBase.cs +++ b/com.unity.ml-agents/Runtime/Sensor/SensorBase.cs @@ -1,4 +1,4 @@ -namespace MLAgents +namespace MLAgents.Sensors { /// /// A base sensor that provides a number default implementations. diff --git a/com.unity.ml-agents/Runtime/Sensor/SensorComponent.cs b/com.unity.ml-agents/Runtime/Sensor/SensorComponent.cs index 33a7edc949..2e1883efd3 100644 --- a/com.unity.ml-agents/Runtime/Sensor/SensorComponent.cs +++ b/com.unity.ml-agents/Runtime/Sensor/SensorComponent.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// Editor components for creating Sensors. Generally an ISensor implementation should have a diff --git a/com.unity.ml-agents/Runtime/Sensor/SensorShapeValidator.cs b/com.unity.ml-agents/Runtime/Sensor/SensorShapeValidator.cs index 889a29ffe7..ebaeeeb34e 100644 --- a/com.unity.ml-agents/Runtime/Sensor/SensorShapeValidator.cs +++ b/com.unity.ml-agents/Runtime/Sensor/SensorShapeValidator.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { internal class SensorShapeValidator { diff --git a/com.unity.ml-agents/Runtime/Sensor/StackingSensor.cs b/com.unity.ml-agents/Runtime/Sensor/StackingSensor.cs index 7460e94f75..cce03eedae 100644 --- a/com.unity.ml-agents/Runtime/Sensor/StackingSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/StackingSensor.cs @@ -1,4 +1,4 @@ -namespace MLAgents +namespace MLAgents.Sensors { /// /// Sensor that wraps around another Sensor to provide temporal stacking. diff --git a/com.unity.ml-agents/Runtime/Sensor/VectorSensor.cs b/com.unity.ml-agents/Runtime/Sensor/VectorSensor.cs index c9bca4b314..a242883c30 100644 --- a/com.unity.ml-agents/Runtime/Sensor/VectorSensor.cs +++ b/com.unity.ml-agents/Runtime/Sensor/VectorSensor.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace MLAgents +namespace MLAgents.Sensors { /// /// A sensor implementation for vector observations. diff --git a/com.unity.ml-agents/Runtime/Sensor/WriteAdapter.cs b/com.unity.ml-agents/Runtime/Sensor/WriteAdapter.cs index b1f6deb4af..fa12cbfb9c 100644 --- a/com.unity.ml-agents/Runtime/Sensor/WriteAdapter.cs +++ b/com.unity.ml-agents/Runtime/Sensor/WriteAdapter.cs @@ -3,7 +3,7 @@ using Barracuda; using MLAgents.InferenceBrain; -namespace MLAgents +namespace MLAgents.Sensors { /// /// Allows sensors to write to both TensorProxy and float arrays/lists. diff --git a/com.unity.ml-agents/Runtime/Utilities.cs b/com.unity.ml-agents/Runtime/Utilities.cs index 661607affb..399e5c19d5 100644 --- a/com.unity.ml-agents/Runtime/Utilities.cs +++ b/com.unity.ml-agents/Runtime/Utilities.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using MLAgents.Sensors; namespace MLAgents { diff --git a/com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs b/com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs index 2ee9c8d759..d37e41da80 100644 --- a/com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs +++ b/com.unity.ml-agents/Tests/Editor/DemonstrationTests.cs @@ -3,6 +3,7 @@ using System.IO.Abstractions.TestingHelpers; using System.Reflection; using MLAgents.CommunicatorObjects; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs b/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs index dca9f74f1c..7536e6664a 100644 --- a/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs +++ b/com.unity.ml-agents/Tests/Editor/MLAgentsEditModeTest.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using System.Reflection; using System.Collections.Generic; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/Sensor/FloatVisualSensorTests.cs b/com.unity.ml-agents/Tests/Editor/Sensor/FloatVisualSensorTests.cs index 4c5595284b..5c7dded656 100644 --- a/com.unity.ml-agents/Tests/Editor/Sensor/FloatVisualSensorTests.cs +++ b/com.unity.ml-agents/Tests/Editor/Sensor/FloatVisualSensorTests.cs @@ -1,5 +1,5 @@ using NUnit.Framework; -using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/Sensor/RayPerceptionSensorTests.cs b/com.unity.ml-agents/Tests/Editor/Sensor/RayPerceptionSensorTests.cs index b983200bc6..b57c56b8b5 100644 --- a/com.unity.ml-agents/Tests/Editor/Sensor/RayPerceptionSensorTests.cs +++ b/com.unity.ml-agents/Tests/Editor/Sensor/RayPerceptionSensorTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using NUnit.Framework; using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs b/com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs index 77dc3d0243..3c2cf265a0 100644 --- a/com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs +++ b/com.unity.ml-agents/Tests/Editor/Sensor/StackingSensorTests.cs @@ -1,5 +1,5 @@ using NUnit.Framework; -using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs b/com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs index 64140e241f..659d6726c6 100644 --- a/com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs +++ b/com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using UnityEngine; +using MLAgents.Sensors; namespace MLAgents.Tests { diff --git a/com.unity.ml-agents/Tests/Editor/Sensor/WriterAdapterTests.cs b/com.unity.ml-agents/Tests/Editor/Sensor/WriterAdapterTests.cs index 4b6a39ba5e..0288ab5fdf 100644 --- a/com.unity.ml-agents/Tests/Editor/Sensor/WriterAdapterTests.cs +++ b/com.unity.ml-agents/Tests/Editor/Sensor/WriterAdapterTests.cs @@ -1,5 +1,5 @@ using NUnit.Framework; -using UnityEngine; +using MLAgents.Sensors; using Barracuda; using MLAgents.InferenceBrain; From fb93ff7fbc57da9260abd63d4b2a1f24e4d37f34 Mon Sep 17 00:00:00 2001 From: vincentpierre Date: Wed, 26 Feb 2020 14:29:34 -0800 Subject: [PATCH 2/3] Documentation changes --- docs/Learning-Environment-Create-New.md | 3 ++- docs/Migrating.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Learning-Environment-Create-New.md b/docs/Learning-Environment-Create-New.md index a28a5f2587..7a1144dc60 100644 --- a/docs/Learning-Environment-Create-New.md +++ b/docs/Learning-Environment-Create-New.md @@ -117,7 +117,7 @@ Then, edit the new `RollerAgent` script: 1. In the Unity Project window, double-click the `RollerAgent` script to open it in your code editor. -2. In the editor, add the `using MLAgents;` statement and then change the base +2. In the editor, add the `using MLAgents;` and `using MLAgents.Sensors` statements and then change the base class from `MonoBehaviour` to `Agent`. 3. Delete the `Update()` method, but we will use the `Start()` function, so leave it alone for now. @@ -155,6 +155,7 @@ So far, our RollerAgent script looks like: using System.Collections.Generic; using UnityEngine; using MLAgents; +using MLAgents.Sensors; public class RollerAgent : Agent { diff --git a/docs/Migrating.md b/docs/Migrating.md index 0c80634b7e..07d69c1c6f 100644 --- a/docs/Migrating.md +++ b/docs/Migrating.md @@ -20,6 +20,7 @@ The versions can be found in * The `--multi-gpu` option has been removed temporarily. ### Steps to Migrate +* 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()` From b3c22a886fc1cfef4ccfc2cb1b74e442b01a13e4 Mon Sep 17 00:00:00 2001 From: vincentpierre Date: Wed, 26 Feb 2020 14:39:52 -0800 Subject: [PATCH 3/3] updated the changelog --- com.unity.ml-agents/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.ml-agents/CHANGELOG.md b/com.unity.ml-agents/CHANGELOG.md index bb6b11e453..4d84782aa1 100755 --- a/com.unity.ml-agents/CHANGELOG.md +++ b/com.unity.ml-agents/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Beta support for ONNX export was added. If the `tf2onnx` python package is installed, models will be saved to `.onnx` as well as `.nn` format. Note that Barracuda 0.6.0 or later is required to import the `.onnx` files properly - Multi-GPU training and the `--multi-gpu` option has been removed temporarily. (#3345) + - All Sensor related code has been moved to the namespace `MLAgents.Sensors`. ### Minor Changes - Monitor.cs was moved to Examples. (#3372)