Hello,
I tested the ML_KinPolyTransP together with the ML_KinContMotionP and the result is exactly what we were looking for
But to reach this result I must take always active both blending functions. However in a pick and place cycle lie the one I'm performing above I need to stop at the end the pick position and place position and get the"Done" feedback in that point.
If I let both blending functions active I never get the "Done" signal from the ML_GetCmdState fuction but I always get the "INBUFFER" signal.
To avoid that I tried to disable both blending functions in before programming the down to pick and down to place positions and enable again the blending functions in the other commanded points but the result was that not blending at all was performed.
So How can I do a pick & place cycle right using these blending function ?
Here my PLC Code:
// Declaration
{attribute 'symbol' := 'readwrite'}
PROGRAM PLC_PRG_1
VAR
bEnPlcOpen: BOOL;
bEnCXA_Motion: BOOL :=TRUE;
/// ############################## Motion Library CXA_Motion ####################################################
fbAx1_Power: FB_Power;
fbAx2_Power: FB_Power;
fbAx3_Power: FB_Power;
fbKinGroup: FB_KinGroup;
bKinGroup: BOOL;
fbKinMoveLinAbsP1: FB_KinMoveLinAbs;
bExkinMoveLinAbsP1: BOOL;
arPosKinMoveLinAbsP1: ARRAY[0..15] OF LREAL;
rVelKinMoveLinAbsP1: LREAL := 5000;
rAccKinMoveLinAbsP1: LREAL := 10000;
rDecKinMoveLinAbsP1: LREAL := 10000;
rJerkKinMoveLinAbsP1: LREAL := 100000;
enCoordSystemP1: STRING(15) := 'WCS';
///I_BufferMode: MC_BUFFER_MODE;
rTransitionParameterP1: ARRAY[0..1] OF LREAL;
fbKinMoveLinAbsP2: FB_KinMoveLinAbs;
bExkinMoveLinAbsP2: BOOL;
arPosKinMoveLinAbsP2: ARRAY[0..15] OF LREAL;
rVelKinMoveLinAbsP2: LREAL := 5000;
rAccKinMoveLinAbsP2: LREAL := 10000;
rDecKinMoveLinAbsP2: LREAL := 10000;
rJerkKinMoveLinAbsP2: LREAL := 100000;
enCoordSystemP2: STRING(15) := 'WCS';
///I_BufferMode: MC_BUFFER_MODE;
rTransitionParameterP2: ARRAY[0..1] OF LREAL;
fbKinMoveLinAbsP3: FB_KinMoveLinAbs;
bExkinMoveLinAbsP3: BOOL;
arPosKinMoveLinAbsP3: ARRAY[0..15] OF LREAL;
rVelKinMoveLinAbsP3: LREAL := 5000;
rAccKinMoveLinAbsP3: LREAL := 10000;
rDecKinMoveLinAbsP3: LREAL := 10000;
rJerkKinMoveLinAbsP3: LREAL := 100000;
enCoordSystemP3: STRING(15) := 'WCS';
///I_BufferMode: MC_BUFFER_MODE;
rTransitionParameterP3: ARRAY[0..1] OF LREAL;
fbKinMoveLinAbsP4: FB_KinMoveLinAbs;
bExkinMoveLinAbsP4: BOOL;
arPosKinMoveLinAbsP4: ARRAY[0..15] OF LREAL;
rVelKinMoveLinAbsP4: LREAL := 5000;
rAccKinMoveLinAbsP4: LREAL := 10000;
rDecKinMoveLinAbsP4: LREAL := 10000;
rJerkKinMoveLinAbsP4: LREAL := 100000;
enCoordSystemP4: STRING(15) := 'WCS';
///I_BufferMode: MC_BUFFER_MODE;
rTransitionParameterP4: ARRAY[0..1] OF LREAL;
iAxsState: INT;
oCmdResult: ML_oCmdResult;
ioGetCmdState: ML_GetCmdStateData;
bExPowerOnAx1: BOOL;
stDataPowerOnAx1: ML_AxsPowerData;
stDataMoveAx1: ML_AxsPosData;
rTargetPosAx1: REAL := 100;
rTargetVel: REAL := 10;
rTargetAcc: REAL := 10;
stOverrideData: ML_SetOverrideData;
bML_SetOverride: BOOL;
/// ############################## PlcOpen Library CXA_PlcOpen ####################################################
fbMC_PowerAx1: MC_Power;
bEnPowerOnAx1: BOOL;
Axis_1: AXIS_REF;
fbMC_PowerAx2: MC_Power;
bEnPowerOnAx2: BOOL;
Axis_2: AXIS_REF;
fbMC_PowerAx3: MC_Power;
bEnPowerOnAx3: BOOL;
Axis_3: AXIS_REF;
fbAddAxisToGroup_Ax1: MC_AddAxisToGroup;
fbAddAxisToGroup_Ax2: MC_AddAxisToGroup;
fbAddAxisToGroup_Ax3: MC_AddAxisToGroup;
bAddAxisToGroup: BOOL;
fbMC_GroupEnable: MC_GroupEnable;
bExGroupEnable: BOOL;
stKinGroup: AXES_GROUP_REF;
fbMC_GroupDisable: MC_GroupDisable;
fbMB_GroupJog: MB_GroupJog;
bEnableKinJog: BOOL;
arDirection: ARRAY[0..15] OF LREAL;
rJogVel: REAL := 200;
rJogAcc: REAL := 1000;
rJogJerk: REAL := 0;
enJogCoordSys: MC_COORD_SYSTEM;
fbMC_MoveLinearAbsoluteP1: MC_MoveLinearAbsolute;
bExMoveLinAbsKinP1: BOOL;
arPosMoveLinAbsP1: ARRAY[0..15] OF LREAL;
rVelMoveLinAbsP1: REAL := 200;
rAccMoveLinAbsP1: REAL := 1000;
rJerkMoveLinAbsP1: REAL := 100000;
enMoveLinAbsCoordSysP1: MC_COORD_SYSTEM;
enBufferModeP1: MC_BUFFER_MODE;
arTranstionParameterP1: ARRAY[0..1] OF LREAL;
fbMC_MoveLinearAbsoluteP2: MC_MoveLinearAbsolute;
bExMoveLinAbsKinP2: BOOL;
arPosMoveLinAbsP2: ARRAY[0..15] OF LREAL;
rVelMoveLinAbsP2: REAL := 200;
rAccMoveLinAbsP2: REAL := 1000;
rJerkMoveLinAbsP2: REAL := 100000;
enMoveLinAbsCoordSysP2: MC_COORD_SYSTEM;
enBufferModeP2: MC_BUFFER_MODE;
arTranstionParameterP2: ARRAY[0..1] OF LREAL;
fbMC_MoveLinearAbsoluteP3: MC_MoveLinearAbsolute;
bExMoveLinAbsKinP3: BOOL;
arPosMoveLinAbsP3: ARRAY[0..15] OF LREAL;
rVelMoveLinAbsP3: REAL := 200;
rAccMoveLinAbsP3: REAL := 1000;
rJerkMoveLinAbsP3: REAL := 100000;
enMoveLinAbsCoordSysP3: MC_COORD_SYSTEM;
enBufferModeP3: MC_BUFFER_MODE;
arTranstionParameterP3: ARRAY[0..1] OF LREAL;
fbMC_MoveLinearAbsoluteP4: MC_MoveLinearAbsolute;
bExMoveLinAbsKinP4: BOOL;
arPosMoveLinAbsP4: ARRAY[0..15] OF LREAL;
rVelMoveLinAbsP4: REAL := 200;
rAccMoveLinAbsP4: REAL := 1000;
rJerkMoveLinAbsP4: REAL := 100000;
enMoveLinAbsCoordSysP4: MC_COORD_SYSTEM;
enBufferModeP4: MC_BUFFER_MODE;
arTranstionParameterP4: ARRAY[0..1] OF LREAL;
iCycle: INT;
bStartCycle: BOOL;
rBlendingRadius: REAL := 20;
fbMC_GroupReadStatus: MC_GroupReadStatus;
bEnReadKinStatus: BOOL;
fbMC_GroupReadActualPosition: MC_GroupReadActualPosition;
bEnReadKinPos: BOOL;
fbMC_MoveAbsolute: MC_MoveAbsolute;
bExMovePlcOpenAbsAx1: BOOL;
arActualKinPos: ARRAY[0..15] OF LREAL;
i: UINT;
fbMC_GroupReadActualVelocity: MC_GroupReadActualVelocity;
fbMC_GroupReadActualAcceleration: MC_GroupReadActualAcceleration;
rPathVel: LREAL;
rPathAcc: LREAL;
bSetAllData: BOOL;
rSetVelAll: REAL := 5000;
rSetAccAll: REAL := 5000;
pluto: BOOL;
pippo_count: INT;
enSlopeSetting: EN_SlopeType;
// KinInterface FB Call NO TEMPLATE
fbKinInterfaceInit:MB_KinematicsInit;
fbKinInterfaceBase:MB_KinematicsInterfaceBase ;
bExKinInterfaceInit: BOOL;
uiKinIndex: UINT;
stKinAdmin: CXA_MotionInterface.MB_KINEMATICS_ADMINISTRATION;
stKinStatus: CXA_MotionInterface.MB_KINEMATICS_ADMIN_STATUS;
stKinDataStatus: CXA_MotionInterface.MB_KINEMATICS_DATA;
stKinDiagStatus: CXA_MotionInterface.MB_KINEMATICS_DIAGNOSIS;
stCoordCtrl: CXA_MotionInterface.MB_KINEMATICS_COORDINATED;
bEnKinInterface: BOOL;
stDataMoveAbsTest: CXA_Motion.ML_KinMoveLinData;
bResultMoveAbsTest: BOOL;
bEnMoveAbsTest: BOOL;
bResultKinMCS: BOOL;
stML_KinMCSP: CXA_Motion.ML_KinMCSPData;
bEnML_KinMCSP: BOOL;
bBypassSetMoveAbs: BOOL;
fbAddToKinAxis1: FB_AddAxisToKin;
fbAddToKinAxis2: FB_AddAxisToKin;
fbAddToKinAxis3: FB_AddAxisToKin;
bAddAxisToKin: BOOL;
fbRemFromKinAxis1: FB_RemAxisFromKin;
fbRemFromKinAxis2: FB_RemAxisFromKin;
fbRemFromKinAxis3: FB_RemAxisFromKin;
bRemAxisToKin: BOOL;
rTargetPosX: LREAL := 0;
rTargetPosY: LREAL := 0;
rTargetPosZ: LREAL := -700;
_speed: LREAL;
rVelAxisX: LREAL;
rPosOld_AxisX: LREAL;
rTaskClock: LREAL := 200;
rVelAxisY: LREAL;
rPosOld_AxisY: LREAL;
rVelAxisZ: LREAL;
rPosOld_AxisZ: LREAL;
copy1: ARRAY [0..1] OF LREAL;
fbTON: TON;
bSetDynamicMoveData: BOOL;
rCmdPathVel: LREAL := 5000; // mm/min.
rCmdPathAcc: LREAL := 500; // m/s2
rCmdPathJerk: LREAL := 5000; // m/s3
fbMoveCircular: FB_KinMoveCircAbs;
bExMoveCircular: BOOL;
arEndPosCirc: ARRAY [0..15] OF LREAL;
arIntermPosCirc: ARRAY [0..15] OF LREAL;
enCoordSystemCirc: ML_CoordSys := MCS;
bManualCycle: BOOL;
stTestML_KinPolyTransP: CXA_Motion.ML_KinPolyTransPData;
bTestML_KinPolyTransP: BOOL;
bEnablestTestML_KinPolyTransP: BOOL;
rD1Poly: LREAL := 20;
bTestML_KinPolyTransPDone: BOOL;
bDisablestTestML_KinPolyTransP: BOOL;
bCycleTestML_KinPolyTransP: BOOL;
stDataMoveAbsTest1: CXA_Motion.ML_KinMoveLinData;
bResultMoveAbsTest1: BOOL;
stDataMoveAbsTest2: CXA_Motion.ML_KinMoveLinData;
stDataMoveAbsTest3: CXA_Motion.ML_KinMoveLinData;
stDataMoveAbsTest4: CXA_Motion.ML_KinMoveLinData;
bResultMoveAbsTest2: BOOL;
bResultMoveAbsTest3: BOOL;
bResultMoveAbsTest4: BOOL;
stDataMoveAbsTest5: CXA_Motion.ML_KinMoveLinData;
stDataMoveAbsTest6: CXA_Motion.ML_KinMoveLinData;
bResultMoveAbsTest5: BOOL;
bResultMoveAbsTest6: BOOL;
bTestMLML_KinPolyTransP_ML_ContSlope: BOOL;
stTestML_KinPolyTransP_MLContSlope: CXA_Motion.ML_KinContMotionPData;
stKinPathStatus: ST_KIN_PATH_STATUS;
rBlendingRadiusDone: LREAL := 10;
syGetCmdState: CXA_Motion.ML_GetCmdStateData;
bKinMoveLinAbsBuffered: BOOL;
O_bKinMoveLinAbsBuffered: BOOL;
stGetCmdState: CXA_Motion.ML_GetCmdStateData;
bKinMoveLinAbsDone: BOOL;
O_bKinMoveLinAbsDone: BOOL;
idxCyclePoly: INT;
bBypassStepPolyTest: BOOL;
idxCyclePolyNextStep: INT;
bBlendSettingOk: BOOL;
bBlendingOn: BOOL;
bBlendAlways: BOOL;
END_VAR
// Implementation
CASE idxCyclePoly OF
0:
bResultMoveAbsTest1:=FALSE;
bResultMoveAbsTest2:=FALSE;
bResultMoveAbsTest3:=FALSE;
bResultMoveAbsTest4:=FALSE;
bResultMoveAbsTest5:=FALSE;
bResultMoveAbsTest6:=FALSE;
bBlendSettingOk:=FALSE;
IF bCycleTestML_KinPolyTransP OR bBypassStepPolyTest THEN
IF bBlendAlways AND NOT bBlendingOn THEN
// Enable Blending
idxCyclePoly:=50;
idxCyclePolyNextStep:=11;
ELSE
idxCyclePoly:=1;
END_IF
END_IF
11:
IF bBlendSettingOk THEN
bResultMoveAbsTest1:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest1);
stGetCmdState.In.CmdID := stDataMoveAbsTest1.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest1.In.KinName;
IF bResultMoveAbsTest1 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=1;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
1:
IF bKinMoveLinAbsDone OR bKinMoveLinAbsBuffered OR bBypassStepPolyTest THEN
// Disable Blend for move Done
IF NOT bBlendAlways THEN
idxCyclePoly:=60;
idxCyclePolyNextStep:=22;
ELSE
bResultMoveAbsTest2:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest2);
stGetCmdState.In.CmdID := stDataMoveAbsTest2.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest2.In.KinName;
IF bResultMoveAbsTest2 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=2;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
END_IF
22:
IF bBlendSettingOk THEN
bResultMoveAbsTest2:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest2);
stGetCmdState.In.CmdID := stDataMoveAbsTest2.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest2.In.KinName;
IF bResultMoveAbsTest2 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=2;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
2:
IF bKinMoveLinAbsDone OR ( bKinMoveLinAbsBuffered AND bBlendAlways ) OR bBypassStepPolyTest THEN
//bEnablestTestML_KinPolyTransP:=TRUE;
//IF bTestML_KinPolyTransPDone THEN
// Enable Blending
IF NOT bBlendAlways THEN
idxCyclePoly:=50;
idxCyclePolyNextStep:=33;
ELSE
bResultMoveAbsTest3:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest1);
stGetCmdState.In.CmdID := stDataMoveAbsTest1.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest1.In.KinName;
IF bResultMoveAbsTest3 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=3;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
END_IF
33:
IF bBlendSettingOk THEN
bResultMoveAbsTest3:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest1);
stGetCmdState.In.CmdID := stDataMoveAbsTest1.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest1.In.KinName;
IF bResultMoveAbsTest3 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=3;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
//END_IF
3:
IF bKinMoveLinAbsDone OR bKinMoveLinAbsBuffered OR bBypassStepPolyTest THEN
bResultMoveAbsTest4:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest3);
stGetCmdState.In.CmdID := stDataMoveAbsTest3.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest3.In.KinName;
IF bResultMoveAbsTest4 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=4;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
4:
IF bKinMoveLinAbsDone OR bKinMoveLinAbsBuffered OR bBypassStepPolyTest THEN
// Disable Blend for move Done
IF NOT bBlendAlways THEN
idxCyclePoly:=60;
idxCyclePolyNextStep:=44;
ELSE
bResultMoveAbsTest5:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest4);
stGetCmdState.In.CmdID := stDataMoveAbsTest4.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest4.In.KinName;
IF bResultMoveAbsTest5 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=5;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
END_IF
44:
IF bBlendSettingOk THEN
bResultMoveAbsTest5:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest4);
stGetCmdState.In.CmdID := stDataMoveAbsTest4.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest4.In.KinName;
IF bResultMoveAbsTest5 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=5;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
//END_IF
5:
IF bKinMoveLinAbsDone OR ( bKinMoveLinAbsBuffered AND bBlendAlways ) OR bBypassStepPolyTest THEN
// Enable Blending
IF NOT bBlendAlways THEN
idxCyclePoly:=50;
idxCyclePolyNextStep:=55;
ELSE
bResultMoveAbsTest6:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest3);
stGetCmdState.In.CmdID := stDataMoveAbsTest3.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest3.In.KinName;
IF bResultMoveAbsTest6 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=6;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
END_IF
55:
IF bBlendSettingOk THEN
bResultMoveAbsTest6:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest3);
stGetCmdState.In.CmdID := stDataMoveAbsTest3.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest3.In.KinName;
IF bResultMoveAbsTest6 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=6;
bBypassStepPolyTest:=FALSE;
END_IF
END_IF
//END_IF
6:
IF bKinMoveLinAbsDone OR bKinMoveLinAbsBuffered OR bBypassStepPolyTest THEN
bResultMoveAbsTest1:=ML_KinMoveLinAbs(Data:= stDataMoveAbsTest1);
stGetCmdState.In.CmdID := stDataMoveAbsTest3.Out.CmdID;
stGetCmdState.In.ObjName:= stDataMoveAbsTest3.In.KinName;
IF bResultMoveAbsTest1 THEN
idxCyclePoly:=99;
idxCyclePolyNextStep:=0;
bBypassStepPolyTest:=FALSE;
END_IF
//END_IF
END_IF
50:
bBlendSettingOk:=FALSE;
// Enable Blending for Move Via
stTestML_KinPolyTransP.In.D1:=rD1Poly;
stTestML_KinPolyTransP.In.D2:=rD1Poly;
stTestML_KinPolyTransP.In.KinName:='Delta';
stTestML_KinPolyTransP.In.SwitchOff:=FALSE;
bTestML_KinPolyTransP:=ML_KinPolyTransP(Data:= stTestML_KinPolyTransP);
stTestML_KinPolyTransP_MLContSlope.In.KinName:='Delta';
stTestML_KinPolyTransP_MLContSlope.In.SwitchOff:=FALSE;
bTestMLML_KinPolyTransP_ML_ContSlope:=ML_KinContMotionP(Data:= stTestML_KinPolyTransP_MLContSlope);
IF bTestML_KinPolyTransP AND bTestMLML_KinPolyTransP_ML_ContSlope THEN
idxCyclePoly:=idxCyclePolyNextStep;
bBlendSettingOk:=TRUE;
bBlendingOn:=TRUE;
END_IF
60:
bBlendSettingOk:=FALSE;
// Disable Blend for move Done
stTestML_KinPolyTransP.In.D1:=0;
stTestML_KinPolyTransP.In.D2:=0;
stTestML_KinPolyTransP.In.KinName:='Delta';
stTestML_KinPolyTransP.In.SwitchOff:=TRUE;
bTestML_KinPolyTransP:=ML_KinPolyTransP(Data:= stTestML_KinPolyTransP);
stTestML_KinPolyTransP_MLContSlope.In.KinName:='Delta';
stTestML_KinPolyTransP_MLContSlope.In.SwitchOff:=TRUE;
bTestMLML_KinPolyTransP_ML_ContSlope:=ML_KinContMotionP(Data:= stTestML_KinPolyTransP_MLContSlope);
IF bTestML_KinPolyTransP AND bTestMLML_KinPolyTransP_ML_ContSlope THEN
idxCyclePoly:=idxCyclePolyNextStep;
bBlendSettingOk:=TRUE;
bBlendingOn:=FALSE;
END_IF
99:
//Check Command State
bKinMoveLinAbsBuffered:=FALSE;
bKinMoveLinAbsDone:=FALSE;
ML_GetCmdState(Data:= stGetCmdState);
IF ( stGetCmdState.Out.State='INBUFFER' OR stGetCmdState.Out.State='ACTIVE' ) THEN
bKinMoveLinAbsBuffered:=TRUE;
ELSE
bKinMoveLinAbsBuffered:=FALSE;
END_IF
IF stGetCmdState.Out.State='DONE' THEN
bKinMoveLinAbsDone:=TRUE;
ELSE
bKinMoveLinAbsDone:=FALSE;
END_IF
IF (bKinMoveLinAbsBuffered AND bBlendingOn ) OR bKinMoveLinAbsDone THEN
idxCyclePoly:=idxCyclePolyNextStep;
END_IF
END_CASE