public override void AssignMission(Mission mission) { base.AssignMission(mission); // 20160411 MW (A bit ugly, but OK for now. Later on, we will remove // the CurrentPath and SpeedProfile in Mission, and instead take them // directly from mission.MissionItemList[currentMissionItemIndex] ... etc. mission.CurrentPath = mission.MissionItemList[0].MetricPath; ((PiecewiseLinearSpeedProfileMission)mission).PiecewiseLinearSpeedProfile = ((PiecewiseLinearSpeedProfileMissionItem)mission.MissionItemList[0]).PiecewiseLinearSpeedProfile; // END 20160411 Point point = mission.CurrentPath.MapSegmentList[0].NaturalCubicSplineList[0].GetPoint(0); previousPathPointIndex = 0; // Also the current path point, when starting! estimatedLocation = new MetricPathLocator(this.vehicle.Name, previousPathPointIndex); firstEstimateMade = false; }
private void GenerateSimulation() { singleRunSimulation = new SingleVehicleSimulation(); singleRunSimulation.VehicleList.Add(vehicle); singleRunSimulation.DriverList.Add(driver); singleRunSimulation.MetricPath = mission.CurrentPath; MetricPathLocator vehicleLocator = new MetricPathLocator(vehicle.Name, 0); singleRunSimulation.VehicleLocatorList.Add(vehicleLocator); singleRunSimulation.RunInRealTime = false; singleRunSimulation.LogData = true; foreach (VehicleStateItem stateItem in vehicle.VehicleState.ItemList) { LogItem logItem = new LogItem(); logItem.Name = stateItem.Name; logItem.VehicleStateItemName = stateItem.Name; singleRunSimulation.Log.AddLogItem(logItem); } singleRunSimulation.SetCurrentDateTime(DateTime.Now); singleRunSimulation.RunningMode = RunningMode.Synchronous; }