Se posso fare scambio diretto non suddivido il movimento
This commit is contained in:
+44
-29
@@ -1402,6 +1402,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
|
||||
-- scambio diretto
|
||||
if ( ( dYDeltaI - dVDeltaF) >= MinY - MaxV + DELTA_SIC and dDeltaBeam > 0) or ( ( dVDeltaI - dYDeltaF) >= MinY - MaxV + DELTA_SIC and dDeltaBeam < 0) then
|
||||
local bCloseY, bCloseV
|
||||
-- se sono entrambe in presa sul pezzo
|
||||
if EMC.YDELTA and EMC.VDELTA then
|
||||
-- se da scarico a carico
|
||||
@@ -1409,26 +1410,26 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
table.insert( vCmd, { 0, 'Direct - V to position first'})
|
||||
table.insert( vCmd, { 12, 0})
|
||||
-- suddivido il movimento su entrambe le morse
|
||||
local nTotMove = ( dVDeltaF - dVDeltaI) / 2 ;
|
||||
local nTotMove = ( dVDeltaF - dVDeltaI) ;
|
||||
dTPosA = dTPosI - nTotMove
|
||||
dVPosA = dTPosA + dVDeltaF
|
||||
dYPosA = dTPosA + dYDeltaI
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
table.insert( vCmd, { 12, 1})
|
||||
table.insert( vCmd, { 11, 0})
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
bCloseY = true
|
||||
else
|
||||
table.insert( vCmd, { 0, 'Direct - Y to position first'})
|
||||
table.insert( vCmd, { 11, 0})
|
||||
-- suddivido il movimento su entrambe le morse
|
||||
local nTotMove = ( dYDeltaF - dYDeltaI) / 2 ;
|
||||
local nTotMove = ( dYDeltaF - dYDeltaI) ;
|
||||
dTPosA = dTPosI - nTotMove
|
||||
dVPosA = dTPosA + dVDeltaI
|
||||
dYPosA = dTPosA + dYDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
table.insert( vCmd, { 11, 1})
|
||||
table.insert( vCmd, { 12, 0})
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
bCloseV = true
|
||||
end
|
||||
-- se pinza al carico in presa
|
||||
elseif EMC.YDELTA then
|
||||
@@ -1441,7 +1442,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
table.insert( vCmd, { 12, 1})
|
||||
table.insert( vCmd, { 11, 0})
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
bCloseY = true
|
||||
-- se pinza allo scarico in presa
|
||||
else
|
||||
table.insert( vCmd, { 0, 'Direct - Y to position first'})
|
||||
@@ -1453,41 +1454,50 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
table.insert( vCmd, { 11, 1})
|
||||
table.insert( vCmd, { 12, 0})
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
bCloseV = true
|
||||
end
|
||||
|
||||
-- sposto il carrello Y in posizione
|
||||
if EMC.YDELTANEXT then
|
||||
-- sposto il carrello Y in parcheggio
|
||||
dYPosA = dTPosA + dYDeltaF
|
||||
table.insert( vCmd, { 1, 'Y', dYPosA})
|
||||
table.insert( vCmd, { 11, 1})
|
||||
end
|
||||
|
||||
-- sposto il carrello Y in posizione
|
||||
if EMC.VDELTANEXT then
|
||||
-- sposto il carrello Y in parcheggio
|
||||
dVPosA = dTPosA + dVDeltaF
|
||||
table.insert( vCmd, { 1, 'V', dVPosA})
|
||||
table.insert( vCmd, { 12, 1})
|
||||
end
|
||||
|
||||
-- imposto i nuovi parametri di aggancio
|
||||
-- se entrambi in presa
|
||||
if EMC.YDELTANEXT and EMC.VDELTANEXT then
|
||||
dTPosA = dTPosF
|
||||
dYPosA = dTPosF + dYDeltaF
|
||||
dVPosA = dTPosF + dVDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
if bCloseY then table.insert( vCmd, { 11, 1}) end
|
||||
if bCloseV then table.insert( vCmd, { 12, 1}) end
|
||||
table.insert( vCmd, { 21, dYDeltaF, dVDeltaF})
|
||||
-- sposto il carrello Y in posizione
|
||||
elseif EMC.YDELTANEXT then
|
||||
-- vado in posizione e sposto il carrello V in parcheggio
|
||||
dYPosA = MinY
|
||||
dTPosA = MinY - dYDeltaF
|
||||
dVPosA = dTPosA + dVDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
if bCloseY then table.insert( vCmd, { 11, 1}) end
|
||||
table.insert( vCmd, { 12, 0})
|
||||
-- sposto il carrello V in parcheggio
|
||||
table.insert( vCmd, { 1, 'V', ParkV})
|
||||
table.insert( vCmd, { 21, dYDeltaF, 0})
|
||||
-- sposto il carrello Y in posizione
|
||||
else
|
||||
dVPosA = MaxV
|
||||
dTPosA = MaxV - dVDeltaF
|
||||
dYPosA = - ( dTPosA + dYDeltaF)
|
||||
-- vado in posizione e sposto il carrello Y in parcheggio
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
if bCloseV then table.insert( vCmd, { 12, 1}) end
|
||||
table.insert( vCmd, { 11, 0})
|
||||
-- sposto il carrello Y in parcheggio
|
||||
table.insert( vCmd, { 1, 'Y', ParkY})
|
||||
table.insert( vCmd, { 21, 0, dVDeltaF})
|
||||
end
|
||||
|
||||
-- movimento terminato
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
|
||||
-- se devo recuperare corsa con passo del pellegrino
|
||||
else
|
||||
local bForceMoveY = false
|
||||
-- compatto al centro
|
||||
if not EMC.YDELTA then
|
||||
table.insert( vCmd, { 0, 'Compact Y'})
|
||||
@@ -1510,6 +1520,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
table.insert( vCmd, { 12, 1})
|
||||
EMC.VDELTA = true
|
||||
bForceMoveY = true
|
||||
dVDeltaI = dYDeltaI + MaxV - MinY
|
||||
dTPosI = dTPosA
|
||||
end
|
||||
@@ -1519,7 +1530,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
|
||||
-- a questo punto entrambe le pinze sono in presa sul pezzo. Il trascinatore si decide in base alla direzione di movimento trave
|
||||
-- trascino con morsa allo scarico
|
||||
if dDeltaBeam > 0 then
|
||||
if dDeltaBeam > 0 or bForceMoveY then
|
||||
-- apro morsa al carico
|
||||
table.insert( vCmd, { 11, 0})
|
||||
-- devo recuperare più del doppio delle corse
|
||||
@@ -1555,7 +1566,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
-- non serve recuperare al massimo della corsa, suddivido movimento in due
|
||||
else
|
||||
-- suddivido il movimento su entrambe le morse
|
||||
local nTotMove = abs( dYDeltaI - dYDeltaF) / 2 ;
|
||||
local nTotMove = ( dYDeltaF - dYDeltaI) / 2 ;
|
||||
|
||||
dYPosA = dTPosI + dYDeltaI + nTotMove
|
||||
dVPosA = dTPosI + dVDeltaI - nTotMove
|
||||
@@ -1567,7 +1578,11 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
-- aggiorno nuova posizione della morsa al carico dopo riposizionamento
|
||||
dYDeltaI = dYDeltaF ;
|
||||
|
||||
if EMC.YDELTANEXT then
|
||||
if not EMC.VDELTANEXT then
|
||||
dTPosA = dTPosF
|
||||
dYPosA = dTPosF + dYDeltaF
|
||||
dVPosA = ParkV
|
||||
elseif EMC.YDELTANEXT then
|
||||
dTPosA = dTPosF
|
||||
dYPosA = dTPosF + dYDeltaF
|
||||
dVPosA = dTPosF + dVDeltaF
|
||||
@@ -1638,7 +1653,7 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
-- non serve recuperare al massimo della corsa, suddivido movimento in due
|
||||
else
|
||||
-- suddivido il movimento su entrambe le morse
|
||||
local nTotMove = abs( dVDeltaI - dVDeltaF) / 2 ;
|
||||
local nTotMove = ( dVDeltaI - dVDeltaF) / 2 ;
|
||||
|
||||
dYPosA = dTPosI + dYDeltaI + nTotMove
|
||||
dVPosA = dTPosI + dVDeltaI - nTotMove
|
||||
@@ -1656,8 +1671,8 @@ function SpecAdjustCarriages( vCmd, dTPosI, dYDeltaI, dVDeltaI, dTPosF, dYDeltaF
|
||||
dVPosA = dTPosF + dVDeltaF
|
||||
else
|
||||
dVPosA = MaxV
|
||||
dTPosA = MaxY - dVDeltaF
|
||||
dYPosA = - dTPosA - dVDeltaF
|
||||
dTPosA = MaxV - dVDeltaF
|
||||
dYPosA = - dTPosA - dYDeltaF
|
||||
end
|
||||
table.insert( vCmd, { 3, 'Y', dYPosA , 'T', dTPosA, 'V', dVPosA})
|
||||
dTPosI, dYDeltaI, dVDeltaI = dTPosF, dYDeltaF, dVDeltaF
|
||||
|
||||
Reference in New Issue
Block a user