浏览代码
Adding the goal conditioning sensors with the new observation specs (#5159)
Adding the goal conditioning sensors with the new observation specs (#5159)
* Fixing networks.py for the merge * fix compile error * Adding the goal conditioning sensors with the new observation specs * addressing feedback * I forgot to change the m_observationType * Renaming Goal to GoalSignal (#5190) * Renaming GOAL to GOAL_SIGNAL * VectorSensorComponent to use new API * Adding docstrings * verbose pytest on github action Co-authored-by: Chris Elion <chris.elion@unity3d.com>/check-for-ModelOverriders
GitHub
4 年前
当前提交
c37cfac1
共有 19 个文件被更改,包括 194 次插入 和 55 次删除
-
2.github/workflows/pytest.yml
-
1com.unity.ml-agents/Editor/CameraSensorComponentEditor.cs
-
12com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/Observation.cs
-
5com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
-
14com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs
-
12com.unity.ml-agents/Runtime/Sensors/ISensor.cs
-
10com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs
-
17com.unity.ml-agents/Tests/Runtime/Sensor/CameraSensorTest.cs
-
14com.unity.ml-agents/Tests/Runtime/Sensor/VectorSensorTests.cs
-
6ml-agents-envs/mlagents_envs/base_env.py
-
18ml-agents-envs/mlagents_envs/communicator_objects/observation_pb2.py
-
8ml-agents-envs/mlagents_envs/communicator_objects/observation_pb2.pyi
-
2ml-agents/mlagents/trainers/tests/simple_test_envs.py
-
2ml-agents/mlagents/trainers/torch/networks.py
-
6protobuf-definitions/proto/mlagents_envs/communicator_objects/observation.proto
-
30com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs
-
11com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs.meta
-
68com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs
-
11com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs.meta
|
|||
using UnityEditor; |
|||
using Unity.MLAgents.Sensors; |
|||
|
|||
namespace Unity.MLAgents.Editor |
|||
{ |
|||
[CustomEditor(typeof(VectorSensorComponent))] |
|||
[CanEditMultipleObjects] |
|||
internal class VectorSensorComponentEditor : UnityEditor.Editor |
|||
{ |
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var so = serializedObject; |
|||
so.Update(); |
|||
|
|||
// Drawing the VectorSensorComponent
|
|||
|
|||
EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties()); |
|||
{ |
|||
// These fields affect the sensor order or observation size,
|
|||
// So can't be changed at runtime.
|
|||
EditorGUILayout.PropertyField(so.FindProperty("m_SensorName"), true); |
|||
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationSize"), true); |
|||
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationType"), true); |
|||
} |
|||
EditorGUI.EndDisabledGroup(); |
|||
|
|||
so.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: aa0230c3402f04921acdbbdb61f6ff00 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Serialization; |
|||
|
|||
namespace Unity.MLAgents.Sensors |
|||
{ |
|||
/// <summary>
|
|||
/// A SensorComponent that creates a <see cref="VectorSensor"/>.
|
|||
/// </summary>
|
|||
[AddComponentMenu("ML Agents/Vector Sensor", (int)MenuGroup.Sensors)] |
|||
public class VectorSensorComponent : SensorComponent |
|||
{ |
|||
/// <summary>
|
|||
/// Name of the generated <see cref="VectorSensor"/> object.
|
|||
/// Note that changing this at runtime does not affect how the Agent sorts the sensors.
|
|||
/// </summary>
|
|||
public string SensorName |
|||
{ |
|||
get { return m_SensorName; } |
|||
set { m_SensorName = value; } |
|||
} |
|||
[HideInInspector, SerializeField] |
|||
private string m_SensorName = "VectorSensor"; |
|||
|
|||
/// <summary>
|
|||
/// The number of float observations in the VectorSensor
|
|||
/// </summary>
|
|||
public int ObservationSize |
|||
{ |
|||
get { return m_ObservationSize; } |
|||
set { m_ObservationSize = value; } |
|||
} |
|||
|
|||
[HideInInspector, SerializeField] |
|||
int m_ObservationSize; |
|||
|
|||
[HideInInspector, SerializeField] |
|||
ObservationType m_ObservationType; |
|||
|
|||
VectorSensor m_Sensor; |
|||
|
|||
/// <summary>
|
|||
/// The type of the observation.
|
|||
/// </summary>
|
|||
public ObservationType ObservationType |
|||
{ |
|||
get { return m_ObservationType; } |
|||
set { m_ObservationType = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a VectorSensor.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public override ISensor[] CreateSensors() |
|||
{ |
|||
m_Sensor = new VectorSensor(m_ObservationSize, m_SensorName, m_ObservationType); |
|||
return new ISensor[] { m_Sensor }; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Returns the underlying VectorSensor
|
|||
/// </summary>
|
|||
public VectorSensor GetSensor() |
|||
{ |
|||
return m_Sensor; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 38b7cc1f5819445aa85e9a9b054552dc |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue