diff --git a/Rs.Motion/Base/IAxis.cs b/Rs.Motion/Base/IAxis.cs index 3027f11..3b5ffc2 100644 --- a/Rs.Motion/Base/IAxis.cs +++ b/Rs.Motion/Base/IAxis.cs @@ -81,12 +81,12 @@ namespace Rs.Motion.Base return ErrorCode.Ok; } - public virtual ErrorCode MovePos(double dfPosVal, int percent = 100) + public virtual ErrorCode MovePos(double dfPosVal, int percent = 100,double accTime=0,double decTime=0) { return ErrorCode.Ok; } - public virtual ErrorCode MoveOffset(double dfDistVal, int percent = 100) + public virtual ErrorCode MoveOffset(double dfDistVal, int percent = 100,double accTime=0,double decTime=0) { return ErrorCode.Ok; } diff --git a/Rs.Motion/GugaoEcat/GugaoAxis.cs b/Rs.Motion/GugaoEcat/GugaoAxis.cs index 1dd81d8..bf3ea44 100644 --- a/Rs.Motion/GugaoEcat/GugaoAxis.cs +++ b/Rs.Motion/GugaoEcat/GugaoAxis.cs @@ -263,7 +263,7 @@ namespace Rs.Motion.GugaoEcat /// /// /// - public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 100) + public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 100,double accTime=0,double decTime=0) { if (!cardManager.IsInitialized) return ErrorCode.CardNotInit; @@ -308,8 +308,8 @@ namespace Rs.Motion.GugaoEcat MmToPulse(Config.StopSpeed, out double stopSpeedPulse); float fMaxVel = (float)(maxSpeedPulse * dfPercent / 1000.0);//pulse/ms - float fAcc = (float)(maxSpeedPulse / Config.AccTime / 1000000.0); - float fDec = (float)(maxSpeedPulse / Config.DecTime / 1000000.0); + float fAcc = (float)(maxSpeedPulse / (accTime == 0 ? Config.AccTime : accTime) / 1000000.0); + float fDec = (float)(maxSpeedPulse / (decTime == 0 ? Config.DecTime : decTime) / 1000000.0); float fStart = (float)(minSpeedPulse / 1000.0); float fStop = (float)(stopSpeedPulse / 1000.0); apiResult = mc_ecat.GTN_PrfTrap(core, (short)Config.AxisId);//设置运动模式为点位运动 @@ -356,7 +356,7 @@ namespace Rs.Motion.GugaoEcat /// /// /// - public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100) + public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100, double accTime = 0, double decTime = 0) { if (!cardManager.IsInitialized) { diff --git a/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs b/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs index 02806ca..cf2203a 100644 --- a/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs +++ b/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs @@ -300,7 +300,7 @@ namespace Rs.Motion.GugaoPulse /// /// /// - public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 4) + public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 4,double accTime=0,double decTime=0) { if (!cardManager.IsInitialized) return ErrorCode.CardNotInit; @@ -348,8 +348,8 @@ namespace Rs.Motion.GugaoPulse MmToPulse(Config.StopSpeed, out double stopSpeedPulse); float fMaxVel = (float)(maxSpeedPulse * dfPercent / 1000.0);//pulse/ms - float fAcc = (float)(maxSpeedPulse / Config.AccTime / 1000000.0); - float fDec = (float)(maxSpeedPulse / Config.DecTime / 1000000.0); + float fAcc = (float)(maxSpeedPulse / (accTime == 0 ? Config.AccTime : accTime) / 1000000.0); + float fDec = (float)(maxSpeedPulse / (decTime == 0 ? Config.DecTime : decTime) / 1000000.0); float fStart = (float)(minSpeedPulse / 1000.0); float fStop = (float)(stopSpeedPulse / 1000.0); apiResult = mc_pulse.GT_PrfTrap((short)Config.CardId, (short)Config.AxisId);//设置运动模式为点位运动 @@ -400,7 +400,7 @@ namespace Rs.Motion.GugaoPulse /// /// /// - public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100) + public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100, double accTime = 0, double decTime = 0) { if (!cardManager.IsInitialized) { diff --git a/Rs.Motion/Ztm/ZtmAxis.cs b/Rs.Motion/Ztm/ZtmAxis.cs index 9ac649a..c249a25 100644 --- a/Rs.Motion/Ztm/ZtmAxis.cs +++ b/Rs.Motion/Ztm/ZtmAxis.cs @@ -268,7 +268,7 @@ namespace Rs.Motion.GugaoEcat /// /// /// - public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 100) + public override ErrorCode MovePos(double dfPosVal, int nSpeedPercent = 100, double accTime = 0, double decTime = 0) { if (!cardManager.IsInitialized) return ErrorCode.CardNotInit; @@ -316,8 +316,8 @@ namespace Rs.Motion.GugaoEcat float fMaxVel = (float)(maxSpeedPulse * dfPercent / 1000.0);//pulse/ms //float fAcc = (float)(maxSpeedPulse / Config.AccTime / 1000000.0); //float fDec = (float)(maxSpeedPulse / Config.DecTime / 1000000.0); - float fAcc = (float)(fMaxVel / (Config.AccTime * 1000)); - float fDec = (float)(fMaxVel / (Config.DecTime * 1000)); + float fAcc = (float)(fMaxVel / (accTime==0?Config.AccTime:accTime * 1000)); + float fDec = (float)(fMaxVel / (decTime==0?Config.DecTime:decTime * 1000)); float fStart = (float)(minSpeedPulse / 1000.0); float fStop = (float)(stopSpeedPulse / 1000.0); m_apiResult = ZTM.ZT_MoveA(Config.CardMc, (short)Config.AxisId, (int)dfPos, fStart, fMaxVel, fAcc, fDec, fStop, (ushort)(Config.STime * 1000.0)); @@ -338,7 +338,7 @@ namespace Rs.Motion.GugaoEcat /// /// /// - public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100) + public override ErrorCode MoveOffset(double dfDistVal, int nSpeedPercent = 100, double accTime = 0, double decTime = 0) { if (!cardManager.IsInitialized) {