浏览代码

fix perception binaries capture one extra frame before the scenario starts

/fix-one-extra-frame-before-scenario-starts
RuiyuZ 3 年前
当前提交
0d0e71b7
共有 2 个文件被更改,包括 5 次插入33 次删除
  1. 24
      com.unity.perception/Runtime/Randomization/Scenarios/PerceptionScenario.cs
  2. 14
      com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs

24
com.unity.perception/Runtime/Randomization/Scenarios/PerceptionScenario.cs


/// </summary>
MetricDefinition m_IterationMetricDefinition;
/// <summary>
/// The scriptable render pipeline hook used to capture perception data skips the first frame of the simulation
/// when running locally, so this flag is used to track whether the first frame has been skipped yet.
/// </summary>
protected bool m_SkippedFirstFrame;
/// <inheritdoc/>
protected override bool isScenarioReadyToStart
{
get
{
if (!m_SkippedFirstFrame)
{
m_SkippedFirstFrame = true;
return false;
}
return true;
}
}
protected override bool isScenarioReadyToStart => Time.frameCount >= 2;
foreach (var perceptionCamera in FindObjectsOfType<PerceptionCamera>())
perceptionCamera.enabled = false;
m_IterationMetricDefinition = DatasetCapture.RegisterMetricDefinition(
"scenario_iteration", "Iteration information for dataset sequences",
Guid.Parse(k_ScenarioIterationMetricDefinitionId));

protected override void OnStart()
{
foreach (var perceptionCamera in FindObjectsOfType<PerceptionCamera>())
perceptionCamera.enabled = true;
var randomSeedMetricDefinition = DatasetCapture.RegisterMetricDefinition(
"random-seed",
"The random seed used to initialize the random state of the simulation. Only triggered once per simulation.",

14
com.unity.perception/Runtime/Randomization/Scenarios/UnitySimulationScenario.cs


where T : UnitySimulationScenarioConstants, new()
{
/// <inheritdoc/>
protected override bool isScenarioReadyToStart
{
get
{
if (!Configuration.Instance.IsSimulationRunningInCloud() && !m_SkippedFirstFrame)
{
m_SkippedFirstFrame = true;
return false;
}
return true;
}
}
/// <inheritdoc/>
protected sealed override bool isScenarioComplete => currentIteration >= constants.totalIterations;
/// <inheritdoc/>

正在加载...
取消
保存