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();
        }