mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-20 03:49:43 +08:00
Merge branch 'renlixin'
This commit is contained in:
@ -423,6 +423,7 @@ bool CVSMD12XControl::StartBackZero()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return IsMotionFinished();
|
||||||
|
|
||||||
bool bFlagIsStopped = false;
|
bool bFlagIsStopped = false;
|
||||||
while (!bFlagIsStopped)
|
while (!bFlagIsStopped)
|
||||||
@ -440,7 +441,49 @@ bool CVSMD12XControl::StartBackZero()
|
|||||||
// return ParseReturnedString(strRecv, -1);
|
// return ParseReturnedString(strRecv, -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
bool CVSMD12XControl::IsMotionFinished()
|
||||||
|
{
|
||||||
|
//true means stopped
|
||||||
|
//false means unknown status
|
||||||
|
int iCountTotal = 0;
|
||||||
|
int iCountStopped = 0;
|
||||||
|
bool bFlagIsStopped = false;
|
||||||
|
|
||||||
|
while (!bFlagIsStopped)
|
||||||
|
{
|
||||||
|
iCountTotal++;
|
||||||
|
QThread::msleep(200);
|
||||||
|
//Delay_MSec(200);
|
||||||
|
GetStatus(m_stuMSInfo);
|
||||||
|
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||||
|
ucFlag = ucFlag & 0x10;
|
||||||
|
if (m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
iCountStopped++;
|
||||||
|
}
|
||||||
|
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (iCountStopped>=50)
|
||||||
|
{
|
||||||
|
qDebug() <<"Warning.Motion Err,should be stopped already.checking register and retry...";
|
||||||
|
qDebug() <<"motion status:"<<ucFlag<<"all status:"<<QString::number(m_stuMSInfo.uiFlags,2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (iCountTotal>1000)
|
||||||
|
{
|
||||||
|
qDebug() << "Err.Motor Hardware Err,should be stopped already";
|
||||||
|
qDebug() << "motion status:" << ucFlag << "all status:" << QString::number(m_stuMSInfo.uiFlags, 2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
bool CVSMD12XControl::StopBackZero()
|
bool CVSMD12XControl::StopBackZero()
|
||||||
{
|
{
|
||||||
std::string strCMD = "zero stop\n";
|
std::string strCMD = "zero stop\n";
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
||||||
|
|
||||||
bool ILMES_MoveToPos(int iPositionIndex);
|
bool ILMES_MoveToPos(int iPositionIndex);
|
||||||
|
bool IsMotionFinished();
|
||||||
public:
|
public:
|
||||||
int waitetime;
|
int waitetime;
|
||||||
////init port
|
////init port
|
||||||
@ -79,39 +79,39 @@ public:
|
|||||||
|
|
||||||
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
||||||
////motion control
|
////motion control
|
||||||
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool SetLogicZero(); //set logic zero
|
bool SetLogicZero(); //set logic zero
|
||||||
|
|
||||||
bool StartBackZero();//back zero
|
bool StartBackZero();//back zero
|
||||||
bool StopBackZero();// stop back zero & reset register
|
bool StopBackZero();// stop back zero & reset register
|
||||||
////Set&Get
|
////Set&Get
|
||||||
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
||||||
int GetBaudRate(); // -1:should retry;
|
int GetBaudRate(); // -1:should retry;
|
||||||
|
|
||||||
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
||||||
int GetMicroSteps();
|
int GetMicroSteps();
|
||||||
|
|
||||||
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
||||||
float GetAccSpeed();
|
float GetAccSpeed();
|
||||||
|
|
||||||
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
||||||
float GetRunSpeed();
|
float GetRunSpeed();
|
||||||
|
|
||||||
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
||||||
float GetDecSpeed();
|
float GetDecSpeed();
|
||||||
|
|
||||||
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
||||||
|
|
||||||
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetHoldCurrent();
|
float GetHoldCurrent();
|
||||||
|
|
||||||
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetAccCurrent();
|
float GetAccCurrent();
|
||||||
|
|
||||||
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetRunCurrent();
|
float GetRunCurrent();
|
||||||
|
|
||||||
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
ZZ_U8 GetS2RETE();
|
ZZ_U8 GetS2RETE();
|
||||||
|
|
||||||
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
||||||
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
||||||
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
||||||
ZZ_U8 GetZeroMode();
|
ZZ_U8 GetZeroMode();
|
||||||
ZZ_U8 GetSwitchOpenVoltageLevel();
|
ZZ_U8 GetSwitchOpenVoltageLevel();
|
||||||
|
@ -422,7 +422,7 @@ bool CVSMD12XControl::StartBackZero()
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return IsMotionFinished();
|
||||||
bool bFlagIsStopped = false;
|
bool bFlagIsStopped = false;
|
||||||
while (!bFlagIsStopped)
|
while (!bFlagIsStopped)
|
||||||
{
|
{
|
||||||
@ -438,6 +438,49 @@ bool CVSMD12XControl::StartBackZero()
|
|||||||
return true;
|
return true;
|
||||||
// return ParseReturnedString(strRecv, -1);
|
// return ParseReturnedString(strRecv, -1);
|
||||||
|
|
||||||
|
}
|
||||||
|
bool CVSMD12XControl::IsMotionFinished()
|
||||||
|
{
|
||||||
|
//true means stopped
|
||||||
|
//false means unknown status
|
||||||
|
int iCountTotal = 0;
|
||||||
|
int iCountStopped = 0;
|
||||||
|
bool bFlagIsStopped = false;
|
||||||
|
|
||||||
|
while (!bFlagIsStopped)
|
||||||
|
{
|
||||||
|
iCountTotal++;
|
||||||
|
QThread::msleep(200);
|
||||||
|
//Delay_MSec(200);
|
||||||
|
GetStatus(m_stuMSInfo);
|
||||||
|
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||||
|
ucFlag = ucFlag & 0x10;
|
||||||
|
if (m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
iCountStopped++;
|
||||||
|
}
|
||||||
|
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (iCountStopped>=50)
|
||||||
|
{
|
||||||
|
qDebug() <<"Warning.Motion Err,should be stopped already.checking register and retry...";
|
||||||
|
qDebug() <<"motion status:"<<ucFlag<<"all status:"<<QString::number(m_stuMSInfo.uiFlags,2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (iCountTotal>1000)
|
||||||
|
{
|
||||||
|
qDebug() << "Err.Motor Hardware Err,should be stopped already";
|
||||||
|
qDebug() << "motion status:" << ucFlag << "all status:" << QString::number(m_stuMSInfo.uiFlags, 2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVSMD12XControl::StopBackZero()
|
bool CVSMD12XControl::StopBackZero()
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
void ILMES_SetPosition(int *piPositionInPulse,size_t szSize);
|
||||||
|
|
||||||
bool ILMES_MoveToPos(int iPositionIndex);
|
bool ILMES_MoveToPos(int iPositionIndex);
|
||||||
|
bool IsMotionFinished();
|
||||||
public:
|
public:
|
||||||
int waitetime;
|
int waitetime;
|
||||||
////init port
|
////init port
|
||||||
@ -79,39 +79,39 @@ public:
|
|||||||
|
|
||||||
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
bool GetStatus(MSInfo &stuMotorParam); //load motor status see MSInfo Struct
|
||||||
////motion control
|
////motion control
|
||||||
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
bool Move(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
bool MoveTo(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
bool Move_NoSyn(int iRelPulse); // relative move mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
bool MoveTo_NoSyn(int iAbsPulse);//absolute mode,pulse (-2147483647<34><37>2147483647)
|
||||||
bool SetLogicZero(); //set logic zero
|
bool SetLogicZero(); //set logic zero
|
||||||
|
|
||||||
bool StartBackZero();//back zero
|
bool StartBackZero();//back zero
|
||||||
bool StopBackZero();// stop back zero & reset register
|
bool StopBackZero();// stop back zero & reset register
|
||||||
////Set&Get
|
////Set&Get
|
||||||
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
bool SetBaudRate(int iBaudRate);//set controller baud rates,default B9600 (2400 <20><> 921600)
|
||||||
int GetBaudRate(); // -1:should retry;
|
int GetBaudRate(); // -1:should retry;
|
||||||
|
|
||||||
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
bool SetMicroSteps(int iMicroSteps);//set micro steps (0<><30>5)->(1/2/4/8/16/32)
|
||||||
int GetMicroSteps();
|
int GetMicroSteps();
|
||||||
|
|
||||||
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
bool SetAccSpeed(float fAccSpd);//set acceleration speed in pulse (0 <20><> 192000000)
|
||||||
float GetAccSpeed();
|
float GetAccSpeed();
|
||||||
|
|
||||||
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
bool SetRunSpeed(float fRunSpeed);//set normal running speed in pulse (0 <20><> 192000000)
|
||||||
float GetRunSpeed();
|
float GetRunSpeed();
|
||||||
|
|
||||||
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
bool SetDecSpeed(float fDecSpeed);//set deceleration speed in pulse (0 <20><> 192000000)
|
||||||
float GetDecSpeed();
|
float GetDecSpeed();
|
||||||
|
|
||||||
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
bool SetSpeed(float fRunSpeed, float fAccSpd, float fDecSpeed);//see above three functions
|
||||||
|
|
||||||
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetHoldCurrent(float fHoldCurrent);//set hold current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetHoldCurrent();
|
float GetHoldCurrent();
|
||||||
|
|
||||||
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetAccCurrent(float fAccCurrent);//set acceleration current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetAccCurrent();
|
float GetAccCurrent();
|
||||||
|
|
||||||
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
bool SetRunCurrent(float fRunCurrent);//set normal running current ( 0 <20><> 8.0 )Amp? pay attention to your motor specification.
|
||||||
float GetRunCurrent();
|
float GetRunCurrent();
|
||||||
|
|
||||||
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
bool SetCurrent(float fAccCurrent, float fRunCurrent, float fHoldCurrent);//see above three functions
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
ZZ_U8 GetS2RETE();
|
ZZ_U8 GetS2RETE();
|
||||||
|
|
||||||
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
//(ZeroMode 0:off 1:once 2:once + safe position 3:twice 4:twice + safe position) (OpenVoltageLevel 0:Low Level 1:High Level)
|
||||||
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
//(ZeroSensor 0:S1 1:S2 2:S3 3:S4 4:S5 5:S6)( ZeroVelocity <20><>-192000) <20><><EFBFBD><EFBFBD>192000<30><30>pulse)(SafePosition <20><>-2147483647) <20><><EFBFBD><EFBFBD>2147483647<34><37>)
|
||||||
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
bool SetZeroParams(ZZ_U8 bZeroMode, ZZ_U8 bSwitchOpenVL, ZZ_U8 bZeroSensor, float fZeroVelocity, int iSafePosition);
|
||||||
ZZ_U8 GetZeroMode();
|
ZZ_U8 GetZeroMode();
|
||||||
ZZ_U8 GetSwitchOpenVoltageLevel();
|
ZZ_U8 GetSwitchOpenVoltageLevel();
|
||||||
|
Reference in New Issue
Block a user