Commit before reloading Keyence camera on Profinet
This commit is contained in:
@@ -4,7 +4,11 @@
|
||||
<Declaration><![CDATA[// Positionen in um <=> 0.001mm
|
||||
FUNCTION_BLOCK FINAL FB_KukaRobot EXTENDS FB_PackMLGeneric
|
||||
VAR_INPUT
|
||||
eRobotJob : E_KukaRobot_JobNumberRobot;
|
||||
stJobParams : ST_KukaRobot_JobParams;
|
||||
|
||||
// Feedbacks from other units
|
||||
// like if a door is open and such things
|
||||
stUnitFeedbacks : ST_KukaRobot_UnitFeedbacks;
|
||||
|
||||
xReleaseAlarms : BOOL;
|
||||
xConfirmAlarms : BOOL;
|
||||
@@ -52,13 +56,15 @@ VAR
|
||||
_asiMotorTemps1To4 AT %I* : ARRAY[0..3] OF SINT;
|
||||
_asiMotorTemps5To8 AT %I* : ARRAY[0..3] OF SINT;
|
||||
|
||||
_eRobotJob : E_KukaRobot_JobNumberRobot;
|
||||
_ePlcJob :E_KukaRobot_JobNumerPLC;
|
||||
|
||||
_xRobotReady : BOOL;
|
||||
|
||||
_xError : BOOL;
|
||||
|
||||
// Internal job params will be copied from input
|
||||
// only from IDLE -> STARTING
|
||||
_stJobParams : ST_KukaRobot_JobParams;
|
||||
|
||||
// ======
|
||||
// Alarms
|
||||
@@ -139,12 +145,11 @@ IF _uState.stState.bT2 THEN
|
||||
END_IF
|
||||
|
||||
|
||||
// ==================
|
||||
// Write job outputs
|
||||
// ==================
|
||||
// ============================
|
||||
// Write unit feedbacks outputs
|
||||
// ============================
|
||||
|
||||
|
||||
//_uJobs.stJobs.wJobNrForRobot := _eRobotJob;
|
||||
//_uJobs.stJobs.wFinishedJobNrFromPlc := _ePlcJob;
|
||||
|
||||
|
||||
// =================
|
||||
@@ -236,8 +241,7 @@ END_IF]]></ST>
|
||||
<Declaration><![CDATA[METHOD M_Idle
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[
|
||||
]]></ST>
|
||||
<ST><![CDATA[_stJobParams := stJobParams;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_Resetting" Id="{dfe4d36a-80aa-4364-bfd8-6ddd41636d59}">
|
||||
@@ -309,29 +313,103 @@ END_CASE]]></ST>
|
||||
</Method>
|
||||
<Method Name="M_Starting" Id="{011f85d8-1225-4288-876f-918df6e4f235}">
|
||||
<Declaration><![CDATA[METHOD M_Starting
|
||||
]]></Declaration>
|
||||
VAR_INST
|
||||
_tonTimeout : TON;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Write robot job number
|
||||
_uJobs.stJobs.wJobNrForRobot := DINT_TO_WORD(_stRecipe.stProcessVariables.astParameterDInt[0].Value);
|
||||
<ST><![CDATA[CASE _iSSM OF
|
||||
// Check job parameters
|
||||
0:
|
||||
IF (_stJobParams.byGripperNumber < 0) OR (_stJobParams.byGripperNumber > 3) // Wrong gripper number
|
||||
OR (_stJobParams.byChuckNumber < 1) OR (_stJobParams.byChuckNumber > 6) // Wrong chuck number
|
||||
OR (_stJobParams.byGripperSide < 1) OR (_stJobParams.byGripperSide > 2) // Wrong gripper side
|
||||
THEN
|
||||
_eCmd := E_PackMLCmd.ABORT;
|
||||
ELSE
|
||||
_iSSM := 10;
|
||||
END_IF
|
||||
|
||||
// Transfer job data to robot
|
||||
10:
|
||||
// Pos x in um
|
||||
_diOffsetPosX := REAL_TO_DINT(_stJobParams.rPosX * 1000);
|
||||
|
||||
// Pos y in um
|
||||
_diOffsetPosY := REAL_TO_DINT(_stJobParams.rPosY * 1000);
|
||||
|
||||
// Thickness
|
||||
_diThickness := REAL_TO_DINT(_stJobParams.rThickness * 1000);
|
||||
|
||||
// Gripper side
|
||||
IF _stJobParams.byGripperSide = 1 THEN
|
||||
_uCtrl.stCtrl.bGripperSide1 := 1;
|
||||
_uCtrl.stCtrl.bGripperSide2 := 0;
|
||||
ELSIF _stJobParams.byGripperSide = 2 THEN
|
||||
_uCtrl.stCtrl.bGripperSide1 := 0;
|
||||
_uCtrl.stCtrl.bGripperSide2 := 1;
|
||||
ELSE
|
||||
_uCtrl.stCtrl.bGripperSide1 := 0;
|
||||
_uCtrl.stCtrl.bGripperSide2 := 0;
|
||||
END_IF
|
||||
|
||||
// Scan QR code
|
||||
IF stJobParams.xScanQRCode THEN
|
||||
_uCtrl.stCtrl.bScanQRCode := 1;
|
||||
ELSE
|
||||
_uCtrl.stCtrl.bScanQRCode := 0;
|
||||
END_IF
|
||||
|
||||
// Gripper number
|
||||
_abToolsAndPositions[0] := DINT_TO_BYTE(_stRecipe.stProcessVariables.astParameterDInt[1].Value);
|
||||
// Position on hotplate
|
||||
_abToolsAndPositions[2] := stJobParams.byPlaceOnHotplate;
|
||||
|
||||
// Position on coolplate
|
||||
_abToolsAndPositions[3] := stJobParams.byPlaceOnCoolPlate;
|
||||
|
||||
// Gripper number
|
||||
_abToolsAndPositions[0] := stJobParams.byGripperNumber;
|
||||
|
||||
// Chuck for etcher to load
|
||||
_abToolsAndPositions[1] := stJobParams.byChuckNumber;
|
||||
|
||||
// Write robot job number
|
||||
_uJobs.stJobs.wJobNrForRobot := DINT_TO_WORD(_stJobParams.eJob);
|
||||
|
||||
// Safety reset timout fb
|
||||
_tonTimeout(IN := FALSE);
|
||||
|
||||
_iSSM := 20;
|
||||
|
||||
// Wait for robot program start
|
||||
20:
|
||||
_tonTimeout(IN := TRUE, PT := T#5S);
|
||||
|
||||
// If job number is read back correct, go to next state
|
||||
IF _awJobStatesFromRobot[0] = _uJobs.stJobs.wJobNrForRobot THEN
|
||||
_uJobs.stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
||||
_tonTimeout(IN := FALSE);
|
||||
M_StateComplete();
|
||||
END_IF
|
||||
|
||||
// Timeout occured
|
||||
IF _tonTimeout.Q THEN
|
||||
_tonTimeout(IN := FALSE);
|
||||
_eCmd := E_PackMLCmd.ABORT;
|
||||
END_IF
|
||||
|
||||
// Robot has error
|
||||
IF _dwErrorBits <> 0 THEN
|
||||
_tonTimeout(IN := FALSE);
|
||||
_eCmd := E_PackMLCmd.ABORT;
|
||||
END_IF
|
||||
END_CASE
|
||||
|
||||
// If job number is read back correct, go to next state
|
||||
IF _awJobStatesFromRobot[0] = _uJobs.stJobs.wJobNrForRobot THEN
|
||||
_uJobs.stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
||||
M_StateComplete();
|
||||
END_IF
|
||||
|
||||
// Wrong job read back from robot -> Abort
|
||||
// IF _awJobStatesFromRobot[0] <> 0 AND _awJobStatesFromRobot[0] <> E_KukaRobot_JobNumberRobot.WARMUP THEN
|
||||
// _eCmd := E_PackMLCmd.ABORT;
|
||||
// END_IF
|
||||
//
|
||||
// // Robot has error
|
||||
// IF _dwErrorBits <> 0 THEN
|
||||
// _eCmd := E_PackMLCmd.ABORT;
|
||||
// END_IF]]></ST>
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_Stopped" Id="{50813767-4bd7-4147-b5dc-1bbd18ae1555}">
|
||||
@@ -343,7 +421,7 @@ _uCtrl.stCtrl.bEnableAxes := 0;
|
||||
_uCtrl.stCtrl.bNotDisableAxes := 1;
|
||||
_uCtrl.stCtrl.bExtStart := 0;
|
||||
|
||||
_eRobotJob := E_KukaRobot_JobNumberRobot.NO_JOB;
|
||||
_uJobs.stJobs.wJobNrForRobot := E_KukaRobot_JobNumberRobot.NO_JOB;
|
||||
_ePlcJob := E_KukaRobot_JobNumerPLC.NO_JOB;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
|
||||
Reference in New Issue
Block a user