From 0214fddc04dc39acef002528367219d548471ae0 Mon Sep 17 00:00:00 2001 From: lhiven <236881222@qq.com> Date: Sat, 11 Nov 2023 09:02:32 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E5=9B=9E=E5=8E=9F?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E8=BD=B4=E7=8A=B6=E6=80=81=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=202=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E6=AF=94=E8=BE=83=E5=90=8E=E6=AF=94=E8=BE=83=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9A=84=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.Motion/Base/IAxis.cs | 7 +++ Rs.Motion/GugaoPulse/GugaoPulseAxis.cs | 84 ++++++++++++++------------ 2 files changed, 51 insertions(+), 40 deletions(-) diff --git a/Rs.Motion/Base/IAxis.cs b/Rs.Motion/Base/IAxis.cs index bf2791e..ac568bf 100644 --- a/Rs.Motion/Base/IAxis.cs +++ b/Rs.Motion/Base/IAxis.cs @@ -165,6 +165,13 @@ namespace Rs.Motion.Base return ErrorCode.Ok; } + public virtual ErrorCode CompareStatus(out short _pStatus, out int _pCount) + { + _pStatus = 0; + _pCount = 0; + return ErrorCode.Ok; + } + public virtual ErrorCode ComparePulse(ushort channel) { return ErrorCode.Ok; diff --git a/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs b/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs index f76d5a8..066feb4 100644 --- a/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs +++ b/Rs.Motion/GugaoPulse/GugaoPulseAxis.cs @@ -1218,46 +1218,37 @@ namespace Rs.Motion.GugaoPulse { return ErrorCode.Ok; } - //if (!m_bIsInitialized) - //{ - // return ErrorCode.AXIS_NOT_INIT; - //} - //ErrorCode err = GetEmgStatus(out bool bEmg); - //if (err > ErrorCode.OK) - //{ - // return err; - //} - //if (bEmg) - //{ - // return ErrorCode.EMERGENCY; - //} - //err = GetAlarmStatus(out bool bAlarm); - //if (err > ErrorCode.OK) - //{ - // return err; - //} - //if (bAlarm) - //{ - // return ErrorCode.ALARM; - //} - //err = IsEnable(out bool bEnable); - //if (err > ErrorCode.OK) - //{ - // return err; - //} - //if (!bEnable) - //{ - // return ErrorCode.SERVO_OFF; - //} - //err = IsStop(out bool bStop); - //if (err > ErrorCode.OK) - //{ - // return err; - //} - //if (!bStop) - //{ - // return ErrorCode.NOT_STOP; - //} + if (!cardManager.IsInitialized) + { + return ErrorCode.CardNotInit; + } + ErrorCode err = GetAlarmStatus(out bool bAlarm); + if (err > ErrorCode.Ok) + { + return err; + } + if (bAlarm) + { + return ErrorCode.Alarm; + } + err = IsEnable(out bool bEnable); + if (err > ErrorCode.Ok) + { + return err; + } + if (!bEnable) + { + return ErrorCode.ServoOff; + } + err = IsStop(out bool bStop); + if (err > ErrorCode.Ok) + { + return err; + } + if (!bStop) + { + return ErrorCode.Moving; + } Thread t = t = new Thread(new ParameterizedThreadStart(DefaultHome)); HomeStatus = EHomeStatus.Start; t.Name = Config.AxisName + " homing thread"; @@ -1612,6 +1603,19 @@ namespace Rs.Motion.GugaoPulse { return ErrorCode.Fail; } + + return ErrorCode.Ok; + } + + public override ErrorCode CompareStatus(out short _pStatus,out int _pCount) + { + _pStatus = 0; + _pCount = 0; + apiResult = mc_pulse.GT_CompareStatus((short)Config.CardId, out _pStatus, out _pCount); + if(apiResult!= 0) + { + return ErrorCode.Fail; + } return ErrorCode.Ok; }