diff --git a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
index 1cda703..2293826 100644
--- a/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
+++ b/HSI_HexagonMI_EF3/HSI_HexagonMI_EF3.vcxproj
@@ -70,7 +70,7 @@
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;$(LocalDebuggerWorkingDirectory)\ACS;%(AdditionalLibraryDirectories)
- copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI.dll"
+ copy "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)HSI_SEVENOCEAN_EF1_CsTest\bin\Debug\HSI_Sevenocean_EF3.dll"
copy "$(TargetDir)$(ProjectName).dll" "C:\Program Files\Hexagon\Metus\Metus-7.10.1967\HSI_Sevenocean_EF3.dll"
diff --git a/HSI_HexagonMI_EF3/HSI_Motion.cpp b/HSI_HexagonMI_EF3/HSI_Motion.cpp
index d4742c6..825bdc6 100644
--- a/HSI_HexagonMI_EF3/HSI_Motion.cpp
+++ b/HSI_HexagonMI_EF3/HSI_Motion.cpp
@@ -228,9 +228,11 @@ HSI_Motion::HSI_Motion()
{
m_SixEightSubArea[i] = 0; //六环八区分区功能
}
- //日志处理
+
+ //删除日志
//DeleteDirectory()
+ //是否启用日志
CTime tm = CTime::GetCurrentTime();
//CString csTime = tm.Format("%Y-%m-%d_%H-%M-%S"); //构造时间字符串
CString csTime = tm.Format("%Y-%m-%d"); //构造时间字符串
@@ -238,6 +240,12 @@ HSI_Motion::HSI_Motion()
g_pLogger = new CLogger(dir);
g_pLogger2 = new CLogger(L"\\Log\\EF3_SumTime.Log");
+ GetAppPath(m_AppPath); //获取应用程序路径
+ m_LogIsOpen[0] = GetPrivateProfileInt(L"LOG", L"LOG_IS_OPEN_0", 0, m_AppPath + _T("\\Config\\EF3_Motion.ini"));
+ g_pLogger->IsEnabledLog = m_LogIsOpen[0] == 1 ? true : false;
+ g_pLogger->SendAndFlushWithTime(L"\n");
+ g_pLogger->SendAndFlushWithTime(L"==========================================================\n");
+
//档位参数
for (int i = 0; i < 5; i++)
{
@@ -263,7 +271,7 @@ HSI_Motion::HSI_Motion()
m_Home_AddJogGears[i] = 4;
m_Home_DecJogGears[i] = 3;
m_SetPotion_StartSpeed[i] = 20;
- m_SetPotion_DriveSpeed[i] = 20;
+
m_SetPotion_Line[i] = 150;
m_SetPotion_Buffer[i] = 40;
m_SetPotion_AccCurve[i] = 0;
@@ -289,12 +297,12 @@ HSI_Motion::HSI_Motion()
m_ijk[i] = 0;
}
- //是否启用日志
- GetAppPath(m_AppPath);
- m_LogIsOpen[0] = GetPrivateProfileInt(L"LOG", L"LOG_IS_OPEN_0", 0, m_AppPath + _T("\\Config\\EF3_Motion.ini"));
- g_pLogger->IsEnabledLog = m_LogIsOpen[0] == 1 ? true : false;
- g_pLogger->SendAndFlushWithTime(L"\n");
- g_pLogger->SendAndFlushWithTime(L"==========================================================\n");
+ for (int j = 0;j < 9;j++)
+ {
+ m_SetPotion_DriveSpeed[j] = 20; //设置定位驱动速度
+ //写日志
+ g_pLogger->SendAndFlushWithTime(L"m_SetPotion_DriveSpeed[%d] = %d\n", j, m_SetPotion_DriveSpeed[j]);
+ }
m_Set_XYZA_Reserve = 0; //XYZA轴方向
m_motorType = 0; //电机类型 1为伺服电机 0为步进电机
@@ -416,8 +424,7 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
return HSI_STATUS_NORMAL;
}
g_pLogger->SendAndFlushWithTime(L"[Startup] In\n");
- g_pLogger->SendAndFlushWithTime(L"[Startup] HMQ HSI.dll version = %s, date = %s\n", HSI_VERSION_CSTRING,
- HSI_FILE_CSDESCRIPTION); //输出HSI.dll 版本号
+ g_pLogger->SendAndFlushWithTime(L"[Startup] HMQ HSI_Sevenocean_EF3.dll version = %s, date = %s\n", HSI_VERSION_CSTRING, HSI_FILE_CSDESCRIPTION); //输出HSI.dll 版本号
GoogolMotionConfigFile = m_AppPath + _T("\\Config\\EF3_Config.ini");
Load_EF3_Config_Inifile(GoogolMotionConfigFile); //加载 EF3_Config.ini 配置项
@@ -1961,111 +1968,6 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
int RemainPul = 0;
int limitSDPul = 0;
double time;
- /*GetPositionXyz(1, now_pos[0], now_pos[1], now_pos[2], time);*/
- //GetPositionEncPrfMulti(1, now_pos, Prf_pos, 1);
-
- //if (m_DeviceType != 3)
- //{
- // if (AxisTypes == AXIS_X /*&& m_motorType & 0x01*/)
- // {
- // if (!bJOGDir) //负方向
- // {
- // RemainPul = static_cast(now_pos[1] / m_Resolution[1]) - static_cast(m_N_Work_Limit[1] /
- // m_Resolution[1]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // else
- // {
- // RemainPul = static_cast(m_P_Work_Limit[1] / m_Resolution[1]) - static_cast(now_pos[1] /
- // m_Resolution[1]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // }
- // else if (AxisTypes == AXIS_Y /*&& m_motorType & 0x02*/)
- // {
- // if (!bJOGDir) //负方向
- // {
- // RemainPul = static_cast(now_pos[2] / m_Resolution[2]) - static_cast(m_N_Work_Limit[2] /
- // m_Resolution[2]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = 1 + limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // else
- // {
- // RemainPul = static_cast(m_P_Work_Limit[2] / m_Resolution[2]) - static_cast(now_pos[2] /
- // m_Resolution[2]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // }
- // if (AxisTypes == AXIS_Z /*&& m_motorType & 0x04*/)
- // {
- // if (!bJOGDir) //负方向
- // {
- // RemainPul = static_cast(now_pos[3] / m_Resolution[3]) - static_cast(m_N_Work_Limit[3] /
- // m_Resolution[3]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // else
- // {
- // RemainPul = static_cast(m_P_Work_Limit[3] / m_Resolution[3]) - static_cast(now_pos[3] /
- // m_Resolution[3]);
- // limitSDPul = (DriveSpeed - StartSpeed) * 13;
- // if ((RemainPul < limitSDPul * 2) && (RemainPul > 0))
- // {
- // float SpeedRatio = limitSDPul * 2 / RemainPul;
- // DriveSpeed = DriveSpeed / SpeedRatio;
- // if (DriveSpeed < StartSpeed)
- // {
- // DriveSpeed = StartSpeed;
- // }
- // }
- // }
- // }
- //}
//速度限制
JogSpeed = abs(SpeedPercent(AxisTypes, Speed, DriveSpeed, StartSpeed, AccLine, DecLine, AccCurve, DecCurve));
@@ -3631,10 +3533,10 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
//设置速度,对应配置文件中定位合成速度 SET_POTION_DRIVESPEED_1
- g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] DriveSpeed[0] = %.4f, DriveSpeed[1] = %.4f, DriveSpeed[2] = %.4f, DriveSpeed[3] = %.4f, DriveSpeed[4] = %.4f\n",
+ g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] DriveSpeed[0] = %d, DriveSpeed[1] = %d, DriveSpeed[2] = %d, DriveSpeed[3] = %d, DriveSpeed[4] = %d\n",
m_SetPotion_DriveSpeed[0], m_SetPotion_DriveSpeed[1], m_SetPotion_DriveSpeed[2], m_SetPotion_DriveSpeed[3], m_SetPotion_DriveSpeed[4]);
-
+ g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] 设置X轴定位速度 %d\n", m_SetPotion_DriveSpeed[1]);
double X_SetmotionParam[5] = {
m_SetPotion_DriveSpeed[1],
m_SetPotion_DriveSpeed[1] * 10,
@@ -3645,6 +3547,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
SetSingleAxisMotionParams(ACSC_AXIS_1, X_SetmotionParam);//设置X轴定位速度
+ g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] 设置Y轴定位速度 %d\n", m_SetPotion_DriveSpeed[2]);
double Y_SetmotionParam[5] = {
m_SetPotion_DriveSpeed[2],
m_SetPotion_DriveSpeed[2] * 10 ,
@@ -3656,6 +3559,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
SetSingleAxisMotionParams(ACSC_AXIS_0, Y_SetmotionParam);//设置Y轴定位速度
+ g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] 设置Z轴定位速度 %d\n", m_SetPotion_DriveSpeed[3]);
double Z_SetmotionParam[5] = {
m_SetPotion_DriveSpeed[3],
m_SetPotion_DriveSpeed[3] * 10 ,
@@ -3765,7 +3669,7 @@ HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5])
auto rStatus = HSI_STATUS_NORMAL;
if (handleACS != ACSC_INVALID)
{
- g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] In\n");
+ //g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] In\n");
//依次是 速度
if (!acsc_GetVelocity(handleACS, AXIS, motionParam + 0, nullptr))
@@ -3802,19 +3706,22 @@ HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5])
rStatus = HSI_ACS_ERROR;
ErrorsHandler();
}
- g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] Out\n");
+ //打印数组 motionParam[5]
+ g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] Vel = %.4f, ACC = %.4f, DCC = %.4f, KillDec = %.4f, Jerk = %.4f\n",
+ motionParam[0], motionParam[1], motionParam[2], motionParam[3], motionParam[4]);
+ //g_pLogger->SendAndFlushWithTime(L"[GetSingleAxisParam] Out\n");
}
return rStatus;
}
//===========================================================================
-HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5])
+HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5]) //设置单轴运动参数
{
auto rStatus = HSI_STATUS_NORMAL;
if (handleACS != ACSC_INVALID)
{
- g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] In\n");
+ //g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] In\n");
//依次是 速度
if (!acsc_SetVelocity(handleACS, AXIS, motionParam[0], nullptr))
@@ -3851,7 +3758,12 @@ HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5])
// rStatus = HSI_ACS_ERROR;
// ErrorsHandler();
//}
- g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] Out\n");
+
+ //打印 motionParam[5]
+ g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] Vel = %.4f, ACC = %.4f, DCC = %.4f, KillDec = %.4f, Jerk = %.4f\n",
+ motionParam[0], motionParam[1], motionParam[2], motionParam[3], motionParam[4]);
+
+ //g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisParam] Out\n");
}
return rStatus;
@@ -6755,7 +6667,7 @@ HSI_STATUS HSI_Motion::SendBinResult(int* BinResult)
m_cSendData[5] = ((m_IbinCount >> 8) & 0xff);
m_cSendData[6] = (m_IbinCount & 0xff);
m_WriteByte = Send_Command(0, (const char*)m_cSendData, m_SendDataLength);
- g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] m_IbinCount = %d\n", m_IbinCount);
+ g_pLogger->SendAndFlushWithTime(L"[SendBinResult] m_IbinCount = %d\n", m_IbinCount);
Sleep(5);
}
g_pLogger->SendAndFlushWithTime(L"[SendBinResult] out\n");
@@ -7881,15 +7793,11 @@ HSI_STATUS HSI_Motion::GetSpeedXyz(int AxisNum, double& Speed)
{
g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] In\n");
auto rStatus = HSI_STATUS_NORMAL;
- short AxisNumber = AxisConvertIndex(AxisNum);
- if (1 == m_iSpeedType)
- {
- Speed = m_SetPotion_DriveSpeed[AxisNumber] * (m_Resolution[AxisNumber] * 50);
- }
- else
- {
- Speed = m_SetPotion_DriveSpeed[AxisNumber];
- }
+ short AxisNumber = AxisConvertIndex(AxisNum); //将轴号转换为 平台轴号
+
+ Speed = m_SetPotion_DriveSpeed[AxisNumber]; //从m_SetPotion_DriveSpeed[AxisNumber]中获取速度
+ g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] AxisNum = %d, Speed=%d\n", AxisNumber, m_SetPotion_DriveSpeed[AxisNumber]);
+
g_pLogger->SendAndFlushWithTime(L"[GetSpeedXyz] Out\n");
return rStatus;
}
@@ -7907,30 +7815,35 @@ HSI_STATUS HSI_Motion::SetSpeedXyz(double Speed)
}
else
{
- g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] Speed = %f\n", Speed);
+
if (1 == m_iSpeedType)
{
- m_SetPotion_DriveSpeed[1] = static_cast(Speed / (m_Resolution[1] * 50));
- if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
- {
- m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
- }
- if (m_SetPotion_DriveSpeed[1] < 0)
- {
- m_SetPotion_DriveSpeed[1] = 0;
- }
+ //m_SetPotion_DriveSpeed[1] = static_cast(Speed / (m_Resolution[1] * 50));
+ //if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
+ //{
+ // m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
+ //}
+ //if (m_SetPotion_DriveSpeed[1] < 0)
+ //{
+ // m_SetPotion_DriveSpeed[1] = 0;
+ //}
+ m_SetPotion_DriveSpeed[1] = static_cast(Speed);
+ //打印 m_setotion_drivespeed[1]的值
+ g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] m_iSpeedType=1, m_SetPotion_DriveSpeed[1] = %d\n", m_SetPotion_DriveSpeed[1]);
}
else
{
m_SetPotion_DriveSpeed[1] = static_cast(Speed);
- if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
- {
- m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
- }
- if (m_SetPotion_DriveSpeed[1] < 0)
- {
- m_SetPotion_DriveSpeed[1] = 0;
- }
+ //if (m_SetPotion_DriveSpeed[1] > 1000 / (m_Resolution[1] * 50))
+ //{
+ // m_SetPotion_DriveSpeed[1] = 1000 / (m_Resolution[1] * 50);
+ //}
+ //if (m_SetPotion_DriveSpeed[1] < 0)
+ //{
+ // m_SetPotion_DriveSpeed[1] = 0;
+ //}
+ //打印 m_setotion_drivespeed[1]的值
+ g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] m_SetPotion_DriveSpeed[1] = %d\n", m_SetPotion_DriveSpeed[1]);
}
}
g_pLogger->SendAndFlushWithTime(L"[SetSpeedXyz] Out\n");
@@ -8058,17 +7971,17 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
{
case HSI_MOTION_AXIS_X:
{
- AxisNumber = 0x01;
+ AxisNumber = 0x01; //对应ACS 平台 1轴
break;
}
case HSI_MOTION_AXIS_Y:
{
- AxisNumber = 0x00;
+ AxisNumber = 0x00; //对应 ACS 平台 0轴 (龙门轴)
break;
}
case HSI_MOTION_AXIS_Z:
{
- AxisNumber = 0x08;
+ AxisNumber = 0x08;//对应 ACS平台 8轴 (ecat通讯)
break;
}
case HSI_MOTION_AXIS_R:
@@ -8087,27 +8000,28 @@ short HSI_Motion::AxisConvertIndex(UINT AxisTypes)
}
//===========================================================================
-void HSI_Motion::SetSingleAxisMotionParams(UINT AxisTypes, double SetmotionParam[5]) //设置单轴运动参数
+void HSI_Motion::SetSingleAxisMotionParams(UINT AxisTypes, double SetMotionParam[5]) //设置单轴运动参数
{
- g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] In\n");
+ g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] In >>>>>>>>>>>>>>>>>>>>>>\n");
double getMotionParam[5] = { 0 };
+ short AxisNumber = AxisConvertIndex(AxisTypes);
//打印轴当前运动参数
- GetSingleAxisParam(AxisTypes, getMotionParam); //获取单轴运动参数
+ GetSingleAxisParam(AxisNumber, getMotionParam); //获取单轴运动参数
g_pLogger->SendAndFlushWithTime(
L"[before] Axis= %.2f, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f\n",
- jogAxisNum, getMotionParam[0], getMotionParam[1], getMotionParam[2], getMotionParam[3], getMotionParam[4]);
+ AxisNumber, getMotionParam[0], getMotionParam[1], getMotionParam[2], getMotionParam[3], getMotionParam[4]);
//设置单轴参数
- SetSingleAxisParam(AxisTypes, SetmotionParam);
+ SetSingleAxisParam(AxisNumber, SetMotionParam);
//打印轴当前运动参数
- GetSingleAxisParam(AxisTypes, getMotionParam); //获取单轴运动参数
+ GetSingleAxisParam(AxisNumber, getMotionParam); //获取单轴运动参数
g_pLogger->SendAndFlushWithTime(
L"[after] Axis= %.2f, Velocity = %.2f, Acceleration= %.2f, Deceleration= %.2f, KillDeceleration= %.2f, Jerk= %.2f\n",
- jogAxisNum, getMotionParam[0], getMotionParam[1], getMotionParam[2], getMotionParam[3], getMotionParam[4]);
+ AxisNumber, getMotionParam[0], getMotionParam[1], getMotionParam[2], getMotionParam[3], getMotionParam[4]);
- g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] Out\n");
+ g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] Out >>>>>>>>>>>>>>>>>>>>>>\n");
}
@@ -8156,6 +8070,8 @@ HSI_STATUS HSI_Motion::IsSupportedEx(UINT AxisTypes, UINT& Types)
{
rStatus = HSI_STATUS_NOT_SUPPORTED;
}
+ //写日志
+ g_pLogger->SendAndFlushWithTime(L"[IsSupportedEx] AxisNumber = %d, Types = %d\n", AxisNumber, Types);
return rStatus;
}
@@ -8178,6 +8094,8 @@ HSI_STATUS HSI_Motion::GetScaleResolutionEx(UINT AxisTypes, double& Scale)
{
Scale = m_Resolution[AxisNumber];
}
+ //写日志
+ g_pLogger->SendAndFlushWithTime(L"[GetScaleResolutionEx] AxisNumber = %d, Scale = %f\n", AxisNumber, Scale);
return rStatus;
}
@@ -8190,6 +8108,8 @@ HSI_STATUS HSI_Motion::SetScaleResolutionEx(UINT AxisTypes, double Scale)
{
m_Resolution[AxisNumber] = static_cast(Scale * 10000);
}
+ //写日志
+ g_pLogger->SendAndFlushWithTime(L"[SetScaleResolutionEx] AxisNumber = %d, Scale = %f\n", AxisNumber, m_Resolution[AxisNumber]);
return rStatus;
}
@@ -8250,25 +8170,18 @@ HSI_STATUS HSI_Motion::GetSpeedEx(UINT AxisTypes, double& Speed)
{
if (m_motorType == 1)
{
- if (1 == m_iSpeedType)
- {
- Speed = m_SetPotion_DriveSpeed[1] * (m_Resolution[1] * 50);
- }
- else
- {
+
+
Speed = m_SetPotion_DriveSpeed[1];
- }
+
+ g_pLogger->SendAndFlushWithTime(L"[GetSpeedEx] m_motorType =1, Speed=%d\n", Speed);
}
else
{
- if (1 == m_iSpeedType)
- {
- Speed = m_SetPotion_DriveSpeed[AxisNumber] * (m_Resolution[AxisNumber] * 50);
- }
- else
- {
+
Speed = m_SetPotion_DriveSpeed[AxisNumber];
- }
+
+ g_pLogger->SendAndFlushWithTime(L"[GetSpeedEx] m_iSpeedType=1, Speed=%d\n", Speed);
}
}
g_pLogger->SendAndFlushWithTime(L"[GetSpeedEx] Out\n");
@@ -8371,74 +8284,18 @@ HSI_STATUS HSI_Motion::SetSpeedEx(UINT AxisTypes, double Speed)
if (Speed <= 0)
{
m_SetPotion_DriveSpeed[AxisNumber] = 0;
+ g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] Speed <= 0 \n");
}
- if (1 == m_iSpeedType)
+
+ if (AxisNumber >= 0 && AxisNumber <= 8)
{
- if (Speed >= 65000 * (m_Resolution[AxisNumber] * 50))
- {
- m_SetPotion_DriveSpeed[AxisNumber] = 65000;
- }
+ m_SetPotion_DriveSpeed[1] = static_cast(Speed);
+ g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] AxisNumber = %d,Speed = %f \n", AxisNumber, m_SetPotion_DriveSpeed[1]);
}
else
{
- if (Speed >= 65000)
- {
- m_SetPotion_DriveSpeed[AxisNumber] = 65000;
- }
- }
- if (AxisNumber >= 1 && AxisNumber <= 4)
- {
- if (m_ForSoft == 1)
- {
- if (m_motorType == 1)
- {
- if (1 == m_iSpeedType)
- {
- m_SetPotion_DriveSpeed[1] = static_cast(Speed) / (m_Resolution[1] * 50);
- }
- else
- {
- m_SetPotion_DriveSpeed[1] = static_cast(Speed);
- }
- }
- else
- {
- g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] AxisNumber = %d,Speed = %f \n", AxisNumber, Speed);
- //if (!bSaveSpeedFlag)
- //{
- // bSaveSpeedFlag = true;
- // m_SaveAxisNum = AxisNumber;
- // m_SaveAxisSpeed = m_SetPotion_DriveSpeed[AxisNumber];
- // g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] m_SaveAxisNum = %d,m_SaveAxisSpeed = %d \n", m_SaveAxisNum, m_SaveAxisSpeed);
- //}
- //if (bSaveSpeedFlag && ((int)Speed == m_SetPotion_DriveSpeed[1] * (m_Resolution[1] * 50)))
- //{
- // bSaveSpeedFlag = false;
- // m_SetPotion_DriveSpeed[m_SaveAxisNum] = m_SaveAxisSpeed;
- // return rStatus;
- //}
- if (1 == m_iSpeedType)
- {
- m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50));
- }
- else
- {
- m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed);
- }
- g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] AxisNumber = %d\n", AxisNumber);
- }
- }
- else
- {
- if (m_motorType == 1)
- {
- m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50));
- }
- else
- {
- m_SetPotion_DriveSpeed[AxisNumber] = static_cast(Speed / (m_Resolution[AxisNumber] * 50));
- }
- }
+ //打印日志 轴号不在1-4之间
+ g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] 轴号不在0-8之间\n");
}
g_pLogger->SendAndFlushWithTime(L"[SetSpeedEx] Out\n");
return rStatus;
diff --git a/HSI_HexagonMI_EF3/HSI_Motion.h b/HSI_HexagonMI_EF3/HSI_Motion.h
index 1b7076b..d34ab8a 100644
--- a/HSI_HexagonMI_EF3/HSI_Motion.h
+++ b/HSI_HexagonMI_EF3/HSI_Motion.h
@@ -178,6 +178,12 @@ public:
*/
HSI_STATUS GetSpeedXyz(int AxisNum, double& Speed);
HSI_STATUS GetSpeedXyzOld(int AxisNum, double& Speed);
+ /**
+ * \brief 设置单轴运动速度
+ * \param AxisNum
+ * \param Speed
+ * \return
+ */
HSI_STATUS SetSpeedXyz(double Speed);
HSI_STATUS GetFocusSpeed(double& Speed);
HSI_STATUS SetFocusSpeed(double Speed);
@@ -239,8 +245,8 @@ public:
* \param motionParam
* \return
*/
- HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5]);
- HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5]);
+ HSI_STATUS HSI_Motion::GetSingleAxisParam(int AXIS, double motionParam[5]); //获取单轴运动参数
+ HSI_STATUS HSI_Motion::SetSingleAxisParam(int AXIS, double motionParam[5]); //设置单轴运动参数
/**
* \brief 运行到指定位置
* \param AxisTypes 轴号
@@ -398,8 +404,8 @@ public:
int m_SetPotion_Count[5];
//定位参数
- int m_SetPotion_StartSpeed[5];
- int m_SetPotion_DriveSpeed[5];
+ int m_SetPotion_StartSpeed[9];
+ int m_SetPotion_DriveSpeed[9];
int m_SetPotion_Line[5];
int m_SetPotion_Buffer[5];
int m_SetPotion_AccCurve[5];
@@ -637,8 +643,8 @@ public:
*/
short AxisConvertIndex(UINT AxisTypes);
short IndexConvertAxis(int Index);
- void SetSingleAxisMotionParams(UINT AxisTypes, double motionParam[5]);
- double LimitOver(UINT AxisTypes, double& LimitPos);
+ void SetSingleAxisMotionParams(UINT AxisTypes, double SetMotionParam[5]);//单轴运动参数设置
+ double LimitOver(UINT AxisTypes, double& LimitPos);//限位判断
int P2P(short AxisNumber, long Pos, double Speed, double Acc);
void DoEvents();
HSI_STATUS DriverAlarmStatus();
diff --git a/HSI_HexagonMI_EF3/version.cmd b/HSI_HexagonMI_EF3/version.cmd
index 524ec12..740421b 100644
--- a/HSI_HexagonMI_EF3/version.cmd
+++ b/HSI_HexagonMI_EF3/version.cmd
@@ -5,7 +5,7 @@ echo Generate release version
::需要人工设置的版本号----------------------------------------------------------------------------------
set major_ver=0
set minor_ver=0
-set revsion_ver=1
+set revsion_ver=2
::------------------------------------------------------------------------------------------------------
set revfile="%~dp0version.h"
diff --git a/HSI_HexagonMI_EF3/version.h b/HSI_HexagonMI_EF3/version.h
index faf8e5c..af4aeb3 100644
--- a/HSI_HexagonMI_EF3/version.h
+++ b/HSI_HexagonMI_EF3/version.h
@@ -4,13 +4,13 @@
#define HSI_VERSION_NUM
#define HSI_VERSION_SET _T("")
///
-#define HSI_VERSION "0.0.1"
-#define HSI_VERSION_CSTRING _T("0.0.1")
+#define HSI_VERSION "0.0.2"
+#define HSI_VERSION_CSTRING _T("0.0.2")
#define HSI_VERSION_MAJOR 0
#define HSI_VERSION_MINOR 0
-#define HSI_VERSION_REVISION 1
+#define HSI_VERSION_REVISION 2
#define HSI_VERSION_REVNUM
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
-#define HSI_FILE_DESCRIPTION "周四 2.24.05 / 18:55 "
-#define HSI_FILE_CSDESCRIPTION _T("周四 2.24.05 / 18:55 ")
+#define HSI_FILE_DESCRIPTION "周三 2.24.06 / 18:03 "
+#define HSI_FILE_CSDESCRIPTION _T("周三 2.24.06 / 18:03 ")
diff --git a/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs b/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs
index 25390d7..c72af10 100644
--- a/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs
+++ b/HSI_SEVENOCEAN_EF1_CsTest/HSI/HSI.cs
@@ -8,7 +8,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
internal class Interface
{
// >>>> In Interfaces
- //ûص
+ //引用回调
public delegate void PEventCallback(
HSI_EVENT_TYPE eventType, HSI_EVENT_RESPONSE_TYPE responseType, uint eventId, string eventData,
ref uint eventCallbackId);
@@ -21,10 +21,10 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
[DllImport("HSI.dll", EntryPoint = "HSI_GET_MACHINE_INFO", CharSet = CharSet.Unicode)]
public static extern HSI_STATUS GetMachineInfo(ref int numMachineTypes);
- //÷ֵʾһķֵһãֵͶĸ͵ĵַ
- //һҪʵ÷ֵҪ
- //1ֵΪvoidҪʹrefؼ(ref readonlyʾֻ)η
- //2ÿһreturnҪһref
+ //引用返回值表示一个方法的返回值是一个引用,而不是值类型对象的副本或者引用类型的地址,
+ //而一个方法要实现引用返回值,需要满足两个条件:
+ //1、返回值不能为void,且需要使用ref关键字(或者ref readonly表示只读)修饰返回类型
+ //2、方法的每一个return语句需要是一个ref引用
[DllImport("HSI.dll", EntryPoint = "HSI_MOTION_GET_FIREWAREVERION", CharSet = CharSet.Unicode)]
public static extern HSI_STATUS MotionGetFirewareVerion(IntPtr firewareVerion);
@@ -38,7 +38,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
public static extern HSI_STATUS Shutdown();
// <<<< Out Interfacess
- //¼ص
+ //事件回调函数
public static void EventCallback(HSI_EVENT_TYPE eventType, HSI_EVENT_RESPONSE_TYPE responseType,
uint eventId, string eventData, ref uint eventCallbackId)
{
@@ -63,7 +63,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
{
case HSI_EVENT_TYPE.HSI_EVENT_NONE:
break;
- case HSI_EVENT_TYPE.HSI_EVENT_ERROR: //
+ case HSI_EVENT_TYPE.HSI_EVENT_ERROR: //错误
MessageBox.Show(eventData, Resources.Interface_Tips,
msgBtn, MessageBoxIcon.Error);
break;
@@ -71,7 +71,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
var eventFunctionId = (HSI_EVENT_FUNCTION_ID)eventId;
switch (eventFunctionId)
{
- case HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME: //ؼ
+ case HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOTION_DCC_HOME: //准备回家
{
MessageBox.Show(Resources.Interface_Tips_Home_Machine, Resources.Interface_Tips,
msgBtn, MessageBoxIcon.Information);
@@ -83,7 +83,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
msgBtn, MessageBoxIcon.Information);
break;
}
- case HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOVE_POINT: //λ
+ case HSI_EVENT_FUNCTION_ID.HSI_EVENT_MOVE_POINT: //定位完成
{
MessageBox.Show(Resources.Interface_Tips_Motion_Finished, Resources.Interface_Tips,
msgBtn, MessageBoxIcon.Information);
@@ -448,9 +448,9 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
public enum HSI_MOTION_AXIS_TYPE
{
- //HSI_MOTION_AXIS_X = 0x0001, //ӦACS 0 X
- //HSI_MOTION_AXIS_Y = 0x0000, //ӦACS 1 Y
- //HSI_MOTION_AXIS_Z = 0x0004, //ӦACS 4 Z
+ //HSI_MOTION_AXIS_X = 0x0001, //对应ACS 0轴 X
+ //HSI_MOTION_AXIS_Y = 0x0000, //对应ACS 1轴 Y
+ //HSI_MOTION_AXIS_Z = 0x0004, //对应ACS 4轴 Z
HSI_MOTION_AXIS_X = 0x0001, // This is the default "Sensor level" X Axis - use on single X axis machines
HSI_MOTION_AXIS_Y = 0x0002, // This is the default "Sensor level" Y Axis - use on single Y axis machines
HSI_MOTION_AXIS_Z = 0x0004, // This is the default "Sensor level" Z Axis - use on single Z axis machines
@@ -552,9 +552,9 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
HSI_SCAN_MOTION_SPEC_LOCA = 100, //EF1
HSI_SCAN_MOTION_EQ_DIS,
HSI_SCAN_MOTION_EQ_DIS_II,
- HSI_SCAN_MOTION_LINEAR_TEST, //ʹ
- HSI_SCAN_MOTION_EQ_TEST, //ʹ
- HSI_SCAN_MOTION_MANUAL_TEST //ʹ
+ HSI_SCAN_MOTION_LINEAR_TEST, //测试使用
+ HSI_SCAN_MOTION_EQ_TEST, //测试使用
+ HSI_SCAN_MOTION_MANUAL_TEST //测试使用
}
///////////////////////////////////////////////////////////////////////////////
@@ -617,7 +617,7 @@ namespace HSI_SEVENOCEAN_EF1_CsTest.HSI
public const int HSI_APIVersionMinor = 3;
public const int HSI_MaxStringLength = 255; // Maximum string length (buffer size - 1)
- public const int HSI_EF3Version = 0; //ĬEF3汾
+ public const int HSI_EF3Version = 0; //默认EF3版本号
public const uint HSI_MOTION_AXIS_ALL =
(uint)
diff --git a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/HSI.dll b/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/HSI.dll
deleted file mode 100644
index 2149f62..0000000
Binary files a/HSI_SEVENOCEAN_EF1_CsTest/bin/Debug/HSI.dll and /dev/null differ