Example #1
0
 private static void TestCamera()
 {
     Camera trayC = new Camera();
     trayC.ConnectionString = new Uri(@"http://192.168.1.8:8080/photoaf.jpg");
     Camera sort = new Camera();
     sort.ConnectionString = new Uri(@"http://192.168.1.19:8080/photoaf.jpg");
     //c.SetParameters(new Dictionary<string, string> { { "Name", "TestCam1" }, { "ConnectionString", "http://192.168.0.11:8080/photo.jpg" } });//"http://192.168.0.11:8080/photo.jpg"
     trayC.Initialise();
     //sort.Initialise();
        /* TrayDetectorVision tray = new TrayDetectorVision(trayC);
     while (true)
     {
         Tray<Tablet> Tray = new Tray<Tablet>();
          bool colr = tray.GetTabletsInTray(out Tray);
     }*/
     SorterVision sorter = new SorterVision(sort);
     sorter.Calibrate();
     while (true)
     {
         List<Tablet> tabletList = sorter.GetVisibleTablets();
     }
     //CvInvoke.cvWaitKey(0);
 }
Example #2
0
        public Sorter(ClusterConfig config)
            : base(config)
        {
            this.MaxShakeRetryAttempts = 1;
            this._vision = new SorterVision(config.Cameras["SorterCamera"] as Camera);
            this._robot = config.Robots[typeof(SorterRobot)] as SorterRobot;
            this._cancelTokenSource = new CancellationTokenSource();

            if (_vision == null)
            {
                throw new ArgumentException("Could not create SorterVision");
            }
            if (_robot == null)
            {
                throw new ArgumentException("Could not retrieve a SorterRobot from ClusterConfig");
            }

            _actionMap = new Dictionary<SorterAction, Action<SorterParams>>()
            {
                { SorterAction.LoadToBuffer, (x) => LoadToBufferAsync() },
                { SorterAction.LoadToConveyor, (x) => LoadToConveyorAsync() },
                { SorterAction.Sort, (x) => SortAsync(x.Magazine) }
            };
        }