浏览代码

added todo notes for perception camera first frame bug

/usim-randomization
Steven Leal 4 年前
当前提交
18b18134
共有 4 个文件被更改,包括 28 次插入13 次删除
  1. 4
      com.unity.perception/Editor/Randomization/ParameterElement.cs
  2. 4
      com.unity.perception/Editor/Randomization/Uxml/FloatRangeElement.uxml
  3. 15
      com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs
  4. 18
      com.unity.perception/Tests/Runtime/Randomization/ScenarioTests.cs

4
com.unity.perception/Editor/Randomization/ParameterElement.cs


targetField.BindProperty(m_TargetGameObjectProperty);
targetField.RegisterCallback<ChangeEvent<Object>>(evt =>
{
if (evt.newValue == parameter.target.gameObject)
return;
ClearTarget();
m_TargetGameObjectProperty.objectReferenceValue = (GameObject)evt.newValue;
m_SerializedProperty.serializedObject.ApplyModifiedProperties();

m_TargetPropertyMenu.menu.MenuItems().Clear();
m_TargetPropertyMenu.text = parameter.target.propertyName == string.Empty
? "Select a property"
: Parameter.GetDisplayName(parameter.GetType());
: TargetPropertyDisplayText(parameter.target);
var options = GatherPropertyOptions(parameter.target.gameObject, parameter.sampleType);
foreach (var option in options)

4
com.unity.perception/Editor/Randomization/Uxml/FloatRangeElement.uxml


<VisualElement style="flex-direction: row; margin: 1px, 1px, 1px, 3px;">
<Label text="Range" class="unity-base-field__label" style="min-width: 147;"/>
<VisualElement class="float-range" style="flex-grow: 1; flex-direction: row;">
<editor:FloatField label="Min" tooltip="Minimum" name="minimum" style="flex-grow: 1; margin-bottom: 0;"/>
<editor:FloatField label="Max" tooltip="Maximum" name="maximum" style="flex-grow: 1; margin-right: 2px; margin-bottom: 0;"/>
<editor:FloatField label="Min" tooltip="Minimum" name="minimum" style="flex-grow: 1; flex-shrink: 0; flex-basis: 0; margin-bottom: 0;"/>
<editor:FloatField label="Max" tooltip="Maximum" name="maximum" style="flex-grow: 1; flex-shrink: 0; flex-basis: 0; margin-right: 2px; margin-bottom: 0;"/>
</VisualElement>
</VisualElement>
</VisualElement>

15
com.unity.perception/Runtime/Randomization/Scenarios/ScenarioBase.cs


{
static ScenarioBase s_ActiveScenario;
bool m_FirstFrame = true;
bool m_FirstIteration = true;
/// <summary>
/// If true, this scenario will quit the Unity application when it's finished executing

void Update()
{
if (currentIterationFrame == 0 && !m_FirstFrame)
// TODO: remove this check when the perception camera can capture the first frame of output
if (m_FirstFrame)
return;
if (currentIterationFrame == 0 && !m_FirstIteration)
OnIterationTeardown();
if (isScenarioComplete)

void LateUpdate()
{
// TODO: remove this check when the perception camera can capture the first frame of output
if (m_FirstFrame)
{
m_FirstFrame = false;
return;
}
m_FirstIteration = false;
m_FirstFrame = false;
}
}
}

18
com.unity.perception/Tests/Runtime/Randomization/ScenarioTests.cs


Object.DestroyImmediate(m_TestObject);
}
void CreateNewScenario()
// TODO: update this function once the perception camera doesn't skip the first frame
IEnumerator CreateNewScenario()
yield return null;
CreateNewScenario();
yield return CreateNewScenario();
m_Scenario.serializedConstantsFileName = "perception_serialization_test";
var constants = new FixedLengthScenario.Constants

[UnityTest]
public IEnumerator IterationsCanLastMultipleFrames()
{
CreateNewScenario();
yield return CreateNewScenario();
const int testIterationFrameCount = 5;
m_Scenario.constants.framesPerIteration = testIterationFrameCount;

[UnityTest]
public IEnumerator FinishesWhenIsScenarioCompleteIsTrue()
{
CreateNewScenario();
yield return CreateNewScenario();
const int testIterationTotal = 5;
m_Scenario.constants.framesPerIteration = 1;
m_Scenario.constants.totalIterations = testIterationTotal;

[UnityTest]
public IEnumerator AppliesParametersEveryFrame()
{
CreateNewScenario();
yield return CreateNewScenario();
m_Scenario.constants.framesPerIteration = 5;
m_Scenario.constants.totalIterations = 1;

parameter.target.AssignNewTarget(
m_TestObject, transform, "position", ParameterApplicationFrequency.OnIterationSetup);
yield return new WaitForEndOfFrame();
CreateNewScenario();
yield return CreateNewScenario();
m_Scenario.constants.framesPerIteration = 2;
m_Scenario.constants.totalIterations = 2;

[UnityTest]
public IEnumerator StartNewDatasetSequenceEveryIteration()
{
CreateNewScenario();
yield return CreateNewScenario();
m_Scenario.constants.framesPerIteration = 2;
m_Scenario.constants.totalIterations = 2;

正在加载...
取消
保存