|
|
@ -36,81 +36,83 @@ namespace Rs.Motion.GugaoEcat
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public override ErrorCode Init()
|
|
|
|
public override ErrorCode Init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} init");
|
|
|
|
if (!cardManager.IsInitialized)
|
|
|
|
if (!cardManager.IsInitialized)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName}'s card IsInitialized");
|
|
|
|
return ErrorCode.CardNotInit;
|
|
|
|
return ErrorCode.CardNotInit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HomeStatus = EHomeStatus.NotStart;
|
|
|
|
HomeStatus = EHomeStatus.NotStart;
|
|
|
|
m_apiResult = ZTM.ZT_SetPOTOn(Config.CardMc, (short)Config.AxisId, (short)((Config.EnableEL&0x01)));
|
|
|
|
m_apiResult = ZTM.ZT_SetPOTOn(Config.CardMc, (short)Config.AxisId, (short)((Config.EnableEL&0x01)));
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetPOTOn ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetPOTOn ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetNOTOn(Config.CardMc, (short)Config.AxisId, (short)((Config.EnableEL>>1)&0x01));
|
|
|
|
m_apiResult = ZTM.ZT_SetNOTOn(Config.CardMc, (short)Config.AxisId, (short)((Config.EnableEL>>1)&0x01));
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetNOTOn ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetNOTOn ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetPOTPol(Config.CardMc, (short)Config.AxisId, (short)Config.ElLogic);
|
|
|
|
m_apiResult = ZTM.ZT_SetPOTPol(Config.CardMc, (short)Config.AxisId, (short)Config.ElLogic);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetPOTPol ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetPOTPol ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetNOTPol(Config.CardMc, (short)Config.AxisId, (short)Config.ElLogic);
|
|
|
|
m_apiResult = ZTM.ZT_SetNOTPol(Config.CardMc, (short)Config.AxisId, (short)Config.ElLogic);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetNOTPol ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetNOTPol ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetAlarmOn(Config.CardMc, (short)Config.AxisId, (short)(Config.EnableAlarm));
|
|
|
|
m_apiResult = ZTM.ZT_SetAlarmOn(Config.CardMc, (short)Config.AxisId, (short)(Config.EnableAlarm));
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetAlarmOn ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetAlarmOn ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetAlarmPol(Config.CardMc, (short)Config.AxisId, (short)Config.AlarmLogic);
|
|
|
|
m_apiResult = ZTM.ZT_SetAlarmPol(Config.CardMc, (short)Config.AxisId, (short)Config.AlarmLogic);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetAlarmPol ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetAlarmPol ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetHomePol(Config.CardMc, (short)Config.AxisId, (short)Config.HomeOrgLogic);
|
|
|
|
m_apiResult = ZTM.ZT_SetHomePol(Config.CardMc, (short)Config.AxisId, (short)Config.HomeOrgLogic);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetHomePol ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetHomePol ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetPulseRatio(Config.CardMc, (short)Config.AxisId, 1U, 1U);
|
|
|
|
m_apiResult = ZTM.ZT_SetPulseRatio(Config.CardMc, (short)Config.AxisId, 1U, 1U);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetPulseRatio ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetPulseRatio ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetGearRatio(Config.CardMc, (short)Config.AxisId, 1U, 1U);
|
|
|
|
m_apiResult = ZTM.ZT_SetGearRatio(Config.CardMc, (short)Config.AxisId, 1U, 1U);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetGearRatio ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetGearRatio ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetEncoderOn(Config.CardMc, (short)Config.AxisId, (short)(Config.EnableEncoder));
|
|
|
|
m_apiResult = ZTM.ZT_SetEncoderOn(Config.CardMc, (short)Config.AxisId, (short)(Config.EnableEncoder));
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetEncoderOn ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetEncoderOn ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetPulseMode(Config.CardMc, (short)Config.AxisId, (short)Config.PulseOutMode, 0, 0);
|
|
|
|
m_apiResult = ZTM.ZT_SetPulseMode(Config.CardMc, (short)Config.AxisId, (short)Config.PulseOutMode, 0, 0);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetPulseMode ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetPulseMode ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_apiResult = ZTM.ZT_SetEncoderPol(Config.CardMc, (short)Config.AxisId, Config.PulseOutDir);
|
|
|
|
m_apiResult = ZTM.ZT_SetEncoderPol(Config.CardMc, (short)Config.AxisId, Config.PulseOutDir);
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
if (m_apiResult != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.MoveLog($"axis {Config.AxisName} ZT_SetEncoderPol ret={m_apiResult}");
|
|
|
|
LogHelper.Debug($"axis {Config.AxisName} ZT_SetEncoderPol ret={m_apiResult}");
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
return ErrorCode.Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//m_LastErrorCode = ZTM.ZT_SetEncoderIndexPol(m_axis_config.CardMc, m_axis_config.AxisNum, m_axis_config.encoder_config.pulse_outindexdirection);
|
|
|
|
//m_LastErrorCode = ZTM.ZT_SetEncoderIndexPol(m_axis_config.CardMc, m_axis_config.AxisNum, m_axis_config.encoder_config.pulse_outindexdirection);
|
|
|
|