コード例 #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
ファイル: RCCMSystem.cs プロジェクト: jmal0/RCCM
        /// <summary>
        /// Initialize motors according to settings
        /// </summary>
        /// <param name="axTrioPC">ActiveX control for communicating with trio controller</param>
        private void initializeMotion(AxTrioPC axTrioPC)
        {
            // Create handler for Trio controller communication
            this.triopc = new TrioController(axTrioPC);

            // Initialize each motor and apply settings
            this.motors = new Dictionary <string, Motor>();
            foreach (string motorName in RCCMSystem.AXES)
            {
                // If controller is not open, all motors must be virtual
                if (!this.triopc.Open && ((string)Program.Settings.json[motorName]["type"]).Contains("stepper"))
                {
                    this.motors.Add(motorName, new VirtualMotor());
                    continue;
                }
                switch ((string)Program.Settings.json[motorName]["type"])
                {
                case "virtual":
                    this.motors.Add(motorName, new VirtualMotor());
                    break;

                case "stepper":
                    this.motors.Add(motorName, new TrioStepperMotor(this.triopc, (short)Program.Settings.json[motorName]["axis number"]));
                    break;

                case "stepper z 1":
                    TrioStepperZMotor zMotor1 = new TrioStepperZMotor(this.triopc, (short)Program.Settings.json[motorName]["axis number"],
                                                                      this, RCCMStage.RCCM1);
                    this.motors.Add(motorName, zMotor1);
                    this.LensController.Motor1 = zMotor1;
                    break;

                case "stepper z 2":
                    TrioStepperZMotor zMotor2 = new TrioStepperZMotor(this.triopc, (short)Program.Settings.json[motorName]["axis number"],
                                                                      this, RCCMStage.RCCM2);
                    this.motors.Add(motorName, zMotor2);
                    this.LensController.Motor2 = zMotor2;
                    break;

                default:
                    throw new NotImplementedException("Unknown motor type setting encountered for " + motorName);
                }
            }
            // Apply settings
            ApplyMotorSettings();
        }
コード例 #3
0
ファイル: TrioStepperMotor.cs プロジェクト: jmal0/RCCM
 /// <summary>
 /// Create a trio motor object. Settings are not initialized in this function
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="axisNum"></param>
 public TrioStepperMotor(TrioController controller, short axisNum)
 {
     this.controller = controller;
     this.axisNum    = axisNum;
     this.Jogging    = false;
 }