Example: Decoupling
Following the example of ((Example:Coupling (Conveyor belt)(157)) you now want to decouple to a point in the WCS.
The lift-off movement with the object must be synchronous with CV1. The decoupling must only start with the target movement.
VAR
/// Technology module:
TM_CoordMotion : L_TC2P_CoordinatedMotionState;
/// tracking object
TrackingObject : ConveyorTrackingObject;
/// Commands:
Cmd_ProfilePar : L_TC2P_CmdBasicProfileParameter
:=(itfCmdReceiver := TM_CoordMotion);
Cmd_SyncInStart : L_TC2P_CmdSyncInStart
:=(itfCmdReceiver := TM_CoordMotion);
Cmd_SyncOutStart : L_TC2P_CmdSyncOutStart
:=(itfCmdReceiver := TM_CoordMotion);
Cmd_SyncEnd : L_TC2P_CmdSyncEnd
:=(itfCmdReceiver := TM_CoordMotion);
Cmd_MoveLinAbs : L_TC2P_CmdMoveLinearAbsolute
:=(itfCmdReceiver := TM_CoordMotion);
/// state
wState : WORD;
END_VAR
CASE wState OF
110:
/// set profile parameters
Cmd_ProfilePar.lrPathVel := 100;
Cmd_ProfilePar.lrPathAcc := 1000;
Cmd_ProfilePar.lrPathDec := 1000;
Cmd_ProfilePar.lrPathJerk := 100000;
Cmd_ProfilePar.Execute();
/// execute point 5
Cmd_MoveLinAbs.lrBlendingRadius := 20;
Cmd_MoveLinAbs.eCoordSystem := L_MC4P_CoordSystem.PCS_1;
Cmd_MoveLinAbs.alrPosition[1] := 0; // x pos
Cmd_MoveLinAbs.alrPosition[2] := 0; // y pos
Cmd_MoveLinAbs.alrPosition[3] := 100; // z pos
Cmd_MoveLinAbs.Execute();
/// start sync in start
Cmd_SyncInStart.itfTrackingObject := TrackingObjectOut;
Cmd_SyncInStart.lrOffset := 0;
Cmd_SyncInStart.Execute();
/// execute point 6
Cmd_MoveLinAbs.lrBlendingRadius := 20;
Cmd_MoveLinAbs.eCoordSystem := L_MC4P_CoordSystem.PCS_2;
Cmd_MoveLinAbs.alrPosition[1] := 100; // x pos
Cmd_MoveLinAbs.alrPosition[2] := 0; // y pos
Cmd_MoveLinAbs.alrPosition[3] := 0; // z pos
Cmd_MoveLinAbs.Execute();
/// execute point 7
Cmd_MoveLinAbs.lrBlendingRadius := 20;
Cmd_MoveLinAbs.eCoordSystem := L_MC4P_CoordSystem.PCS_2;
Cmd_MoveLinAbs.alrPosition[1] := 0; // x pos
Cmd_MoveLinAbs.alrPosition[2] := 0; // y pos
Cmd_MoveLinAbs.alrPosition[3] := 0; // z pos
Cmd_MoveLinAbs.Execute();
/// start sync in end
Cmd_SyncEnd.lrOffset := 30;
Cmd_SyncEnd.Execute();
wState := 120;
END_CASE