예제 #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 ();
        }
예제 #2
0
        private Robot robot; // Robot model that this view represents.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.RobotView"/> class.
        /// </summary>
        /// <param name="robotModel">Robot model that this view represents.</param>
        public RobotView(Robot robotModel)
        {
            robot = robotModel;
            relativeRotation = 0.0;
            lastRotation = -7.0;
            robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.Map"/> class.
        /// </summary>
        /// <param name="robotModel">Robot roaming on this map.</param>
        public SlamMap(Robot robotModel, double mapWidth, double mapHeight, double mapCellSize)
        {
            // Robot starts in the center of the map.
            robot = robotModel;

            landmarks = new List<Landmark>();

            cellSize = mapCellSize;
            width = mapWidth;
            height = mapHeight;
        }
예제 #4
0
        private TextView textView; // Textview to hold landmark information.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class.
        /// </summary>
        /// <param name="mapView">Map view contained in this window.</param>
        public MapWindow(MapView mapView)
            : base("Map")
        {
            robot = mapView.RobotView.Robot;

            this.mapView = mapView;

            // Subscribe to events.
            mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update);
            mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);

            SetPosition (WindowPosition.Center);
            Resizable = false;

            DeleteEvent += delegate
            {
                Application.Quit ();
            };

            TextBuffer textBuffer = new TextBuffer (new TextTagTable ());

            textView = new TextView ();
            textView.Indent = 10;
            textView.Editable = false;
            textView.Buffer = textBuffer;
            textView.CursorVisible = false;
            textView.SetSizeRequest (mapView.ViewWidth, 150);

            foreach (Landmark landmark in mapView.MapModel.Landmarks)
            {
                this.textView.Buffer.Text += landmark.ToString ();
            }

            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.Add (textView);

            commandEntry = new Entry ();
            commandEntry.Activated += CommandEntry_OnActivated;

            sendButton = new Button ("Send");
            sendButton.Clicked += SendButton_OnClick;

            HBox hbox = new HBox (false, 0);
            hbox.Add (commandEntry);
            hbox.Add (sendButton);

            VBox vbox = new VBox (false, 0);
            vbox.Add (this.mapView);
            vbox.Add (scrolledWindow);
            vbox.Add (hbox);

            Add (vbox);
            Shown += OnShown;
        }
예제 #5
0
        public MainClass(string port, int baudRate)
        {
            proxy = SerialProxy.GetInstance;
            proxy.Port = port;
            proxy.BaudRate = baudRate;

            robot = new Robot ();

            proxy.OdometryUpdated += new EventHandler<OdometryUpdateEventArgs> (SerialProxy_OdometryUpdate);
            proxy.Scanned += new EventHandler<ScanEventArgs> (SerialProxy_Scan);
            proxy.Start ();
        }
예제 #6
0
        private void InitializeAll()
        {
            AppGlobals.Logic = new Logic(new LaserSpotDetector1());
            AppGlobals.Robot = new Robot(new RobotEngineMc());

            _scene = new Scene();;

            _form = AppGlobals.Form;
            _robot = AppGlobals.Robot;

            while (AppGlobals.Camera == null || AppGlobals.Robot == null)
                Thread.Sleep(100);
        }
 public RobotUpdateEventArgs(Robot updatedRobot)
 {
     robot = updatedRobot;
 }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.PathView"/> class.
        /// </summary>
        /// <param name="robotModel">The instance oif the robot that will be followed.</param>
        public PathView(Robot robotModel)
        {
            robot = robotModel;

            robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Path_Update);
        }