From 7bad9a5cc6246ea2b3c66a5310f02ef5e4539849 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sun, 26 Oct 2025 19:25:10 +0100 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=20:=20-=20miglioria=20nel=20calco?= =?UTF-8?q?lo=20assi=20per=20robot=20(verifica=20continuit=C3=A0).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CamData.h | 2 ++ Operation.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/CamData.h b/CamData.h index a410ed1..96bf94c 100644 --- a/CamData.h +++ b/CamData.h @@ -72,6 +72,8 @@ class CamData : public IUserObj { m_bToolShow = bShow ; return true ; } int GetMoveType( void) const { return m_nMove ; } + bool IsRapid( void) const + { return ( m_nMove == 0) ; } bool IsLine( void) const { return ( m_nMove == 0 || m_nMove == 1) ; } bool IsArc( void) const diff --git a/Operation.cpp b/Operation.cpp index 8ebaf6d..665c8f5 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -2722,6 +2722,37 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinFor nFlag2Prec = pCamData->GetFlag2() ; bToolShowPrec = pCamData->GetToolShow() ; } + // controllo la continuità del movimento + const double MAX_DELTA_ANG = 45 ; + bool bRotContOnNext = ( GetType() != OPER_DISP) ; + int nInd = 0 ; + int nCount = m_pGeomDB->GetGroupObjs( nClPathId) ; + const DBLVECTOR* pvPrevAxVal = nullptr ; + for ( int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ; + nEntId != GDB_ID_NULL ; + nEntId = m_pGeomDB->GetNext( nEntId)) { + // indice del movimento + ++ nInd ; + // recupero i dati Cam dell'entità + CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ; + if ( pCamData == nullptr) + continue ; + const DBLVECTOR& vCurrAxVal = pCamData->GetAxesVal() ; + // se movimento di lavoro ed esiste precedente, li confronto + if ( ! pCamData->IsRapid() && pvPrevAxVal != nullptr) { + // Se richiesta continuità, verifico non ci siano salti + double dDeltaR4 = vCurrAxVal[3] - (*pvPrevAxVal)[3] ; + double dDeltaR6 = vCurrAxVal[5] - (*pvPrevAxVal)[5] ; + if ( bRotContOnNext && ( abs( dDeltaR4) > MAX_DELTA_ANG || abs( dDeltaR6) > MAX_DELTA_ANG)) { + string sOut = "Lost continuity on R4 (Diff=" + ToString( dDeltaR4, 1) + + ") or R6 (Diff=" + ToString( dDeltaR6, 1) + + ") at move " + ToString( nInd) + " of " + ToString( nCount) ; + m_pMchMgr->SetWarning( 1101, sOut) ; + } + } + // salvo nuovi precedenti + pvPrevAxVal = &vCurrAxVal ; + } return bOk ; }