public ScenarioTestResult(ScenarioIntermediaryTestResult i, Scenario scenario, HelicopterBase helicopter, GameTime gameTime, TestScenarioEndTrigger endTrigger) { Autopilot = new AutopilotConfiguration { MaxHVelocity = helicopter.Autopilot.MaxHVelocity, PIDSetup = helicopter.Autopilot.PIDSetup.Clone() }; AvgEstimatedPositionError = i.AccEstimatedPositionError / i.UpdateCount; AvgHeightAboveGround = i.AccHeightAboveGround / i.UpdateCount; AvgVelocity = i.AccVelocity / i.UpdateCount; Duration = gameTime.TotalGameTime - i.StartTime; EndTrigger = endTrigger; FlightLog = new List <HelicopterLogSnapshot>(helicopter.Log); MaxEstimatedPositionError = i.MaxEstimatedPositionError; MaxHeightAboveGround = i.MaxHeightAboveGround; MaxVelocity = i.MaxVelocity; MinEstimatedPositionError = i.MinEstimatedPositionError; MinHeightAboveGround = i.MinHeightAboveGround; Scenario = scenario; Sensors = new SensorSpecifications { AccelerometerStdDev = DefaultAutopilotConfiguration.AccelerometerStdDev, GPSVelocityStdDev = DefaultAutopilotConfiguration.GPSVelocityStdDev, GPSPositionStdDev = DefaultAutopilotConfiguration.GPSPositionStdDev }; }
public ScenarioTestResult(ScenarioIntermediaryTestResult i, Scenario scenario, HelicopterBase helicopter, GameTime gameTime, TestScenarioEndTrigger endTrigger) { Autopilot = new AutopilotConfiguration { MaxHVelocity = helicopter.Autopilot.MaxHVelocity, PIDSetup = helicopter.Autopilot.PIDSetup.Clone() }; AvgEstimatedPositionError = i.AccEstimatedPositionError/i.UpdateCount; AvgHeightAboveGround = i.AccHeightAboveGround/i.UpdateCount; AvgVelocity = i.AccVelocity/i.UpdateCount; Duration = gameTime.TotalGameTime - i.StartTime; EndTrigger = endTrigger; FlightLog = new List<HelicopterLogSnapshot>(helicopter.Log); MaxEstimatedPositionError = i.MaxEstimatedPositionError; MaxHeightAboveGround = i.MaxHeightAboveGround; MaxVelocity = i.MaxVelocity; MinEstimatedPositionError = i.MinEstimatedPositionError; MinHeightAboveGround = i.MinHeightAboveGround; Scenario = scenario; Sensors = new SensorSpecifications { AccelerometerStdDev = DefaultAutopilotConfiguration.AccelerometerStdDev, GPSVelocityStdDev = DefaultAutopilotConfiguration.GPSVelocityStdDev, GPSPositionStdDev = DefaultAutopilotConfiguration.GPSPositionStdDev }; }
private void UpdateTestResults(GameTime gameTime, TestScenarioEndTrigger endTrigger) { if (!_testResults.ContainsKey(_scenario.Name)) _testResults[_scenario.Name] = new List<ScenarioTestResult>(); // Append result to list of results for this scenario name var r = new ScenarioTestResult(_intermediaryTestResult, _scenario, _helicopter, gameTime, endTrigger); _testResults[_scenario.Name].Add(r); }
private void HandleTestScenarioEnded(GameTime gameTime, TestScenarioEndTrigger endTrigger) { UpdateTestResults(gameTime, endTrigger); // If we reached our destination or the user skipped this test scenario, then // go to next test scenario. if (endTrigger == TestScenarioEndTrigger.ReachedDestination) { Debug.WriteLine("We reached our destination."); NextTestScenario(); } else if (endTrigger == TestScenarioEndTrigger.UserSkipped) { Debug.WriteLine("User skipped scenario."); NextTestScenario(); } else if (endTrigger == TestScenarioEndTrigger.TimedOut) { Debug.WriteLine("Test scenario timed out."); NextTestScenario(); } else if (endTrigger == TestScenarioEndTrigger.Crashed) { // If helicopter crashed then try a slower velocity setting (if available) // or go to next test scenario (if available). if (_testMaxHVelocityIter.MoveNext()) Debug.WriteLine("Now testing maxHVelocity " + _testMaxHVelocityIter.Current); else { Debug.WriteLine("Crashed at lowest velocity setting."); NextTestScenario(); } } else throw new NotImplementedException("Unknown end trigger " + endTrigger); // Quit if no scenarios are left or reset to start new test scenario. if (_scenario == null) Exit(); else Reset(); }