EgtMachKernel 1.6k9 :

- aggiunti campi Rot2Stroke e SolCh a teste per limitare corse secondo asse rotante e dare criterio scelta soluzione
- utilizzo di questi dati nel calcolo assi macchina
- aggiunta GetCurrMachineName.
This commit is contained in:
Dario Sassi
2015-11-24 22:13:21 +00:00
parent 2f016585bb
commit ebccd64daa
11 changed files with 143 additions and 26 deletions
+64 -1
View File
@@ -75,6 +75,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
m_nCalcHeadId = GDB_ID_NULL ;
m_nCalcExitId = GDB_ID_NULL ;
m_nCalcToolId = GDB_ID_NULL ;
m_dCalcRot1W = 1 ;
m_nCalcSolCh = MCH_SCC_NONE ;
m_dCalcTLen = 0 ;
// recupero il gruppo della testa
int nHeadId = GetGroup( sHead) ;
@@ -103,6 +105,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
m_nCalcExitId = nExitId ;
m_nCalcToolId = nToolId ;
m_dCalcRot1W = pHead->GetRot1W() ;
m_nCalcSolCh = pHead->GetSolCh() ;
m_ptCalcPos = pExit->GetPos() ;
m_vtCalcDir = pExit->GetTDir() ;
m_vtCalcADir = pHead->GetADir() ;
@@ -201,6 +204,14 @@ Machine::CalculateKinematicChain( void)
// se entrambi di testa devo invertirne l'ordine
if ( m_vCalcRotAx[0].bHead && m_vCalcRotAx[1].bHead)
swap( m_vCalcRotAx[0], m_vCalcRotAx[1]) ;
// impongo limiti di corsa sul secondo asse rotante di testa
if ( m_vCalcRotAx[1].bHead) {
Head* pHead = GetHead( m_nCalcHeadId) ;
if ( pHead != nullptr) {
m_vCalcRotAx[1].stroke.Min = max( m_vCalcRotAx[1].stroke.Min, pHead->GetRot2Stroke().Min) ;
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
}
}
return true ;
}
// altrimenti non ancora gestito, quindi errore
@@ -300,7 +311,7 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
vtAx2.Invert() ;
// calcolo secondo angolo di rotazione
nStat = GetRotationComponent( vtDirH, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
// aggiornamento direzione fresa su testa
// aggiornamento direzioni fresa e ausiliaria su testa
if ( nStat >= 1) {
// se indeterminato lo azzero
if ( ! bDet)
@@ -347,8 +358,13 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
if ( ! bDet2) {
bool bDetX ;
vtDirI2.GetRotation( vtDirAn, vtAx1, dAngA2, bDetX) ;
if ( ! bDetX)
dAngA2 = 0 ;
}
}
// aggiornamento direzioni fresa e ausiliaria su testa
vtDirH2.Rotate( vtAx1, dAngA2) ;
vtDirI2.Rotate( vtAx1, dAngA2) ;
}
// calcolo primo angolo di rotazione per prima soluzione
@@ -361,6 +377,27 @@ Machine::GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
if ( ! bDet1) {
bool bDetX ;
vtDirI1.GetRotation( vtDirAn, vtAx1, dAngA1, bDetX) ;
if ( ! bDetX)
dAngA1 = 0 ;
}
}
// aggiornamento direzioni fresa e ausiliaria su testa
vtDirH1.Rotate( vtAx1, dAngA1) ;
vtDirI1.Rotate( vtAx1, dAngA1) ;
}
// verifiche per criterio scelta soluzione
if ( nStat >= 2) {
if ( ! VerifyScc( vtDirI2, vtDirAn, m_nCalcSolCh))
-- nStat ;
}
if ( nStat >= 1) {
if ( ! VerifyScc( vtDirI1, vtDirAn, m_nCalcSolCh)) {
-- nStat ;
// riloco eventuale soluzione rimasta
if ( nStat >= 1) {
dAngA1 = dAngA2 ;
dAngB1 = dAngB2 ;
}
}
}
@@ -441,6 +478,32 @@ Machine::GetPositions( const Point3d& ptP, double dAngA, double dAngB,
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::VerifyScc( const Vector3d& vtDirI, const Vector3d& vtDirA, int nSolCh)
{
switch ( nSolCh) {
default :
return true ;
case MCH_SCC_ADIR_XP :
return ( vtDirI.x > - EPS_ZERO) ;
case MCH_SCC_ADIR_XM :
return ( vtDirI.x < EPS_ZERO) ;
case MCH_SCC_ADIR_YP :
return ( vtDirI.y > - EPS_ZERO) ;
case MCH_SCC_ADIR_YM :
return ( vtDirI.y < EPS_ZERO) ;
case MCH_SCC_ADIR_ZP :
return ( vtDirI.z > - EPS_ZERO) ;
case MCH_SCC_ADIR_ZM :
return ( vtDirI.z < EPS_ZERO) ;
case MCH_SCC_ADIR_NEAR :
return ( ( vtDirI * vtDirA) > cos( 60 * DEGTORAD)) ;
case MCH_SCC_ADIR_FAR :
return ( ( vtDirI * vtDirA) < cos( 120 * DEGTORAD)) ;
}
}
//----------------------------------------------------------------------------
bool
Machine::AdjustAngleInStroke( int nId, double& dAng)