Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            robot.ReadLaserValues();

            Console.WriteLine("Robot: {0} {1}", robot.Center.x, robot.Center.y);
            Console.WriteLine("Robot: {0} {1} {2} {3}", robot.LL, robot.LF, robot.RF, robot.RR);

            CreatePathForm createPathForm = new CreatePathForm();

            createPathForm.FormClosing += (o, form) =>
            {
                var src = new Point(Int32.Parse(createPathForm.srcXTextBox.Text), Int32.Parse(createPathForm.srcYTextBox.Text));


                LocationApproximator locationApproximator = new LocationApproximator();
                locationApproximator.SetUp(map);
                Point loc = locationApproximator.GetLocation((int)(src.x - R / 2), (int)(src.y - R / 2), R, R, 2, robot.LL, robot.LF, robot.RR, robot.RF);
                robot.Center = loc;
                Console.WriteLine("Robot: {0} {1}", robot.Center.x, robot.Center.y);
                Console.WriteLine("Robot: {0} {1} {2} {3}", robot.LL, robot.LF, robot.RF, robot.RR);
                Render();
            };
            createPathForm.Show();

            Render();
        }
Beispiel #2
0
        private void navigateBtn_Click(object sender, EventArgs e)
        {
            CreatePathForm createPathForm = new CreatePathForm();

            createPathForm.map = map;

            createPathForm.FormClosing += (o, form) =>
            {
                route = new RoutePlanner(robot, map);
                var src  = new Point(Int32.Parse(createPathForm.srcXTextBox.Text), Int32.Parse(createPathForm.srcYTextBox.Text));
                var dest = new Point(Int32.Parse(createPathForm.dstXtextBox.Text), Int32.Parse(createPathForm.dstYTextBox.Text));

                route.Start(src, dest);
                Timer1.Enabled = true;
            };
            createPathForm.Show();
        }
Beispiel #3
0
        private void bntBtn_Click(object sender, EventArgs e)
        {
            ///   robot.ReadLaserValues();
//               robot.Rotate(90);
//            return;
            //Console.WriteLine("Robot: {0} {1}", robot.Center.x, robot.Center.y);
            //Console.WriteLine("Robot: {0} {1} {2} {3}", robot.LL, robot.LF, robot.RF, robot.RR);

            CreatePathForm createPathForm = new CreatePathForm();

            createPathForm.FormClosing += (o, form) =>
            {
                var src = new Point(Int32.Parse(createPathForm.srcXTextBox.Text), Int32.Parse(createPathForm.srcYTextBox.Text));
                // LocationApproximator locationApproximator = new LocationApproximator();
                //   locationApproximator.SetUp(map);
                //    Point loc = locationApproximator.GetLocation((int)(src.x - R / 2), (int)(src.y - R / 2), R, R, 2, robot.LL, robot.LF, robot.RR, robot.RF);
                //      robot.Center = loc;
                Console.WriteLine("Robot: {0} {1}", robot.Center.x, robot.Center.y);
                Console.WriteLine("Robot: {0} {1} {2} {3}", robot.LL, robot.LF, robot.RF, robot.RR);
                bnt = new BNT(map, robot);


                List <String> names = new List <string>(createPathForm.dstXtextBox.Text.Split(' '));
                List <String> oo    = new List <string>(createPathForm.dstYTextBox.Text.Split(' '));

                List <Orientation> orientations = oo.ConvertAll(input =>
                {
                    Orientation orientation;
                    Enum.TryParse <Orientation>(input, out orientation);
                    return(orientation);
                });
//                bnt.TEST(src, names, orientations);
                bnt.Start(src, names, orientations);

                Timer1.Enabled = true;
                Render();
            };
            createPathForm.Show();
            Render();
        }