Exemple #1
0
        static void Main3(string[] args)
        {
            SpiralLab.Core.Initialize();

            #region initialize RTC
            //var rtc = new RtcVirtual(0); //create Rtc for dummy (가상 RTC 카드)
            var rtc = new Rtc5(0); //create Rtc5 controller
            //var rtc = new Rtc6(0); //create Rtc6 controller
            //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //Rtc6 Ethernet
            //var rtc = new Rtc6SyncAxis(0, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "syncAxis", "syncAXISConfig.xml")); //Scanlab XLSCAN

            float fov            = 60.0f;                            // scanner field of view : 60mm
            float kfactor        = (float)Math.Pow(2, 20) / fov;     // k factor (bits/mm) = 2^20 / fov
            var   correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5");
            rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // correction file (스캐너 보정 파일)
            #endregion

            // 헤더 정보를 조회할 보정 파일 RTC 내부 메모리 (테이블)로 로드
            var targetCorrectionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "D2_1128.ct5");
            rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table3, targetCorrectionFile);
            var rtcExt = rtc as IRtcExtension;
            Debug.Assert(rtcExt != null);

            ConsoleKeyInfo key;
            do
            {
                Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)");
                Console.WriteLine("");
                Console.WriteLine("'H' : correction file header information");
                Console.WriteLine("'Q' : quit");
                Console.WriteLine("");
                Console.Write("select your target : ");
                key = Console.ReadKey(false);
                if (key.Key == ConsoleKey.Q)
                {
                    break;
                }
                Console.WriteLine("");
                switch (key.Key)
                {
                case ConsoleKey.H:
                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CorrectionTable, out double dimension);
                    if (0 == dimension)
                    {
                        Console.WriteLine($"Dimension : 2D");
                    }
                    else
                    {
                        Console.WriteLine($"Dimension : 3D");
                    }
                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.KFactor, out double internalKFactor);
                    Console.WriteLine($"K-Factor : {internalKFactor}");

                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.FocalLengthOrWorkingDistance, out double len);
                    Console.WriteLine($"F-Length/Working Distance : {len}");

                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.StretchFactorX, out double stretchX);
                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.StretchFactorY, out double stretchY);
                    Console.WriteLine($"3D : Stretch Factor : X= {stretchX}, Y= {stretchY}");

                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientA, out double coefA);
                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientB, out double coefB);
                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.CoefficientC, out double coefC);
                    Console.WriteLine($"3D : Parabolic Equation : Zout = {coefA} + l * {coefB} + l^2 * {coefC}");

                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.AngleCalibration, out double angleCalibration);
                    Console.WriteLine($"Angle Calibration : {angleCalibration}");

                    rtcExt.CtlLoadedCorrectionInfo(CorrectionTableIndex.Table3, CorrectionFileHeaderParam.ImageFieldSizeLimited, out double fieldSizeLimited);
                    if (0 == fieldSizeLimited)
                    {
                        Console.WriteLine($"Image Field Size : Not clipped");
                    }
                    else
                    {
                        Console.WriteLine($"Image Field Size : Clipped");
                    }

                    Console.WriteLine(Environment.NewLine);
                    break;
                }
            } while (true);
        }
Exemple #2
0
        static void Main2(string[] args)
        {
            SpiralLab.Core.Initialize();

            #region initialize RTC
            //var rtc = new RtcVirtual(0); //create Rtc for dummy
            var rtc = new Rtc5(0); //create Rtc5 controller
            //var rtc = new Rtc6(0); //create Rtc6 controller
            //var rtc = new Rtc6Ethernet(0, "192.168.0.100", "255.255.255.0"); //실험적인 상태 (Scanlab Rtc6 Ethernet 제어기)

            float fov            = 60.0f;                            // scanner field of view : 60mm
            float kfactor        = (float)Math.Pow(2, 20) / fov;     // k factor (bits/mm) = 2^20 / fov
            var   correctionFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5");
            rtc.Initialize(kfactor, LaserMode.Yag1, correctionFile); // 스캐너 보정 파일 지정 : correction file
            rtc.CtlFrequency(50 * 1000, 2);                          // laser frequency : 50KHz, pulse width : 2usec
            rtc.CtlSpeed(100, 100);                                  // default jump and mark speed : 100mm/s
            rtc.CtlDelay(10, 100, 200, 200, 0);                      // scanner and laser delays

            //이미 table1 에 로드 및 선택 완료 (initialize 의 인자에서 처리됨)
            //var correctionFile1 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5");
            //rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table1, correctionFile1);
            var correctionFile2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "correction", "cor_1to1.ct5");
            rtc.CtlLoadCorrectionFile(CorrectionTableIndex.Table2, correctionFile2);
            rtc.CtlSelectCorrection(CorrectionTableIndex.Table1, CorrectionTableIndex.Table2);
            #endregion

            #region initialize Laser (virtual)
            var laser = new LaserVirtual(0, "virtual", 20);  // virtual laser source with max 20W power (최대 출력 20W 의 가상 레이저 소스 생성)
            //var laser = new IPGYLP(0, "IPG YLP", 1, 20);
            //var laser = new JPTTypeE(0, "JPT Type E", 1, 20);
            //var laser = new SPIG4(0, "SPI G3/4", 1, 20);
            //var laser = new PhotonicsIndustryDX(0, "PI", 1, 20);
            //var laser = new AdvancedOptoWaveFotia(0, "Fotia", 1, 20);
            //var laser = new CoherentAviaLX(0, "Avia LX", 1, 20);
            laser.Rtc = rtc;
            laser.Initialize();
            laser.CtlPower(2);
            #endregion

            ConsoleKeyInfo key;
            do
            {
                Console.WriteLine($"{Environment.NewLine}");
                Console.WriteLine("Testcase for spirallab.sirius. powered by [email protected] (http://spirallab.co.kr)");
                Console.WriteLine($"{Environment.NewLine}");
                Console.WriteLine("'D' : draw circle with dual head offset");
                Console.WriteLine("'Q' : quit");
                Console.WriteLine($"{Environment.NewLine}");
                Console.Write("select your target : ");
                key = Console.ReadKey(false);
                if (key.Key == ConsoleKey.Q)
                {
                    break;
                }
                Console.WriteLine($"{Environment.NewLine}");
                Console.WriteLine("WARNING !!! LASER IS BUSY ...");
                var timer = Stopwatch.StartNew();
                switch (key.Key)
                {
                case ConsoleKey.D:
                    //개별 헤드에 오프셋 및 회전 처리
                    var rtcDualHead = rtc as IRtcDualHead;
                    rtcDualHead.CtlHeadOffset(ScannerHead.Primary, new Vector2(5, 0), 0);
                    rtcDualHead.CtlHeadOffset(ScannerHead.Secondary, new Vector2(-5, 0), 0);
                    DrawCircle(laser, rtc);
                    // 원복
                    rtcDualHead.CtlHeadOffset(ScannerHead.Primary, Vector2.Zero, 0);
                    rtcDualHead.CtlHeadOffset(ScannerHead.Secondary, Vector2.Zero, 0);
                    break;
                }

                Console.WriteLine($"Processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s");
            } while (true);

            rtc.Dispose();
        }