浏览代码

remove ITypedSensor

/v2-staging-rebase
Chris Elion 4 年前
当前提交
162046f1
共有 4 个文件被更改,包括 17 次插入53 次删除
  1. 12
      com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs
  2. 16
      com.unity.ml-agents/Runtime/Sensors/ISensor.cs
  3. 31
      com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs
  4. 11
      com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs.meta

12
com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs


observationProto.Shape.Add(shape[i]);
}
// Add the observation type, if any, to the observationProto
var typeSensor = sensor as ITypedSensor;
if (typeSensor != null)
{
observationProto.ObservationType = (ObservationTypeProto)typeSensor.GetObservationType();
}
else
{
observationProto.ObservationType = ObservationTypeProto.Default;
}
observationProto.ObservationType = (ObservationTypeProto) obsSpec.ObservationType;
return observationProto;
}

16
com.unity.ml-agents/Runtime/Sensors/ISensor.cs


}
/// <summary>
/// The ObservationType enum of the Sensor.
/// </summary>
public enum ObservationType
{
// Collected observations are generic.
Default = 0,
// Collected observations contain goal information.
Goal = 1,
// Collected observations contain reward information.
Reward = 2,
// Collected observations are messages from other agents.
Message = 3,
}
/// <summary>
/// Sensor interface for generating observations.
/// </summary>
public interface ISensor

31
com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs


namespace Unity.MLAgents.Sensors
{
/// <summary>
/// The ObservationType enum of the Sensor.
/// </summary>
public enum ObservationType
{
// Collected observations are generic.
Default = 0,
// Collected observations contain goal information.
Goal = 1,
// Collected observations contain reward information.
Reward = 2,
// Collected observations are messages from other agents.
Message = 3,
}
/// <summary>
/// Sensor interface for sensors with variable types.
/// </summary>
internal interface ITypedSensor
{
/// <summary>
/// Returns the ObservationType enum corresponding to the type of the sensor.
/// </summary>
/// <returns>The ObservationType enum</returns>
ObservationType GetObservationType();
}
}

11
com.unity.ml-agents/Runtime/Sensors/ITypedSensor.cs.meta


fileFormatVersion: 2
guid: 3751edac8122c411dbaef8f1b7043b82
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存