Exemple #1
1
        public SLAM(double mapWidth, double mapHeight, double cellSize, string port)
        {
            robot = new Robot ();
            map = new SlamMap (robot, mapWidth, mapHeight, cellSize);
            mapView = new MapView (map);

            ekfSlam = new EkfSlam (1); // 1 degree per scan.

            proxy = SerialProxy.GetInstance;
            proxy.Port = port;

            proxy.OdometryUpdated += new EventHandler<OdometryUpdateEventArgs> (SerialProxy_OdometryUpdate);
            proxy.Scanned += new EventHandler<ScanEventArgs> (SerialProxy_Scan);

            window = new MapWindow (mapView);

            window.DeleteEvent += delegate
            {
                proxy.Release ();
            };

            //AddSampleLandmarks ();
        }
Exemple #2
0
        public void Forward(double distance)
        {
            if (robot.State != RobotState.Halted || robot.State != RobotState.Scanning)
            {
                robot.Halt();
            }

            double newPostion = robot.Position [1] + distance;

            robot.GoFoward();

            while (robot.Position [1] < newPostion)
            {
                Console.WriteLine(robot.Position [1]);
            }

            robot.Halt();
            Console.WriteLine(robot.Position [1]);

            proxy.Release();
        }
Exemple #3
0
        public SLAM(double mapWidth, double mapHeight, double cellSize, string port)
        {
            robot   = new Robot();
            map     = new SlamMap(robot, mapWidth, mapHeight, cellSize);
            mapView = new MapView(map);

            ekfSlam = new EkfSlam(1);              // 1 degree per scan.

            proxy      = SerialProxy.GetInstance;
            proxy.Port = port;

            proxy.OdometryUpdated += new EventHandler <OdometryUpdateEventArgs> (SerialProxy_OdometryUpdate);
            proxy.Scanned         += new EventHandler <ScanEventArgs> (SerialProxy_Scan);

            window = new MapWindow(mapView);

            window.DeleteEvent += delegate
            {
                proxy.Release();
            };

            //AddSampleLandmarks ();
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            bool           continueCommunication = true;
            string         message;
            StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;

            SerialProxy proxy    = SerialProxy.GetInstance;
            Observer    observer = new Observer(proxy);

            Console.WriteLine("Type QUIT to exit");

            while (continueCommunication)
            {
                message = Console.ReadLine();

                if (stringComparer.Equals("quit", message))
                {
                    continueCommunication = false;
                }
            }

            proxy.Release();
        }