Liebe Community,
mein Ziel ist es, dass der Roboter an jedem Punkt seine Position kennt, weswegen ich mehrere Trigger auf einen Punkt setzen will, so wie es auch bei KUKA möglich ist.
Aktuell löse ich das über MoveJSync Befehle mit quasi je einer Unterroutine für jeden Punkt. Das finde ich sehr unschön.
Nun habe ich mir ein Testprogramm mit eigenen TriggJ/ TriggL Befehlen geschrieben und nutze ein TriggArray, um die verschiedenen Bedingungen zu setzen, doch es werden von 4 Punkten immer die letzten 2 Trigger ausgelöst, außer ich setze sie auf den Start punkt (\ Start), was aber ja falsch ist.
Hat jemand eine Idee, wo das Problem liegt?
Hier meine Programme:
MODUL triggtest
!*************************************************************************************************
! Punktdaten
!*************************************************************************************************
VAR Robtarget P1 := ...;
VAR Robtarget P2 := ...;
VAR Robtarget P3 := ...;
VAR Robtarget P4 := ...;
!*************************************************************************************************
PROC testtrigg()
TMoveJ P1,"SPEED_SLOW",zfine,tGRIP,"V1",\bCheckGripper:=true,\bFirstPoint:=true;
TMoveJ P2,"SPEED_SLOW",zfast,tGRIP,"V2";
TMoveJ P3,"SPEED_SLOW",zfine,tGRIP,"V3"; *! Trigger wird an Punkt 4 ausgeführt (getestet mit TPWrite)*
TMoveL P4,"SPEED_SLOW",zfine,\tmpSTOP:=TargetPos,tGRIP,"XX"; *! Trigger wird bei Genauhalt ausgeführt*
ENDPROC
ENDMODUL
!********************************************************************************************
VAR triggdata trigg_array{25};
VAR intnum irSetRobPos{25};
!********************************************************************************************
!***************************************************
! MoveJ Bewegung
!***************************************************
PROC TMoveJ(robtarget tmpPOS, string tmpSPEED, zonedata tmpZONE, \stoppointdata tmpSTOP, tooldata tmpTOOL, string tmpSubLocation, \bool bCheckGripper, \bool bFirstPoint, \bool bLOCK, \bool bUNLOCK)
VAR bool tmpCheckGripper;
VAR bool tmpFirstPoint;
VAR bool tmpLOCK;
VAR bool tmpUNLOCK;
tmpCheckGripper := Vorhanden(bCheckGripper);
tmpFirstPoint := Vorhanden(bFirstPoint);
tmpLOCK := Vorhanden(bLOCK);
tmpUNLOCK := Vorhanden(bUNLOCK);
GetTrapData tmpSubLocation, \bCheckGripper:=tmpCheckGripper, \bFirstPoint:=tmpFirstPoint, \bLOCK:=tmpLOCK, \bUNLOCK:=tmpUNLOCK;
if Present(tmpSTOP) dann
TriggJ tmpPOS,VASet(tmpSPEED),trigg_array,tmpZONE,\inpos:=tmpSTOP,tGRIP;
oder
TriggJ tmpPOS,VASet(tmpSPEED),trigg_array,tmpZONE,tGRIP;
endif
ENDPROC
!***************************************************
! Triggervariablen
!***************************************************
PROC GetTrapData(string tmpSubLocation, \bool bCheckGripper, \bool bFirstPoint, \bool bLOCK, \bool bUNLOCK)
f o r i f r o m 1 t o 25 Do
TriggDataReset trigg_array{i};
IDelete irSetRobPos{i};
CONNECT irSetRobPos{i} WITH tSETPOS;
endfor
if Present(bCheckGripper) and bCheckGripper=true then
TriggInt trigg_array{1},0,\Start,irSetRobPos{1};
endif
if Present(bFirstPoint) and bFirstPoint then
TriggInt trigg_array{10},10,irSetRobPos{10};
endif
test tmpSubLocation
case "V1":
TriggInt trigg_array{11},0,irSetRobPos{11};
case "V2":
...
default:
endtest
if Present(bLOCK) and bLOCK then
TriggInt trigg_array{24},0,irSetRobPos{24};
endif
if Present(bUNLOCK) and bUNLOCK then
TriggInt trigg_array{25},0,\Next,irSetRobPos{25};
endif
ENDPROC
!***************************************************
! Triggerroutine
!***************************************************
TRAP tSETPOS
VAR recLOCATIONS tmpROBOT_LOCATION;
tmpROBOT_LOCATION := ROBOT_LOCATION;
if TriggDataValid(trigg_array{1}) then
CHECK_GRIPPER "GRIP_OPN";
endif
if TriggDataValid(trigg_array{10}) then
tmpROBOT_LOCATION.actual := ROBOT_LOCATION.destination;
endif
if TriggDataValid(trigg_array{11}) then
tmpROBOT_LOCATION.sub := "V1";
endif
...
ROBOT_LOCATION := tmpROBOT_LOCATION;
if TriggDataValid(trigg_array{24}) then
LOCK_AREA ROBOT_LOCATION.actual;
endif
if TriggDataValid(trigg_array{25}) then
UNLOCK_AREA ROBOT_LOCATION.source;
endif
ENDTRAP
ENDMODULE