Merge commit '46e52e09950db882602fdf54b0f4f676f900cbbf' into Sgrossature

This commit is contained in:
Riccardo Elitropi
2024-07-30 14:02:03 +02:00
6 changed files with 73 additions and 17 deletions
+1 -1
View File
@@ -2300,7 +2300,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
return false ;
}
// ciclo di affondamento a step
const double MIN_STEP = 5 ;
const double MIN_STEP = 1 ;
const double APPR_STEP = 1 ;
const double MIN_MOVE = 1 ;
double dStep = max( m_Params.m_dStep, MIN_STEP) ;
BIN
View File
Binary file not shown.
+1
View File
@@ -126,6 +126,7 @@ class Machine
bool GetAllCurrAxesNames( STRVECTOR& vAxName) const ;
bool GetCurrAxisToken( int nInd, std::string& sAxToken) const ;
bool GetAllCurrAxesTokens( STRVECTOR& vAxToken) const ;
bool GetCurrAxisType( int nInd, bool& bHead) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
+17
View File
@@ -1947,6 +1947,23 @@ Machine::GetAllCurrAxesTokens( STRVECTOR& vAxToken) const
return bOk ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisType( int nInd, bool& bHead) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
bHead = m_vCalcLinAx[nInd].bHead ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
bHead = m_vCalcRotAx[nInd-nLinAxes].bHead ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisMin( int nInd, double& dMin) const
+51 -15
View File
@@ -1984,6 +1984,8 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
Vector3d vtBackAux ;
pMachine->GetBackAuxDirFromAngles( vAxRot, vtBackAux) ;
pCamData->SetBackAuxDir( vtBackAux) ;
// tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// se punto finale di linea
if ( ! bFirst && pCamData->IsLine()) {
// Verifica ricorsiva del punto medio
@@ -1991,7 +1993,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
bool bAxesError ;
if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec,
ptP, vtDir, vtAux, vtCorr, vAxVal,
0, nEntId, dRot1W, bMidAdded, bAxesError)) {
0, nEntId, dRot1W, nMoveType, bMidAdded, bAxesError)) {
LOG_ERROR( GetEMkLogger(), "Error : VerifyLineMidPoint of CalculateClPathAxesValues failed")
return false ;
}
@@ -2301,7 +2303,7 @@ Operation::CalculateRotAxesValues( bool bFirst, const Vector3d& vtTool, const Ve
bool
Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, double dRot1W, bool& bAdded, bool& bAxError)
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError)
{
// impostazioni
bAdded = false ;
@@ -2340,6 +2342,8 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
return false ;
// LOG_INFO( GetEMkLogger(), ( "Midpoint dist =" + ToString( dDist, 3)).c_str())
double dLinTol = GetApproxLinTol() ;
if ( nMoveType == 0)
dLinTol = max( 10 * dLinTol, LIN_TOL_RAW) ;
// Se posizione in tolleranza, non devo fare alcunché
if ( dDist <= dLinTol)
@@ -2349,13 +2353,13 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
Point3d ptMid = Media( ptPrec, ptP) ;
Vector3d vtDirMid = Media( vtDirPrec, vtDir) ;
if ( ! vtDirMid.Normalize())
return true ;
return ( nMoveType == 0) ;
Vector3d vtAuxMid = Media( vtAuxPrec, vtAux) ;
if ( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ! vtAuxMid.Normalize())
return true ;
return ( nMoveType == 0) ;
Vector3d vtCorrMid = Media( vtCorrPrec, vtCorr) ;
if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ! vtCorrMid.Normalize())
return true ;
return ( nMoveType == 0) ;
// inserisco nuova entità e modifico vecchia
int nMidEntId = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
if ( nMidEntId == GDB_ID_NULL)
@@ -2415,7 +2419,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
bool bAdded1, bAxError1, bAdded2, bAxError2 ;
if ( ! VerifyLineMidPoint( ptPrec, vtDirPrec, vtAuxPrec, vtCorrPrec, vAxPrec,
ptMid, vtDirMid, vtAuxMid, vtCorrMid, vAxMid,
nCnt, nMidEntId, dRot1W, bAdded1, bAxError1))
nCnt, nMidEntId, dRot1W, nMoveType, bAdded1, bAxError1))
return false ;
if ( bAxError1) {
bAxError = true ;
@@ -2423,7 +2427,7 @@ Operation::VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec,
}
if ( ! VerifyLineMidPoint( ptMid, vtDirMid, vtAuxMid, vtCorrMid, vAxMid,
ptP, vtDir, vtAux, vtCorr, vAxVal,
nCnt, nEntId, dRot1W, bAdded2, bAxError2))
nCnt, nEntId, dRot1W, nMoveType, bAdded2, bAxError2))
return false ;
if ( bAxError2) {
bAxError = true ;
@@ -4004,6 +4008,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
pMch->GetAllCurrAxesNames( vAxName) ;
if ( vAxName.size() != vAxStart.size() || vAxName.size() != vAxEnd.size())
return false ;
// Porto la macchina in home
pMch->ResetAllAxesPos() ;
// Elenco grezzi attivi
@@ -4027,12 +4032,6 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
// Aggancio bloccaggi alla tavola corrente
for ( const auto nFxtId : vFxtId)
pMch->LinkFixtureToGroup( nFxtId, sTable) ;
// Parti di tavola da considerare per la collisione
INTVECTOR vTabCollId ;
pMch->GetCurrTableCollGroups( vTabCollId) ;
// Parti di testa e collegati da considerare per la collisione
INTVECTOR vHeadCollId ;
pMch->GetCurrHeadCollGroups( vHeadCollId) ;
// Lancio la verifica custom
int nRes = SpecialTestCollisionAvoid( vAxStart, vAxEnd) ;
@@ -4041,6 +4040,45 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
return ( nRes == SCAV_AVOID) ;
}
// Verifica standard
bool bCollAvoid ;
int nHeadOrder = 0 ;
if ( nHeadOrder == 0) {
bCollAvoid = OneMoveTestCollisionAvoid( vAxName, vAxStart, vAxEnd, pMch, vRawId, vFxtId) ;
}
else {
DBLVECTOR vAxMid( int( vAxName.size())) ;
// ciclo sugli assi correnti, assegno opportunamente valori a seconda del tipo (testa o tavola)
for ( int i = 0 ; i < int( vAxName.size()) ; ++ i) {
bool bHead ; pMch->GetCurrAxisType( i, bHead) ;
if ( nHeadOrder == -1)
vAxMid[i] = ( bHead ? vAxEnd[i] : vAxStart[i]) ;
else if ( nHeadOrder == +1) {
vAxMid[i] = ( bHead ? vAxStart[i] : vAxEnd[i]) ;
}
}
bCollAvoid = OneMoveTestCollisionAvoid( vAxName, vAxStart, vAxMid, pMch, vRawId, vFxtId) &&
OneMoveTestCollisionAvoid( vAxName, vAxMid, vAxEnd, pMch, vRawId, vFxtId) ;
}
// Ripristino lo stato macchina
ResetMachine( pMch) ;
return bCollAvoid ;
}
//----------------------------------------------------------------------------
bool
Operation::OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const
{
// Parti di tavola da considerare per la collisione
INTVECTOR vTabCollId ;
pMch->GetCurrTableCollGroups( vTabCollId) ;
// Parti di testa e collegati da considerare per la collisione
INTVECTOR vHeadCollId ;
pMch->GetCurrHeadCollGroups( vHeadCollId) ;
// distanza di sicurezza
const double TOL_SAFEDIST = 5.0 ;
const double MIN_SAFEDIST = 5.0 ;
@@ -4230,8 +4268,6 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
}
}
}
// Ripristino lo stato macchina
ResetMachine( pMch) ;
return ( ! bCollide) ;
}
+3 -1
View File
@@ -192,7 +192,7 @@ class Operation : public IUserObj
const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec, DBLVECTOR& vAxRot) ;
bool VerifyLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, double dRot1W, bool& bAdded, bool& bAxError) ;
int nCnt, int nEntId, double dRot1W, int nMoveType, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
@@ -220,6 +220,8 @@ class Operation : public IUserObj
int GetUserNotesZmax( void) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;