浏览代码

Add stacking option to VectorSensorComponent (#5376)

/colab-links
GitHub 4 年前
当前提交
1f48cfdc
共有 2 个文件被更改,包括 20 次插入0 次删除
  1. 1
      com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs
  2. 19
      com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs

1
com.unity.ml-agents/Editor/VectorSensorComponentEditor.cs


EditorGUILayout.PropertyField(so.FindProperty("m_SensorName"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationSize"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationType"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationStacks"), true);
}
EditorGUI.EndDisabledGroup();

19
com.unity.ml-agents/Runtime/Sensors/VectorSensorComponent.cs


set { m_ObservationType = value; }
}
[HideInInspector, SerializeField]
[Range(1, 50)]
[Tooltip("Number of camera frames that will be stacked before being fed to the neural network.")]
int m_ObservationStacks = 1;
/// <summary>
/// Whether to stack previous observations. Using 1 means no previous observations.
/// Note that changing this after the sensor is created has no effect.
/// </summary>
public int ObservationStacks
{
get { return m_ObservationStacks; }
set { m_ObservationStacks = value; }
}
/// <summary>
/// Creates a VectorSensor.
/// </summary>

m_Sensor = new VectorSensor(m_ObservationSize, m_SensorName, m_ObservationType);
if (ObservationStacks != 1)
{
return new ISensor[] { new StackingSensor(m_Sensor, ObservationStacks) };
}
return new ISensor[] { m_Sensor };
}

正在加载...
取消
保存