|
|
|
|
|
|
using System; |
|
|
|
|
|
|
|
namespace Unity.MLAgents.Sensors |
|
|
|
{ |
|
|
|
public class BufferSensor : ISensor |
|
|
|
|
|
|
{ |
|
|
|
m_MaxNumObs = maxNumberObs; |
|
|
|
m_ObsSize = obsSize; |
|
|
|
m_ObservationBuffer = new float[m_ObservableSize * m_MaxNumObservables]; |
|
|
|
m_ObservationBuffer = new float[m_ObsSize * m_MaxNumObs]; |
|
|
|
m_CurrentNumObservables = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public int Write(ObservationWriter writer) |
|
|
|
{ |
|
|
|
for (int i = 0; i < m_ObservableSize * m_MaxNumObservables; i++) |
|
|
|
for (int i = 0; i < m_ObsSize * m_MaxNumObs; i++) |
|
|
|
return m_ObservableSize * m_MaxNumObservables; |
|
|
|
return m_ObsSize * m_MaxNumObs; |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|