定位采用配置文件中定位合成速度;修复运动前判断电机是否使能
This commit is contained in:
@@ -532,6 +532,9 @@ HSI_STATUS HSI_Motion::Startup(HWND _hWnd, bool _bOfflineOnly)
|
||||
g_pLogger->SendAndFlushWithTime(
|
||||
L"[ACS Motion] Communication with the controller is already established successfully!\n");
|
||||
}
|
||||
|
||||
//如果各个轴标志位 未回过家,需要回家
|
||||
rStatus = g_pHSI_Motion->HomeMachine(TRUE); //执行回家
|
||||
}
|
||||
|
||||
// 04 05 0F 4A 04 00 04 00 00 00 00 00 00 00 00 00
|
||||
@@ -1552,8 +1555,6 @@ HSI_STATUS HSI_Motion::IsHomed(bool& bHomed)
|
||||
CurrentHomeMachineState = E_EF3_HOME_NONE;
|
||||
bHomed = false;
|
||||
|
||||
//如果各个轴标志位 未回过家,需要回家
|
||||
rStatus = g_pHSI_Motion->HomeMachine(TRUE); //执行回家
|
||||
}
|
||||
g_pLogger->SendAndFlushWithTime(L"[IsHomed] Out\n");
|
||||
}
|
||||
@@ -2075,7 +2076,8 @@ HSI_STATUS HSI_Motion::Jog(UINT AxisTypes, double Speed)
|
||||
//转到真实ACS平台轴号,并开始执行
|
||||
byte AxisNumber = static_cast<byte>(AxisConvertIndex(AxisTypes)); //Jog
|
||||
double motionParam[5] = { DriveSpeed,AccLine*10 , DecLine*10, AccCurve,DecCurve }; //速度,加速度,减速度,Kill, jerk
|
||||
SetSingleAxisParam(AxisNumber, motionParam);
|
||||
SetSingleAxisMotionParams(AxisNumber, motionParam);
|
||||
|
||||
// 急停判断
|
||||
if ((StartSpeed < 250) && (DriveSpeed < 6))
|
||||
{
|
||||
@@ -3542,8 +3544,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
|
||||
if (g_pHSI_Motion)
|
||||
{
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] In\n");
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] AxisTypes = %d, PositionX = %.4f,PositionY = %.4f,PositionZ = %.4f\n", AxisTypes,PositionX,
|
||||
PositionY, PositionZ);
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] AxisTypes = %d, PositionX = %.4f,PositionY = %.4f,PositionZ = %.4f\n", AxisTypes,PositionX, PositionY, PositionZ);
|
||||
|
||||
axis_start = 0;
|
||||
unsigned char direct_pos = 0;
|
||||
@@ -3558,7 +3559,7 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
|
||||
LimitOver(HSI_MOTION_AXIS_Z, PositionZ);
|
||||
LimitOver(HSI_MOTION_AXIS_R, m_PositionA);
|
||||
g_pLogger->SendAndFlushWithTime(
|
||||
L"[SetPositionXyz] LimitOver, Pos[1] = %.4f, Pos[2] = %.4f, Pos[3] = %.4f, m_PositionA = %.4f\n",
|
||||
L"[SetPositionXyz] LimitOver, PositionX = %.4f, PositionY = %.4f, PositionZ = %.4f, m_PositionA = %.4f\n",
|
||||
PositionX, PositionY, PositionZ, m_PositionA);
|
||||
|
||||
//SetpositionXyz的目标位置
|
||||
@@ -3575,13 +3576,43 @@ HSI_STATUS HSI_Motion::SetPositionXyz(UINT AxisTypes, double PositionX, double P
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] PositionX = %.4f, PositionY = %.4f, PositionZ = %.4f\n", PositionX,PositionY, PositionZ);
|
||||
|
||||
|
||||
//设置运动参数
|
||||
//设置速度,对应配置文件中定位合成速度 SET_POTION_DRIVESPEED_1
|
||||
|
||||
//SetSingleAxisMotionParams
|
||||
//打印数组 m_SetPotion_DriveSpeed
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetPositionXyz] DriveSpeed[0] = %.4f, DriveSpeed[1] = %.4f, DriveSpeed[2] = %.4f, DriveSpeed[3] = %.4f, DriveSpeed[4] = %.4f\n",
|
||||
m_SetPotion_DriveSpeed[0], m_SetPotion_DriveSpeed[1], m_SetPotion_DriveSpeed[2], m_SetPotion_DriveSpeed[3], m_SetPotion_DriveSpeed[4]);
|
||||
|
||||
|
||||
double X_SetmotionParam[5] = {
|
||||
m_SetPotion_DriveSpeed[1],
|
||||
m_SetPotion_DriveSpeed[1] * 10,
|
||||
m_SetPotion_DriveSpeed[1] * 10,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
SetSingleAxisMotionParams(ACSC_AXIS_1, X_SetmotionParam);//设置X轴定位速度
|
||||
|
||||
double Y_SetmotionParam[5] = {
|
||||
m_SetPotion_DriveSpeed[2],
|
||||
m_SetPotion_DriveSpeed[2] * 10 ,
|
||||
m_SetPotion_DriveSpeed[2] * 10,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
SetSingleAxisMotionParams(ACSC_AXIS_0, Y_SetmotionParam);//设置Y轴定位速度
|
||||
|
||||
double Z_SetmotionParam[5] = {
|
||||
m_SetPotion_DriveSpeed[3],
|
||||
m_SetPotion_DriveSpeed[3] * 10 ,
|
||||
m_SetPotion_DriveSpeed[3] * 10,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
SetSingleAxisMotionParams(ACSC_AXIS_8, Z_SetmotionParam);//设置Z轴定位速度
|
||||
|
||||
|
||||
//开始运动到指定位置,多轴运动
|
||||
@@ -4095,7 +4126,11 @@ HSI_STATUS HSI_Motion::Load_EF3_Motion_Inifile(CString GoogolIniFile)
|
||||
csAppPath);
|
||||
m_SetPotion_DriveSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED",
|
||||
L"SET_POTION_DRIVESPEED_" + axisNum[i], 100, csAppPath);
|
||||
m_SetPotion_DriveSpeed[i] = m_SetPotion_DriveSpeed[i] / (m_Resolution[i] * 50);
|
||||
//m_SetPotion_DriveSpeed[i] = m_SetPotion_DriveSpeed[i] / (m_Resolution[i] * 50);
|
||||
//打印定位合成速度
|
||||
g_pLogger->SendAndFlushWithTime(L"[Load_EF3_Motion_Inifile] m_SetPotion_DriveSpeed[%d]: %d\n", i,
|
||||
m_SetPotion_DriveSpeed[i]);
|
||||
|
||||
m_SetPotion_Line[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED", L"SET_POTION_LINE_" + axisNum[i], 100,
|
||||
csAppPath);
|
||||
m_SetPotion_StartSpeed[i] = GetPrivateProfileInt(L"SET_POSITION_SPEED",
|
||||
@@ -7994,11 +8029,8 @@ void HSI_Motion::SetSingleAxisMotionParams(UINT AxisTypes, double SetmotionParam
|
||||
g_pLogger->SendAndFlushWithTime(L"[SetSingleAxisMotionParams] In\n");
|
||||
double getMotionParam[5] = { 0 };
|
||||
|
||||
//轴号转换
|
||||
byte AxisNumber = static_cast<byte>(AxisConvertIndex(AxisTypes)); //SetSingleAxisMotionParams
|
||||
|
||||
//打印轴当前运动参数
|
||||
GetSingleAxisParam(AxisNumber, getMotionParam); //获取单轴运动参数
|
||||
GetSingleAxisParam(AxisTypes, 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]);
|
||||
@@ -8007,7 +8039,7 @@ void HSI_Motion::SetSingleAxisMotionParams(UINT AxisTypes, double SetmotionParam
|
||||
SetSingleAxisParam(AxisTypes, SetmotionParam);
|
||||
|
||||
//打印轴当前运动参数
|
||||
GetSingleAxisParam(AxisNumber, getMotionParam); //获取单轴运动参数
|
||||
GetSingleAxisParam(AxisTypes, 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]);
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
#define HSI_VERSION_REVNUM
|
||||
#define HSI_VERSION_BUILD_DATE _T(__DATE__ )
|
||||
#define HSI_VERSION_BUILD_TIME _T(__TIME__ )
|
||||
#define HSI_FILE_DESCRIPTION "2024.02.28 / 11:38 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2024.02.28 / 11:38 ")
|
||||
#define HSI_FILE_DESCRIPTION "2024.02.28 / 14:38 "
|
||||
#define HSI_FILE_CSDESCRIPTION _T("2024.02.28 / 14:38 ")
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -75,9 +75,9 @@ namespace HSI_SEVENOCEAN_EF1_CsTest
|
||||
#endregion
|
||||
|
||||
//6 是否回家
|
||||
//var bHomed = true;
|
||||
//rStatus = Motion.IsHomed(ref bHomed);
|
||||
//Console.WriteLine("Motion.IsHomed:{0}", rStatus);
|
||||
var bHomed = true;
|
||||
rStatus = Motion.IsHomed(ref bHomed);
|
||||
Console.WriteLine("Motion.IsHomed:{0}", rStatus);
|
||||
var bexit = false;
|
||||
var SpeedGear = 0.3;
|
||||
var dPos = new double[3];
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user