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 (); }
/// <summary> /// Initializes a new instance of the <see cref="SLAM.MapUpdateEventArgs"/> class. /// </summary> /// <param name="updatedMap">Updated map.</param> public MapUpdateEventArgs(SlamMap updatedMap) { map = updatedMap; }
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 (); }
/// <summary> /// Initializes a new instance of the <see cref="SLAM.MapView"/> class. /// </summary> /// <param name="mapModel">Map model.</param> public MapView(SlamMap mapModel) { this.mapModel = mapModel; robotView = new RobotView (mapModel.Robot); landmarkView = new LandmarkView (mapModel.Landmarks); pathView = new PathView (mapModel.Robot); // Subscribe to events. mapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update); robotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update); ExposeEvent += OnExpose; // Map width and height is specified in meters, and we are using // 1 pixel to every centimeter, so scale up by 100. viewWidth = (int)(mapModel.Width * 100); viewHeight = (int)(mapModel.Height * 100); cellWidth = (int)(mapModel.CellSize * 100); cellHeight = (int)(mapModel.CellSize * 100); centerX = (int)(viewWidth / 2); centerY = (int)(viewHeight / 2); SetSizeRequest (viewWidth, viewHeight); }
/// <summary> /// Initializes a new instance of the <see cref="SLAM.MapView"/> class. /// </summary> /// <param name="mapModel">Map model.</param> public MapView(SlamMap mapModel) { this.mapModel = mapModel; robotView = new RobotView(mapModel.Robot); landmarkView = new LandmarkView(mapModel.Landmarks); pathView = new PathView(mapModel.Robot); // Subscribe to events. mapModel.MapUpdated += new EventHandler <MapUpdateEventArgs> (Map_Update); robotView.Robot.RobotUpdated += new EventHandler <RobotUpdateEventArgs> (Robot_Update); ExposeEvent += OnExpose; // Map width and height is specified in meters, and we are using // 1 pixel to every centimeter, so scale up by 100. viewWidth = (int)(mapModel.Width * 100); viewHeight = (int)(mapModel.Height * 100); cellWidth = (int)(mapModel.CellSize * 100); cellHeight = (int)(mapModel.CellSize * 100); centerX = (int)(viewWidth / 2); centerY = (int)(viewHeight / 2); SetSizeRequest(viewWidth, viewHeight); }