Callbacks

It is possible to extend the functionality with user-defined commands, which are automatically executed when specific events occur.

 

Some typical use examples for Callbacks are:

  • Turning the conveyor on/off

  • Control a light tower to notify operators

  • Add a shim paper routine

  • Perform custom moves on the robot

    • Sort out a bad box

    • Scan the barcode on box

  • Signal external machines

And many more..

 

Callbacks

Initial MoveJ node

Executed once on startup, after all configuration variables have been initialized. This allows runtime configuration changes and special tuning.

beforePallet

Before starting a new and empty pallet.

Start conveyor

Start other machine

Initialize variable that should be use trough the program

beforeZone

Before entering a new zone.

Lifting column control

Action before new layer or zone

onNextTask (in Pally 2.9.0 or later)

Before starting all calculations for the next pick and place.

Modify path planning parameters dynamically

Prepare for custom motion towards the pick point

beforeGrab

Before lifting up a box from the pickup position.

Perform custom motion towards the pick point

Turn on vacuum on the gripper

afterGrab

After lifting up a box from the pickup position.

Perform custom motion towards the target position on the pallet

If using a parallel gripper, close the gripper in this Callback

beforeRelease

Before releasing a box on the target position.

Turn off vacuum on the gripper

afterRelease

After releasing a box on the target position.

If using a parallel gripper, open the gripper in this Callback

Perform custom motion from the pallet towards the waiting position

afterZone

After leaving a completed zone.

Action after a layer or zone

onSheet

When a shim paper needs to be inserted.

Start the shim paper routine

afterPallet

After the pallet is completed.

Stop conveyor

Stop other machine

Variables

The user-defined commands can utilize the values of the following global variables:

  • LayerAlt: The altitude, measured from the top of the empty pallet (for shim papers).

  • LayerNr: Indicates which layer is being palletized, starting from 0.

  • MountPosition: variable to use with custom path as dynamic position is activated

  • MovePerformed: this is a user writable variable to indicate that the robot has been moved to the MoveTarget position and the program should skip the movement. With this variable it is possible to implement custom movement from the pickup to the target position, or back from the target position to the waiting position. Set this variable to True in either afterGrab or afterRelease, depending on the direction of the movement that has been performed by user code.

  • MoveTarget: target position. In the beforeGrab callback, this value contains the pose of the pick position for the next box(es) including gripper rotation and offset corrections. In the afterGrab callback, it contains the target pose of the box on the pallet where the robot should move. In the afterRelease callback it contains the pose of the default waiting position, transformed by the lifting column position.

  • PalletCenter: A pose that defines the position and orientation of the pallet top center.

  • PalletNr: 1=right pallet, 2=left pallet.

  • ProductCount: The number of boxes on the pallet, starting from 0. Please note the value is updated between beforeRelease and afterRelease.

  • ProductHeight: Height of the box that is being palletized.

  • ProductName: Name of the product that is being palletized.

  • TaskCompleted: this is a read-write boolean variable to indicate that the box(es) are successfully palletized and the box counter can be incremented. The default value is normally True, but can be False when a vacuum sensor is installed and vacuum is not detected at the target position before releasing the boxes. Set this variable to False to repeat the same box position, e.g. when a project-specific quality check is implemented and some boxes are moved from the pickup position to a waste bin instead of being palletized.

  • WorldPosition: A pose that defines an extra transformation for elevated lifting columns.

  • ZoneNr: Indicates which part of the pallet is being palletized (when using zones of lifting columns).

List of global variables in Pally

 

Some typical examples of uses for user-defined commands are to insert a shim paper, start and stop the conveyor, sort out inappropriate boxes to a waste bin, perform custom motion in very special layouts, control light signals and signal external machines, etc

Examples

 

1. Full pallet timer

Timer for counting how long a full pallet would take. The value is presented in the RUN screen

 

2. Shim paper routine

URP’s is added outside the program and called on from the onSheet Callback

 

PutShimPaperToLeftPallet.URP: Customize your own movements for placing paper onto the pallet

 

GetShimPaperFromStative: If palletizing on two pallets one common move down to the stative could be used

 

3. Change optimizer parameters for the next box

Changing the Pally rf_variables before the next calculation starts



4. Custom path

Control the robot motion directly when specfic events occur.

Please note: due to the parallel processing architecture in Pally, it is not possible to move the robot directly in the onNextTask callback: the robot may be still moving back from the previous target position when the new calculations start. Trying to move the robot would cause “Another thread is controlling the robot” error followed by protective stop. When using custom path towards the pick position follow these steps:

  • set MovePerformed = True in the onNextTask callback in advance, but

  • move the robot to the MoveTarget position only in beforeGrab

The MoveTarget variable is not yet valid in the onNextTask callback.

Custom move to the pick position

 

Custom move to the target position on the pallet

 

Custom move back from the target position to the waiting position