EgtMachKernel :
- miglioria alla funzione EmtMoveAxes per gestire anche rappresentazioni simboliche delle feed (con interi negativi).
This commit is contained in:
+20
-3
@@ -2078,10 +2078,26 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
|
||||
}
|
||||
// Determino gli step di movimento
|
||||
static const int STEP_FEED = -1 ;
|
||||
static const int STEP_RAPID = -2 ;
|
||||
static const int STEP_RAPROT = -3 ;
|
||||
static const int STEP_COLLROT = -4 ;
|
||||
int nStep = 1 ;
|
||||
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||
double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ;
|
||||
int nAxStep = int( dMove / max( vAxNaEpSt[i].dStep, 1.)) + 1 ;
|
||||
double dStep = vAxNaEpSt[i].dStep ;
|
||||
if ( dStep < 0) {
|
||||
if ( abs( dStep - STEP_FEED) < EPS_SMALL)
|
||||
dStep = m_dStep ;
|
||||
else if ( abs( dStep - STEP_RAPID) < EPS_SMALL)
|
||||
dStep = 4 * m_dStep ;
|
||||
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL)
|
||||
dStep = 0.4 * m_dStep ;
|
||||
else // STEP_COLLROT
|
||||
dStep = min( 0.4 * m_dStep, 10.) ;
|
||||
}
|
||||
dStep = max( dStep, 1.) ;
|
||||
int nAxStep = int( dMove / dStep) + 1 ;
|
||||
nStep = max( nStep, nAxStep) ;
|
||||
}
|
||||
// Eseguo il movimento
|
||||
@@ -2153,10 +2169,11 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
if ( m_nUiStatus == MCH_UISIM_STOP)
|
||||
return SIM_AXMV_RES_STOP ;
|
||||
// Se cambia lo step di simulazione in modo significativo ...
|
||||
if ( abs( ( m_dStep - dOrigStep) / ( m_dStep + dOrigStep)) > 0.2) {
|
||||
if ( abs( m_dStep - dOrigStep) > 10 || abs( ( m_dStep - dOrigStep) / ( m_dStep + dOrigStep)) > 0.2) {
|
||||
double dRat = m_dStep / dOrigStep ;
|
||||
for ( int j = 0 ; j < nAxCount ; ++ j) {
|
||||
const_cast<double&>( vAxNaEpSt[j].dStep) *= dRat ;
|
||||
if ( vAxNaEpSt[j].dStep > 0)
|
||||
const_cast<double&>( vAxNaEpSt[j].dStep) *= dRat ;
|
||||
}
|
||||
return MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user