EgtMachKernel :

- modifiche a simulazione per corretta gestione single step.
This commit is contained in:
Dario Sassi
2018-08-16 07:40:54 +00:00
parent c4e8249b78
commit fadc439156
2 changed files with 12 additions and 8 deletions
+10 -8
View File
@@ -33,7 +33,10 @@ using namespace std ;
// 1001 = "Error with setup : xxx"
//----------------------------------------------------------------------------
const double COEFF_LIM = 0.999 ;
static const double MIN_STEP = 1.0 ;
static const double MAX_STEP = 100.0 ;
static const double MID_STEP = 50.0 ;
static const double COEFF_LIM = 0.999 ;
//----------------------------------------------------------------------------
Simulator::Simulator( void)
@@ -41,7 +44,8 @@ Simulator::Simulator( void)
m_pMchMgr = nullptr ;
m_pGeomDB = nullptr ;
m_pMachine = nullptr ;
m_dStep = 5.0 ;
m_dStep = MID_STEP ;
m_nUiStatus = MCH_UISIM_NULL ;
m_nOpId = GDB_ID_NULL ;
m_nOpInd = 0 ;
m_nCLPathId = GDB_ID_NULL ;
@@ -329,8 +333,6 @@ Simulator::GetMoveInfo( int& nGmove, double& dFeed) const
bool
Simulator::SetStep( double dStep)
{
const double MIN_STEP = 1.0 ;
const double MAX_STEP = 100.0 ;
m_dStep = Clamp( dStep, MIN_STEP, MAX_STEP) ;
// imposto step per movimenti gestiti nelle macro di simulazione
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMSTEP, m_dStep) ;
@@ -343,7 +345,7 @@ Simulator::SetUiStatus( int nUiStatus)
{
m_nUiStatus = nUiStatus ;
// imposto stato simulatore a livello utente per movimenti gestiti nelle macro di simulazione
m_pMachine->LuaSetGlobVar( GLOB_VAR + ".SIMUISTAT", m_nUiStatus) ;
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIMUISTAT, m_nUiStatus) ;
return true ;
}
@@ -865,8 +867,8 @@ Simulator::ManageMove( int& nStatus)
if ( Stopped())
return true ;
dCurrMove += dMove ;
// se non raggiunto lo step
if ( m_dCoeff > COEFF_LIM && dCurrMove < 0.9 * m_dStep) {
// se modalità play e fine entità e non raggiunta la lunghezza di movimento voluto
if ( m_nUiStatus == MCH_UISIM_PLAY && nStatus == MCH_SIM_END_STEP && dCurrMove < 0.75 * m_dStep) {
// recupero una nuova entità
m_nEntId = m_pGeomDB->GetNext( m_nEntId) ;
m_dCoeff = 0 ;
@@ -1058,7 +1060,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
}
}
}
// Altrimenti sto muovendomi all'interno dello step
// Altrimenti sto muovendomi all'interno dell'entità
else
nStatus = MCH_SIM_OK ;