Exemple #1
0
        static void Main(string[] args)
        {
            var bot = new DuckieBot("http://192.168.1.10:5000", "Elcaduck");
            var map = new Map(new Point(-2f, -1.2f), new Point(2f, 1.2f), 0.2f);

            bot.MoveOnMap(map, new Point(-1.9f, -1.1f), new CancellationToken()).GetAwaiter().GetResult();
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var x1 = float.Parse(Corner1X.Text);
            var y1 = float.Parse(Corner1Y.Text);

            _corner1 = new Navigation.Point(x1, y1);
            var x2 = float.Parse(Corner2X.Text);
            var y2 = float.Parse(Corner2Y.Text);

            _corner2 = new Navigation.Point(x2, y2);
            _map     = new Map(_corner1, _corner2, 0.4f);

            _visitedNodes.Clear();

            var destX = float.Parse(DestX.Text);
            var destY = float.Parse(DestY.Text);

            _target = new Navigation.Point(destX, destY);

            DrawMap(_map);

            var bot = new DuckieBot(RoverAdress.Text, RoverId.Text);

            bot.RouteCalculated   += Bot_RouteCalculated;
            bot.ObstaclesDetected += Bot_ObstaclesDetected;
            await bot.MoveOnMap(_map, _target, new CancellationToken());
        }