public void TrackPlannerFind360TurnTrackTest() { TrackPlanner planner = new TrackPlanner( locationTolerance: 9, angleTolerance: 19.0d, positionStep: 10.0d, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 500.0d, _y: 500.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 500.0d, _y: 500.0d, _angle: 90.0d); List<PositionAndOrientation> track = planner.PlanTrack(map); Assert.IsTrue(track.Count > 10); // its really bad assert, but still better than nothing }
public void TrackPlannerFindSmallForwardTrackTest() { TrackPlanner planner = new TrackPlanner( locationTolerance: 9, angleTolerance: 19.0d, positionStep: 10.0d, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 500.0d, _y: 500.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 500.0d, _y: 510.0d, _angle: 90.0d); List<PositionAndOrientation> track = planner.PlanTrack(map); Assert.AreEqual(2, track.Count); }
public void TrackPlannerFind90TurnTrackTest() { TrackPlanner planner = new TrackPlanner( locationTolerance: 9, angleTolerance: 19.0d, positionStep: 10.0d, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 500.0d, _y: 500.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 600.0d, _y: 600.0d, _angle: 0.0d); List<PositionAndOrientation> track = planner.PlanTrack(map); Assert.IsTrue(track.Count > 10); // coz it not a bad expectation ;) }
public Form1() { TrackPlanner planner = new TrackPlanner( locationTolerance: 9, angleTolerance: 19.0d, positionStep: 10.0d, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 100.0d, _y: 100.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 900.0d, _y: 900.0d, _angle: 90.0d); List<PositionAndOrientation> track = planner.PlanTrack(map); Application.Exit(); InitializeComponent(); }
public Form1() { TrackPlanner planner = new TrackPlanner( locationTolerance: 9, angleTolerance: 19.0d, positionStep: 10.0d, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 100.0d, _y: 100.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 900.0d, _y: 900.0d, _angle: 90.0d); List <PositionAndOrientation> track = planner.PlanTrack(map); Application.Exit(); InitializeComponent(); }
private void button_PrepareTrack_Click(object sender, RoutedEventArgs e) { if (map != null) { trackPlanner = new TrackPlanner( locationTolerance: POSITION_STEP - 1, angleTolerance: 9.0d, positionStep: (int)POSITION_STEP, angleStep: 10.0d, mapSizeX: map.mapWidth, mapSizeY: map.mapHeight); trackPlanner.PrepareTracks(map); DrawTrackPlannerSeenNodes(trackPlanner.GetSeen()); trackPrepared = true; } else { System.Windows.Forms.MessageBox.Show("Get base map first!"); } }
public void TrackPlannerObstacleTest() { TrackPlanner planner = new TrackPlanner( locationTolerance: 39, angleTolerance: 19.0d, positionStep: 40.0, angleStep: 20.0d, mapSizeX: 1000.0d, mapSizeY: 1000.0d); Map map = new Map(1000, 1000); map.car = new PositionAndOrientation(_x: 500.0, _y: 100.0d, _angle: 90.0d); map.parking = new PositionAndOrientation(_x: 500.0, _y: 900.0, _angle: 90.0d); map.obstacles.Add(new Rectangle(350, 500, 300, 50)); List<PositionAndOrientation> track = planner.PlanTrack(map); Assert.IsTrue(track.Count > 20); }