Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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 ;)
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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!");
            }
        }
Exemplo n.º 7
0
        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);
        }