If you have not read the information explaining the custom feature, then please refer to this page before reading onwards: Customize the Robot's Path
This page gives a short overview of the variable TaskCompleted
; and then a more in depth look at how the variable can be used in Pally:
In Short: TaskCompleted
TaskCompletedPossible valuesExample |
In Detail: TaskCompleted
The boolean variable TaskCompleted
is used to verify that the robot has placed box(es) on the pallet, such that empty runs are not counted as successful runs. Even though it is possible to manually set the value for this variable, which should then be done in the beforeRelease-callback, it is recommended to let Pally handle the logic to set the value of TaskCompleted
.
Pally will set TaskCompleted
(to either True
or False
) based on if it detects that the gripper has vacuum before it releases the box. This, as the vacuum level in the gripper will signal to Pally that the gripper is lifting a box (i.e a successful run). If the vacuum level in the gripper is low, then it signals that there is no box present on the gripper (i.e an empty run).
The digital signal that is used to check the vacuum in the gripper is set in the Pally installation node, it is the ‘Vacuum lost’ input in the Gripper → Input/Output tab:
The signal for ‘Vacuum lost’ is used by Pally to check the vacuum in the gripper
Not all grippers are equipped with vacuum sensors, in this case, set ‘Vacuum lost’ to ‘-Always-LOW-’, if Pally detects this setting - then it will automatically set
The logic in the Pally code gives more insight as to how the TaskCompleted
variable is used and altered:
# Checks the vacuum level before releasing box has_vacuum = HasVacuum() global TaskCompleted = has_vacuum # USERCALLBACK usercallback_beforeRelease() ReleaseBox() if (TaskCompleted): LOG_INFO("box released: ", rf_cntPos) SetCurrentTaskCompleted() else: if (not has_vacuum): LOG_WARNING("vacuum not detected, retrying box: ", rf_cntPos) end CancelCurrentTask() end
The logic in the Pally code shows how the TaskCompleted
is set based on the vacuum level (but it can also be overwritten in the beforeRelease-callback), and then used to verify if boxes were moved or not
As shown in the code snippet from above, setting the TaskCompleted = True
in the beforeRelease-callback, will ensure that all movements of the robot are treated as successful runs - where Pally assumes that the boxes in the current task have been placed on the pallet. If TaskCompleted = False
after the beforeRelease-callback, then Pally will not count the current task as completed. This will lead to Pally re-trying to place the box(es) in the current task.