コード例 #1
0
 /// <summary>
 /// Create a controlled z actuator
 /// </summary>
 /// <param name="controller">RCCM Trio controller object</param>
 /// <param name="axisNum">Number of port where axis is connected to Trio controller</param>
 /// <param name="rccm">The RCCM object</param>
 /// <param name="stage">Enum value of the set of fine actuators containing this actuator</param>
 public TrioStepperZMotor(TrioController controller, short axisNum, RCCMSystem rccm, RCCMStage stage)
 {
     this.controller = controller;
     this.axisNum    = axisNum;
     this.Jogging    = false;
     // Create height function reference from lens controller height property
     if (stage == RCCMStage.RCCM1)
     {
         this.height = delegate() { return(rccm.LensController.Height1); };
     }
     else
     {
         this.height = delegate() { return(rccm.LensController.Height2); };
     }
     // Create function reference that computes height of panel at current location
     this.minPosition = delegate()
     {
         PointF pos = rccm.GetNFOVLocation(stage, CoordinateSystem.Local);
         return(rccm.GetPanelDistance(pos.X, pos.Y));
     };
     this.commandHeight = this.height();
     // Start background thread
     this.bw                 = new BackgroundWorker();
     this.bw.DoWork         += new DoWorkEventHandler(this.heightAdjustLoop);
     this.adjustThreadExited = new AutoResetEvent(false);
     this.adjust             = true;
     this.adjustThreadPaused = false;
     this.bw.RunWorkerAsync();
 }
コード例 #2
0
ファイル: Measurement.cs プロジェクト: jmal0/RCCM
        /// <summary>
        /// Create a measurement
        /// </summary>
        /// <param name="crack">Crack containing this measurement</param>
        /// <param name="rccm">Reference to RCCM object</param>
        /// <param name="pixelX">Pixel horizontal position within image to measurement</param>
        /// <param name="pixelY">Pixel vertical position within image to measurement</param>
        public Measurement(MeasurementSequence crack, RCCMSystem rccm, double pixelX, double pixelY)
        {
            // Get timestamp and save camera image
            ICamera   camera;
            string    stage;
            RCCMStage stageEnum;

            switch (crack.Camera)
            {
            case "nfov 1":
                stage     = "fine 1 ";
                stageEnum = RCCMStage.RCCM1;
                camera    = rccm.NFOV1;
                break;

            case "nfov 2":
                stage     = "fine 2 ";
                stageEnum = RCCMStage.RCCM2;
                camera    = rccm.NFOV2;
                break;

            case "wfov 1":
                stage     = "fine 1 ";
                stageEnum = RCCMStage.RCCM1;
                camera    = rccm.WFOV1;
                break;

            default:
                stage     = "fine 2 ";
                stageEnum = RCCMStage.RCCM2;
                camera    = rccm.WFOV2;
                break;
            }
            this.Timestamp = string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt.fff}", DateTime.Now);
            this.Filename  = this.Timestamp + ".bmp";
            camera.Snap(crack.SaveDir + "\\" + this.Filename);

            // Info from cycle counter
            this.Cycle    = rccm.Counter.Cycle;
            this.Pressure = rccm.Counter.GetPressure();

            // Actuator positions
            this.CoarseX = rccm.motors["coarse X"].GetPos();
            this.CoarseY = rccm.motors["coarse Y"].GetPos();
            this.FineX   = rccm.motors[stage + "X"].GetPos();
            this.FineY   = rccm.motors[stage + "Y"].GetPos();
            this.FineZ   = rccm.motors[stage + "Z"].GetActuatorPos();
            this.Height  = stage == "fine 1 " ? rccm.LensController.Height1 : rccm.LensController.Height2;

            // Convert pixel position to coordinates in global and panel coordinate systems
            this.PixelX = pixelX;
            this.PixelY = pixelY;
            PointF globalPosition = rccm.GetNFOVLocation(stageEnum, CoordinateSystem.Global);

            this.X = globalPosition.X + this.PixelX;
            this.Y = globalPosition.Y + this.PixelY;
            PointF panelPosition = rccm.GlobalVectorToPanelVector(this.X, this.Y);

            this.PanelX = globalPosition.X + this.PixelX;
            this.PanelY = globalPosition.Y + this.PixelY;
        }