Esempio n. 1
0
        private short GoHomeWithInput(int timeout, HomeMode homeMode, bool direction, HostarSpeed goLimit, HostarSpeed goHome, IOInput limit)
        {
            short     rtn       = 0;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            this.StopAxis();
            this.GetAxisSts();

            #region 到轴的极限位置
            if (!limit.GetIO())
            {
                rtn = this.Jog(goLimit, !direction); // 到极限
                while (!limit.GetIO())
                {
                    Thread.Sleep(1);
                    this.GetAxisSts();
                    if (stopwatch.ElapsedMilliseconds > timeout || MotionHelper.Instance.Emg)
                    {
                        stopwatch.Stop();
                        this.StopAxis();
                        this.ClearAxisSts();
                        return(-1);
                    }
                }
            }

            this.StopAxis();
            #endregion
            Thread.Sleep(200);

            #region 开始回原点
            stopwatch.Reset();
            stopwatch.Start();
            var homeSpeed = goHome.GetActSpeed(this.AxisRatio);
            rtn += this.AxisGoHome(homeMode, direction, homeSpeed.StartSpeed, homeSpeed.MaxSpeed, homeSpeed.AccTime, homeSpeed.DecTime);
            Thread.Sleep(200);
            this.GetAxisSts();

            while (this.bAxisIsHoming || this.bAxisIsRunning)
            {
                Thread.Sleep(1);
                this.GetAxisSts();
                if (stopwatch.ElapsedMilliseconds > timeout || MotionHelper.Instance.Emg)
                {
                    stopwatch.Stop();
                    this.StopAxis();
                    this.ClearAxisSts();
                    return(-1);
                }
            }

            this.StopAxis();
            this.ClearAxisSts();
            this.ZeroAxis();
            stopwatch.Stop();
            return(rtn);

            #endregion
        }
 /// <summary>
 /// 轴回零
 /// </summary>
 /// <param name="uHomeMode">回零模式</param>
 /// <param name="IsDirP">是否正向</param>
 /// <param name="LowVel">最低速度</param>
 /// <param name="HighVel">最高速度</param>
 /// <param name="acc">加速度</param>
 /// <param name="dec">减速度</param>
 /// <returns></returns>
 public short AxisGoHome(HomeMode uHomeMode, bool direction, double LowVel, double HighVel, double acc, double dec)
 {
     lock (myobj)
     {
         short rtn = AxisSetValue(LowVel, HighVel, acc, dec);
         rtn += (short)Motion.mAcm_AxHome(AxisHandle[CardNO][AxisNo], (ushort)uHomeMode, (ushort)(direction ? 0 : 1));
         return(rtn);
     }
 }
Esempio n. 3
0
 private void cbHomeMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cbHomeMode.SelectedIndex > -1)
     {
         homemode = (HomeMode)(cbHomeMode.SelectedIndex);
         if (homeModeChanged != null)
         {
             homeModeChanged(channel, homemode);
         }
     }
 }
