EgtMachKernel 2.7h1 :

- in simulazione corretta segnalazione extracorsa per robot
- aggiunta gestione suggerimento angoli iniziali come home con comando "Home".
This commit is contained in:
Dario Sassi
2025-08-03 13:37:44 +02:00
parent 9d447b875b
commit 3f8d6867e2
5 changed files with 74 additions and 43 deletions
BIN
View File
Binary file not shown.
+32 -24
View File
@@ -1702,39 +1702,47 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ;
for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) {
if ( vLin[i] < m_vCalcLinAx[i].stroke.Min) {
if ( nStat == 0) {
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = true ;
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Min ;
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "-) " ;
}
nStat += ( 1 << ( 2 * i)) ;
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = true ;
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Min ;
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "-) " ;
}
else if( vLin[i] > m_vCalcLinAx[i].stroke.Max) {
else if ( vLin[i] > m_vCalcLinAx[i].stroke.Max) {
if ( nStat == 0) {
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = true ;
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Max ;
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "+) " ;
}
nStat += ( 2 << ( 2 * i)) ;
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcLinAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcLinAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = true ;
m_OutstrokeInfo.dExtra = vLin[i] - m_vCalcLinAx[i].stroke.Max ;
m_OutstrokeInfo.sAuxInfo = " (L" + ToString( int(i) + 1) + "+) " ;
}
}
// verifica degli assi rotanti
for ( size_t i = 0 ; i < m_vCalcRotAx.size() && i < vAng.size() ; ++ i) {
if ( vAng[i] < m_vCalcRotAx[i].stroke.Min) {
if ( nStat == 0) {
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = false ;
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Min ;
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "-) " ;
}
nStat += ( 64 << ( 2 * i)) ;
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = false ;
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Min ;
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "-) " ;
}
else if( vAng[i] > m_vCalcRotAx[i].stroke.Max) {
else if ( vAng[i] > m_vCalcRotAx[i].stroke.Max) {
if ( nStat == 0) {
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = false ;
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Max ;
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "+) " ;
}
nStat += ( 128 << ( 2 * i)) ;
m_OutstrokeInfo.sAxName = GetAxis( m_vCalcRotAx[i].nGrpId)->GetName() ;
m_OutstrokeInfo.sAxToken = GetAxis( m_vCalcRotAx[i].nGrpId)->GetToken() ;
m_OutstrokeInfo.bLinear = false ;
m_OutstrokeInfo.dExtra = vAng[i] - m_vCalcRotAx[i].stroke.Max ;
m_OutstrokeInfo.sAuxInfo = " (R" + ToString( int(i) + 1) + "+) " ;
}
}
// verifica delle aree protette
@@ -1856,9 +1864,9 @@ Machine::GetOutstrokeInfo( bool bMM) const
if ( m_OutstrokeInfo.sAxName == AXIS_NAME_PROTECTEDAREAS)
return m_OutstrokeInfo.sAuxInfo ;
else if ( bMM || ! m_OutstrokeInfo.bLinear)
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 1) + m_OutstrokeInfo.sAuxInfo ;
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 2) + m_OutstrokeInfo.sAuxInfo ;
else
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra / ONEINCH, 2) + m_OutstrokeInfo.sAuxInfo ;
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra / ONEINCH, 3) + m_OutstrokeInfo.sAuxInfo ;
}
//----------------------------------------------------------------------------
+20 -9
View File
@@ -1849,11 +1849,14 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
for ( int i = 0 ; i < nRotAxes ; ++ i)
vAxRotHome[i] = vAxHome[nLinAxes + i] ;
// Verifico se nei suggerimenti viene richiesta Home per gli assi
bool bHintHome = ( sHint.find( "Home") != string::npos) ;
// Assegno gli angoli iniziali
DBLVECTOR vAxRotPrec( nRotAxes, 0.) ;
DBLVECTOR vAxVal ;
// se non richiesti angoli Home e utensile non cambiato, uso gli angoli finali della lavorazione precedente
if ( GetUserNotesZmax() != 2 && ! sPrevTool.empty() && ! ToolChangeNeeded( *pPrevOp, *this) &&
if ( ! bHintHome && GetUserNotesZmax() != 2 && ! sPrevTool.empty() && ! ToolChangeNeeded( *pPrevOp, *this) &&
pPrevOp->GetFinalAxesValues( true, vAxVal)) {
for ( int i = 0 ; i < nRotAxes ; ++ i)
vAxRotPrec[i] = vAxVal[nLinAxes + i] ;
@@ -1863,7 +1866,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
vAxRotPrec = vAxRotHome ;
}
// se ci sono suggerimenti validi per gli assi rotanti, li applico
if ( ! sHint.empty()) {
if ( ! bHintHome && ! sHint.empty()) {
STRVECTOR vsTok ;
Tokenize( sHint, ",;", vsTok) ;
for ( const auto& sTok : vsTok) {
@@ -2763,8 +2766,16 @@ Operation::CalculateRobotAxesValues( bool bFirst, const Point3d& ptP, const Vect
}
}
// Scelgo la soluzione più vicina
// se esiste solo la prima
if ( vAng2.empty())
vAxVal = vAng1 ;
// evito passaggio per lo zero di R5 (per evitare passaggio attraverso direzione singolare)
else if ( vAng1[4] * vAxRotPrec[4] >= 0 && vAng2[4] * vAxRotPrec[4] < 0)
vAxVal = vAng1 ;
else if ( vAng1[4] * vAxRotPrec[4] < 0 && vAng2[4] * vAxRotPrec[4] >= 0)
vAxVal = vAng2 ;
// minimizzo rotazione polso
if ( vAng2.empty() || abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
else if ( abs( vAng1[3] - vAxRotPrec[3]) < abs( vAng2[3] - vAxRotPrec[3]) + 10 * EPS_ANG_SMALL)
vAxVal = vAng1 ;
else
vAxVal = vAng2 ;
@@ -2822,8 +2833,10 @@ Operation::VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
dLinTol = max( dLinTol, 2 * EPS_SMALL) ;
bool bInTol = ( dDist <= dLinTol) ;
if ( ExeGetDebugLevel() >= 5) {
string sOut = "Midpoint dist = " + ToString( dDist, -4) +
string sOut = "Midpoint dist=" + ToString( dDist, -4) +
( nMoveType == 0 ? " (G0" : " (G1") + " Cnt=" + ToString( nCnt) + ") " + ( bInTol ? "Ok" : "Split") ;
if ( ! bInTol)
sOut += " - Ap=" + ToString( vAxPrec, -2) + " An=" + ToString( vAxVal, -2) ;
LOG_INFO( GetEMkLogger(), sOut.c_str())
}
@@ -2887,13 +2900,11 @@ Operation::VerifyRobotLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
pMidCamData->SetFlag2( -1) ;
pMidCamData->SetToolShow( bToolShow && nCnt < 4) ;
// calcolo gli assi per il punto medio
DBLVECTOR vAxRotHome( vAxVal.size()) ;
DBLVECTOR vAxRotPrec( vAxVal.size()) ;
for ( int i = 0 ; i < int( vAxVal.size()) ; ++ i)
vAxRotPrec[i] = vAxVal[i] ;
DBLVECTOR vAxRotHome( vAxMid.size()) ;
DBLVECTOR vAxRotPrec( vAxMid) ;
if ( ! CalculateRobotAxesValues( false, ptMid, vtDirMid, vtAuxMid,
true, INFINITO, vAxRotHome, vAxRotPrec, vAxMid)) {
pMidCamData->SetAxes( CamData::AS_ERR, vAxVal) ;
pMidCamData->SetAxes( CamData::AS_ERR, vAxMid) ;
return false ;
}
// verifico di essere nelle corse degli assi
+11 -5
View File
@@ -1111,11 +1111,17 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove)
break ;
case CamData::AS_OUTSTROKE : {
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
if ( ! m_pMchMgr->GetCurrIsRobot()) {
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
}
else {
int nStat ;
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
}
nStatus = MCH_SIM_OUTSTROKE ;
return false ; }
case CamData::AS_DIR_ERR :
+11 -5
View File
@@ -1054,11 +1054,17 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove)
break ;
case CamData::AS_OUTSTROKE : {
DBLVECTOR OutAxes = pCamData->GetAxesVal() ;
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
if ( ! m_pMchMgr->GetCurrIsRobot()) {
for ( size_t i = OutAxes.size() ; i < 5 ; ++ i)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
}
else {
int nStat ;
m_pMachine->VerifyOutstroke( 0, 0, 0, OutAxes, true, nStat) ;
}
nStatus = MCH_SIM_OUTSTROKE ;
return false ; }
case CamData::AS_DIR_ERR :