Pally General - Global Pally Variables

Pally General - Global Pally Variables

This page contains a short and a more detailed description of global variables, that is reachable from the Pally URCap:

ProductName

ProductName

A string variable that is equal to the name of the current pattern file that is being palletized.

Possible values

  • Any string

Example

If the pattern in the JSON file named EUR_pall.JSONis selected as the palletizing pattern in the Pattern Selector in Pally, then ProductName = EUR_pall

The string variable ProductName contains the name of the pattern file that is currently being palletized by Pally.

If the following pattern file, named EUR_pall.JSON, is uploaded to the robot, the JSON file can look like this.

{ "name": "My EUR pallet pattern", "description": "EUR-pallet with 8 boxes per layer.", "dimensions": { "height": 1210, "length": 1200, "width": 800 }, "productDimensions": { "width": 273, "height": 172, "length": 406, "weight": 8000 }, "maxGrip": 1, "guiSettings": { "boxPadding": 2, "units": "metric" }, "labelOrientation": null, "dateModified": "2019-11-20T07:43:15.889Z", "layerTypes": [ { "name": "normal", "pattern": [ { "x": 605, "y": 143, "r": [ 270, 90 ] }, { "x": 605, "y": 420, "r": [ 270, 90 ] }, { "x": 605, "y": 697, "r": [ 270, 90 ] }, { "x": 605, "y": 1016, "r": [ 270, 90 ] }, { "x": 195, "y": 143, "r": [ 270, 90 ] }, { "x": 195, "y": 420, "r": [ 270, 90 ] }, { "x": 195, "y": 697, "r": [ 270, 90 ] }, { "x": 195, "y": 1016, "r": [ 270, 90 ] } ], "class": "layer" }, { "name": "reverse", "pattern": [ { "x": 605, "y": 185, "r": [ 270, 90 ] }, { "x": 605, "y": 508, "r": [ 270, 90 ] }, { "x": 605, "y": 785, "r": [ 270, 90 ] }, { "x": 605, "y": 1062, "r": [ 270, 90 ] }, { "x": 195, "y": 185, "r": [ 270, 90 ] }, { "x": 195, "y": 508, "r": [ 270, 90 ] }, { "x": 195, "y": 785, "r": [ 270, 90 ] }, { "x": 195, "y": 1062, "r": [ 270, 90 ] } ], "class": "layer" } ], "layers": [ "normal", "reverse", "normal", "reverse", "normal", "reverse", "normal" ] }

Example of a pattern file for Pally

Notice that the name of the pattern in the EUR_pall.JSON-file is My EUR pallet pattern. When the Pally program is set up and the program is played, then the Pally pattern selector will show the names of each pattern, as such:

Notice that the name of the pattern in the EUR_pall.JSON file is shown to the operator

Once this pattern is selected, and the Start Program button is pressed, then the global variable ProductName is set to be equal to the corresponding file name of the selected pattern. Such that, in this case, the ProductName = EUR_pall.

Notice that the file ending, .JSON, is not included in the ProductName

 


ProductCount

ProductCount

An integer that is equal to the number of boxes that have been palletized so far.

Possible values

  • Any value between 0 and the total number of boxes present in the pattern

Example

If a pattern is being palletized, and currently five boxes have been placed on the pallet, then:

  • ProductCount = 5

The ProductCount variable is an integer that is equal to the number of boxes that have been successfully placed on the pallet so far. The variable is initialized to 0 for all patterns and is incremented by the number of boxes that the robot palletizes.

As an example, if the first two boxes to be palletized in a pattern are picked at the same time, then ProductCount is incremented from 0 to 2 after the two boxes are placed on the pallet.

If the TaskCompleted variable is False in the beforeRelease-callback, then no boxes will have been placed on the pallet; thus, ProductCount is not incremented.


WorldPosition

WorldPosition

A pose variable that contains the current shift in position of the robot’s base frame with regard to the lifting column’s current elevated position.

Possible values

  • Initialized to: p[0, 0, 0, 0, 0, 0]

    • If no lifting column is used, the WorldPosition variable will always be p[0, 0, 0, 0, 0, 0]

  • Can take any other pose variable: p[0, 0, -lifting_column_pos, 0, 0, 0] where lifting_column_pos is updated based on the current elevation of the lifting column.

    • Review the more detailed explanation to see why the z-direction is negative.

