diff --git a/SimulatorMP.cpp b/SimulatorMP.cpp index 2bcb705..fcacfde 100644 --- a/SimulatorMP.cpp +++ b/SimulatorMP.cpp @@ -48,9 +48,10 @@ using namespace std ; //---------------------------------------------------------------------------- static const double MIN_STEP = 1.0 ; -static const double MAX_STEP = 500.0 ; static const double MID_STEP = 50.0 ; +static const double MAX_STEP = 500.0 ; static const double COLL_STEP = 10. ; +static const double MAX_COLL_STEP = 100. ; static const double SQ_COEFF_ROT_MOVE = 100. ; static const double COEFF_LIM = 0.999 ; static const double SAFEDIST_STD = 5.0 ; @@ -2574,6 +2575,7 @@ SimulatorMP::ExecCmdData( int& nStatus) static const int STEP_RAPID = -2 ; static const int STEP_RAPROT = -3 ; static const int STEP_COLLROT = -4 ; + double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ; int nStep = 1 ; for ( int i = 0 ; i < nAxCount ; ++ i) { double dMove = abs( CmdCurr.vAxNaEpSt[i].dEndPos - vPrev[i]) ; @@ -2588,7 +2590,7 @@ SimulatorMP::ExecCmdData( int& nStatus) else // STEP_COLLROT dStep = min( 0.4 * m_dStep, 10.) ; } - dStep = max( dStep, 1.) ; + dStep = Clamp( dStep, MIN_STEP, dMaxStep) ; int nAxStep = int( dMove / dStep) + 1 ; nStep = max( nStep, nAxStep) ; } diff --git a/SimulatorSP.cpp b/SimulatorSP.cpp index f3572fc..28380e8 100644 --- a/SimulatorSP.cpp +++ b/SimulatorSP.cpp @@ -51,9 +51,10 @@ using namespace std ; //---------------------------------------------------------------------------- static const double MIN_STEP = 1.0 ; -static const double MAX_STEP = 500.0 ; static const double MID_STEP = 50.0 ; +static const double MAX_STEP = 500.0 ; static const double COLL_STEP = 10. ; +static const double MAX_COLL_STEP = 100. ; static const double SQ_COEFF_ROT_MOVE = 100. ; static const double COEFF_LIM = 0.999 ; static const double SAFEDIST_STD = 5.0 ; @@ -2561,6 +2562,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) static const int STEP_RAPID = -2 ; static const int STEP_RAPROT = -3 ; static const int STEP_COLLROT = -4 ; + double dMaxStep = ( NeedCollisionCheck() ? MAX_COLL_STEP : MAX_STEP) ; bool bViewAllFrames = true ; int nStep = 1 ; for ( int i = 0 ; i < nAxCount ; ++ i) { @@ -2576,11 +2578,11 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) bViewAllFrames = ( bIsRobot ? true : false) ; } else { // STEP_COLLROT - dStep = min( 0.4 * m_dStep, 10.) ; + dStep = min( 0.4 * m_dStep, COLL_STEP) ; bViewAllFrames = ( bIsRobot ? true : false) ; } } - dStep = max( dStep, 1.) ; + dStep = Clamp( dStep, MIN_STEP, dMaxStep) ; int nAxStep = int( dMove / dStep) + 1 ; nStep = max( nStep, nAxStep) ; } @@ -2613,7 +2615,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) } } // Aggiorno visualizzazione - if ( bViewAllFrames || ( i % 4) == 0 || i == nStep) + if ( bViewAllFrames || ( i % 8) == 0 || i == nStep) ExeDraw() ; // Verifico collisioni int nCdInd, nObjInd ; @@ -2649,7 +2651,7 @@ SimulatorSP::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) // Gestione aggiornamenti... if ( ExeGetEnableUI()) { // Aggiornamento interfaccia - ExeProcessEvents( 0, 4) ; + ExeProcessEvents( 0, 0) ; while ( m_nUiStatus == MCH_UISIM_PAUSE) { ExeProcessEvents( 0, 4) ; }