浏览代码
Adding the goal conditioning sensors with the new observation specs
/goal-conditioning/sensors-3-pytest-fix
Adding the goal conditioning sensors with the new observation specs
/goal-conditioning/sensors-3-pytest-fix
vincentpierre
4 年前
当前提交
1843345f
共有 12 个文件被更改,包括 169 次插入 和 20 次删除
-
1com.unity.ml-agents/Editor/CameraSensorComponentEditor.cs
-
5com.unity.ml-agents/Runtime/Sensors/CameraSensor.cs
-
14com.unity.ml-agents/Runtime/Sensors/CameraSensorComponent.cs
-
10com.unity.ml-agents/Runtime/Sensors/ISensor.cs
-
10com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs
-
17com.unity.ml-agents/Tests/Editor/Sensor/CameraSensorTest.cs
-
14com.unity.ml-agents/Tests/Editor/Sensor/VectorSensorTests.cs
-
4ml-agents-envs/mlagents_envs/base_env.py
-
30com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs
-
11com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs.meta
-
62com.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 |
|||
{ |
|||
[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"; |
|||
|
|||
public int ObservationSize |
|||
{ |
|||
get { return m_observationSize; } |
|||
set { m_observationSize = value; } |
|||
} |
|||
|
|||
[HideInInspector, SerializeField] |
|||
int m_observationSize; |
|||
|
|||
[HideInInspector, SerializeField] |
|||
ObservationType m_ObservationType; |
|||
|
|||
VectorSensor m_sensor; |
|||
|
|||
public ObservationType ObservationType |
|||
{ |
|||
get { return m_ObservationType; } |
|||
set { m_ObservationType = value; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a VectorSensor.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public override ISensor CreateSensor() |
|||
{ |
|||
m_sensor = new VectorSensor(m_observationSize, m_SensorName, m_ObservationType); |
|||
return m_sensor; |
|||
} |
|||
|
|||
/// <inheritdoc/>
|
|||
public override int[] GetObservationShape() |
|||
{ |
|||
return new[] { m_observationSize }; |
|||
} |
|||
|
|||
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