Esempio n. 4
0
 public bool SetHomeMode(HomeMode mode)
 {
     if (connected)
     {
         homeMode = mode;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 5
0
        public ParameterM314(string folderPath, string fileName)
            : base(folderPath, fileName)
        {
            strVelA = 50;
            devVelA = 100;
            accVelA = 0.1;
            decVelA = 0.1;

            strVelM = 5;
            devVelM = 10;
            accVelM = 0.1;
            decVelM = 0.1;

            oPRDevVelH   = 50;
            creepStrVelH = 1;
            creepDevVelH = 5;
            creepAccVelH = 0.1;
            creepDecVelH = 0.1;
            offsetH      = 0;

            jogMicroSpeed = 0.1;
            jogLowSpeed   = 1;
            jogMidSpeed   = 5;
            jogHighSpeed  = 10;
            jogMaxSpeed   = 20;

            distPerRole  = 1;
            pulsePerRole = 1;

            homeMode  = HomeMode.OnePoint;
            pulseMode = PulseMode.CW_CCW_Falling_edge;
            encMode   = EncMode.X4;

            encDir             = 0;
            logicORG           = true;
            logicEZ            = false;
            logicSD            = true;
            logicLTC           = true;
            clearDelay         = 1;
            latchSource        = 0;
            doubleHomeInitKey  = true;
            isActive           = true;
            enabled            = true;
            homeTimeout        = 600000;
            doubleHomeTimeout  = 600000;
            softLimitEnabled   = false;
            inPositionPrecise  = 0.001;
            stopCmdWaitSeconds = 0;
        }
        /// <summary>
        /// 轴回零
        /// </summary>
        /// <param name="uHomeMode">回零模式</param>
        /// <param name="IsDirP">是否正向</param>
        /// <param name="LowVel">最低速度</param>
        /// <param name="HighVel">最高速度</param>
        /// <param name="acc">加速度</param>
        /// <param name="dec">减速度</param>
        /// <returns></returns>
        public short AxisGoHome(HomeMode uHomeMode, bool IsDirP, double LowVel, double HighVel, double acc, double dec)
        {
            ushort uDirMode = 0;

            if (IsDirP)
            {
                uDirMode = 0;
            }
            else
            {
                uDirMode = 1;
            }
            short rtn = AxisSetValue(LowVel, HighVel, acc, dec);

            rtn += (short)Motion.mAcm_AxHome(ipAxisHandle[AxisNo - 1], (ushort)uHomeMode, uDirMode);
            return(rtn);
        }
        /// <summary>
        /// 轴回零
        /// </summary>
        /// <param name="uHomeMode">回零模式</param>
        /// <param name="IsDirP">是否正向</param>
        /// <param name="velmode">速度模式</param>
        /// <returns></returns>
        public short AxisGoHome(HomeMode uHomeMode, bool IsDirP, VelMode velmode)
        {
            this.CleSts(true);
            ushort uDirMode = 0;

            if (IsDirP)
            {
                uDirMode = 0;
            }
            else
            {
                uDirMode = 1;
            }
            short rtn = AxisSetValue(velmode);

            rtn += (short)Motion.mAcm_AxHome(ipAxisHandle[AxisNo - 1], (ushort)uHomeMode, uDirMode);
            return(rtn);
        }
Esempio n. 8
0
 public ParameterL122M2X4(string folderPath, string fileName)
     : base(folderPath, fileName)
 {
     isActive           = true;
     strVelA            = 50;
     devVelA            = 100;
     accVelA            = 0.1;
     decVelA            = 0.1;
     strVelM            = 5;
     devVelM            = 10;
     accVelM            = 0.1;
     decVelM            = 0.1;
     creepStrVelH       = 1;
     creepDevVelH       = 5;
     creepAccVelH       = 0.1;
     creepDecVelH       = 0.1;
     oPRDevVelH         = 50;
     offsetH            = 0;
     jogMicroSpeed      = 0.1;
     jogLowSpeed        = 1;
     jogMidSpeed        = 5;
     jogHighSpeed       = 10;
     jogMaxSpeed        = 20;
     distPerRole        = 1;
     pulsePerRole       = 1;
     maxVel             = 20000;
     homeMode           = HomeMode.OnePoint;
     pulseMode          = PulseMode.AB_Phase;
     encMode            = EncMode.CW_CCW;
     encDir             = 0;
     logicORG           = true;
     logicZ             = false;
     logicSD            = true;
     logicLTC           = true;
     clearDelay         = 1;
     softLimitEnabled   = false;
     inPositionPrecise  = 0.001;
     stopCmdWaitSeconds = 0;
 }
 public static extern bool Show(HomeMode mode);
Esempio n. 10
0
        public short MoveHome(short cardId, short axisId, HomeMode mode, short moveDir, short indexDir, double velH, double velL, double acc, int homeOffset, int searchHomeDis, int searchIndexDis, int escapeStep)
        {
            short t = mc.HOME_MODE_HOME;

            switch (mode)
            {
            case HomeMode.Limit:
                t = mc.HOME_MODE_LIMIT;
                break;

            case HomeMode.Limit_Home:
                t = mc.HOME_MODE_LIMIT_HOME;
                break;

            case HomeMode.Limit_Index:
                t = mc.HOME_MODE_LIMIT_INDEX;
                break;

            case HomeMode.Limit_Home_Index:
                t = mc.HOME_MODE_LIMIT_HOME_INDEX;
                break;

            case HomeMode.Home:
                t = mc.HOME_MODE_HOME;
                break;

            case HomeMode.Home_Index:
                t = mc.HOME_MODE_HOME_INDEX;
                break;

            case HomeMode.Index:
                t = mc.HOME_MODE_INDEX;
                break;

            default:
                break;
            }

            mc.THomePrm homePrm;
            short       rtn = mc.GT_GetHomePrm(cardId, axisId, out homePrm);

            if (rtn != 0)
            {
                return(rtn);
            }
            homePrm.mode                = t;
            homePrm.moveDir             = moveDir;
            homePrm.indexDir            = indexDir;
            homePrm.edge                = 0;
            homePrm.triggerIndex        = -1;
            homePrm.velHigh             = velH;
            homePrm.velLow              = velL;
            homePrm.acc                 = acc;
            homePrm.dec                 = acc;
            homePrm.smoothTime          = 0;
            homePrm.homeOffset          = homeOffset;
            homePrm.searchHomeDistance  = searchHomeDis;
            homePrm.searchIndexDistance = searchIndexDis;
            homePrm.escapeStep          = escapeStep;
            //clear capture status
            rtn = mc.GT_ClearCaptureStatus(cardId, axisId);
            if (rtn != 0)
            {
                return(rtn);
            }
            //set trap move
            rtn = mc.GT_PrfTrap(cardId, axisId);
            if (rtn != 0)
            {
                return(rtn);
            }
            //move home
            rtn = mc.GT_GoHome(cardId, axisId, ref homePrm);
            if (rtn != 0)
            {
                return(rtn);
            }
            return(0);
        }