Example

If a lifting column is used in Pally, then the WorldPosition variable will be updated each time the lifting column is moved. If the lifting column is set to a position of 0.25 meters, then the WorldPosition will be set to:

  • WorldPosition = p[0, 0, -0.25, 0, 0, 0]

The WorldPosition variable is a pose variable that contains the offset in the z-direction of the robot’s base frame that is caused by an extended lifting column.

The WorldPosition variable is only relevant when a lifting column is in use.

The robot’s base frame is a coordinate frame that has its origo in the center of the base joint on the UR, where the z-axis is positive in the upwards direction.

The blue line represents the z-axis in the robot’s base frame, where a movement upwards from the base joint represents a positive movement in the z-direction.

Since the robot’s base frame is centered in the base joint, any object that is below the base joint will have a negative z-value. Therefore, as the lifting column is extended, and the robot consequently moves upwards in the positive z-direction, all the objects surrounding the robot will be pushed in a more negative z-direction.

With the logic above in mind, an extension of the lifting column of, for instance, 0.5 meters, will give the WorldPosition variable a value of p[0, 0, -0.5, 0, 0, 0].

Thus, if an object is located in the robot’s base frame at a pose: p[0.1, 0.2, -0.25, 1.23, 1.57, 0], when the lifting column is not extended; then if the lifting column is extended to 0.5 meters, this object will now be in the robot’s base fram at a pose: p[0.1, 0.2, -0.75, 1.23, 1.57, 0]. As you can see, the object has been pushed by -0.5 meters in the z-direction of the robot’s base frame due to the movement of the lifting column.

The WorldPosition can therefore be used to modify any pose that you may wish the robot to take in any of the Pally callbacks.


LayerNr

LayerNr

An integer representing the current layer number that is being palletized. The value is zero-based.

Possible values

  • Any integer between 0 and the (total number of layers - 1) for the current pattern

Example

If a pattern has seven layers, then when …

  • … Pally is palletizing the first layer, LayerNr = 0

  • … Pally is palletizing the seventh layer, LayerNr = 6

The LayerNr variable can be used to figure out which layer is currently being palletized. It contains a zero-indexed value of the current active layer number, meaning that the first layer will have LayerNr = 0.

A zero-based variable, such as LayerNr, means that the first layer has a value of 0; the second layer has a value of 1; the third has a value of 2; and so on. This is a sort of zero-indexing that is common practice in many programming languages.


PalletNr

PalletNr

An integer representing the current pallet, either the left or the right pallet, that is being palletized.

Possible values

  • 1 = Right pallet

  • 2 = Left pallet

Example

If the right pallet is marked as ready for palletizing, and Pally starts placing boxes on it, then:

  • PalletNr = 1

The PalletNr is used to represent if the right or left pallet is currently being palletized. The variable can only take one of two values:

  1. PalletNr = 1: Right pallet is being palletized

  2. PalletNr = 2: Left pallet is being palletized

This information can be useful in numerous circumstances, one such circumstance is if the robot is to complete custom movements that differ for the left and right pallets. Say pose_left and pose_right are pre-defined pose variables that contain the robot’s target pose for the left and right pallets, respectively, then to move the robot to these positions.


PalletCenter

The PalletCenter variable contains a pose calculated from the three corner calibration points and refers to the center point on the empty pallet.

A useful formula to determine the box position relative to the pallet center:

BoxPosition = pose_trans( pose_inv( PalletCenter ), MoveTarget )

 

MoveTarget

Target position of the robot (pose, p[x, y, z, rx, ry, rz]). In the afterGrab callback, this variable 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. Use this variable in combination with MountPosition when using a lifting column.

MountPosition

Expected mounting position (i.e., lifting column position) at the moment when the robot is at MoveTarget. When using a "custom path" with a lifting column in Dynamic Positioning mode, it is required to control the lifting column position from the callback code along with the robot position. The value of MountPosition is an array with three elements [x, y, z] where the first two values are always zero and reserved for further extensions; the third value is the expected lifting column height at the moment when the robot is at the MoveTarget position.

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.

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.