From f36c4288d42480a7d0d5c6d4336c72fdd535c7b4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 25 Sep 2025 19:36:16 +0200 Subject: [PATCH] =?UTF-8?q?EgtMacj=C3=AChKernel=20:=20-=20aggiunto=20nella?= =?UTF-8?q?=20simulazione=20(SP=20e=20MP)=20il=20controllo=20che=20il=20nu?= =?UTF-8?q?mero=20di=20valori=20assegnati=20sia=20uguale=20al=20numero=20d?= =?UTF-8?q?i=20assi=20correnti.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SimulatorMP.cpp | 10 ++++++++++ SimulatorSP.cpp | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/SimulatorMP.cpp b/SimulatorMP.cpp index 015f86a..199e4c8 100644 --- a/SimulatorMP.cpp +++ b/SimulatorMP.cpp @@ -1132,6 +1132,16 @@ SimulatorMP::ManageSingleMove( int& nStatus, double& dMove) return false ; } DBLVECTOR AxesEnd = pCamData->GetAxesVal() ; + // Controllo che il numero di valori corrisponda con quello degli assi + int nEndsCnt = int( AxesEnd.size()) ; + int nAxesCnt = int( m_AxesName.size()) ; + if ( nEndsCnt != nAxesCnt) { + nStatus = MCH_SIM_ERR ; + m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ; + string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) + return false ; + } // Tipo di movimento int nMoveType = pCamData->GetMoveType() ; // Se inizio di nuova entità, mascheratura movimento diff --git a/SimulatorSP.cpp b/SimulatorSP.cpp index ca55a0a..413f1fc 100644 --- a/SimulatorSP.cpp +++ b/SimulatorSP.cpp @@ -1055,7 +1055,7 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove) case CamData::AS_OUTSTROKE : { DBLVECTOR OutAxes = pCamData->GetAxesVal() ; if ( ! m_pMchMgr->GetCurrIsRobot()) { - for ( size_t i = OutAxes.size() ; i < 5 ; ++ i) + for ( int i = int( OutAxes.size()) ; i <= 5 ; ++ i) OutAxes.emplace_back( 0) ; DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ; int nStat ; @@ -1075,6 +1075,16 @@ SimulatorSP::ManageSingleMove( int& nStatus, double& dMove) return false ; } DBLVECTOR AxesEnd = pCamData->GetAxesVal() ; + // Controllo che il numero di valori corrisponda con quello degli assi + int nEndsCnt = int( AxesEnd.size()) ; + int nAxesCnt = int( m_AxesName.size()) ; + if ( nEndsCnt != nAxesCnt) { + nStatus = MCH_SIM_ERR ; + m_pMchMgr->SetLastError( 1003, "Error : mismatch between the number of values and of axes") ; + string sOut = "Error : " + ToString( nEndsCnt) + " values vs " + ToString( nAxesCnt) + " axes" ; + LOG_ERROR( GetEMkLogger(), sOut.c_str()) + return false ; + } // Tipo di movimento int nMoveType = pCamData->GetMoveType() ; // Se inizio di nuova entità, mascheratura movimento