Ejemplo n.º 1
0
        public clsAlignment()
        {
            MotorTable = new MotorTable();
            motors     = new Dictionary <MotorType, MotorParameters>();
            motors.Add(MotorType.X_Axis, new MotorParameters());
            motors.Add(MotorType.Y_Axis, new MotorParameters());
            motors.Add(MotorType.θ_Axis, new MotorParameters());

            if (!File.Exists(MotorTable.FileName + ".xml"))
            {
                CreateMotorTable();
            }
            LoadMotorTable();
            InitializeEcat();
            motorStatus = new MotorStatus();
            motorStatus.Initialize();

            RunMotor = MotorType.X_Axis;
            RunPoint = 0;

            moveDelayTime.Tick    += MoveDelayTime_Tick;
            moveDelayTime.Interval = 1000;

            alignmentSensor = new clsCognexAS200();
            alignmentSensor.SocketPara.InitializeConnect_ChkRet(false);
            while (alignmentSensor.SocketPara.InitializeConnect_ChkRet() != conProg.process.Success)
            {
                System.Windows.Forms.Application.DoEvents();
            }

            calibrationTable = new DataTable();
            calibrationTable.Columns.Add("X_Axis");
            calibrationTable.Columns.Add("Y_Axis");
            calibrationTable.Columns.Add("θ_Axis");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 創建馬達參數表初始資料
 /// </summary>
 private void CreateMotorTable()
 {
     MotorTable.AddDevice(0, 1, 0, "X_Axis", 0, 1, 1, 3000);
     MotorTable.AddDevice(0, 2, 0, "Y_Axis", 0, 1, 1, 3000);
     MotorTable.AddDevice(0, 3, 0, "θ_Axis", 0, 1, 1, 3000);
     MotorTable.AddPoint("X_Axis", "Home", MotorTablePointType.Forward, 0, 0, 50, 0.5, 0.5);
     MotorTable.AddPoint("Y_Axis", "Home", MotorTablePointType.Forward, 0, 0, 50, 0.5, 0.5);
     MotorTable.AddPoint("θ_Axis", "Home", MotorTablePointType.Forward, 0, 0, 50, 0.5, 0.5);
     MotorTable.Save();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 讀取馬達參數表
        /// </summary>
        private void LoadMotorTable()
        {
            MotorTable.Load();
            MotorParameters temporaryStorage_1 = new MotorParameters();
            MotorParameters temporaryStorage_2 = new MotorParameters();
            MotorParameters temporaryStorage_3 = new MotorParameters();

            MotorTable.GetMotorParameter("X_Axis", ref temporaryStorage_1);
            motors[MotorType.X_Axis] = temporaryStorage_1;
            MotorTable.GetMotorParameter("Y_Axis", ref temporaryStorage_2);
            motors[MotorType.Y_Axis] = temporaryStorage_2;
            MotorTable.GetMotorParameter("θ_Axis", ref temporaryStorage_3);
            motors[MotorType.θ_Axis] = temporaryStorage_3;
        }