...
Table of Contents | ||
---|---|---|
|
...
In Short: rf_custom_path
rf_custom_pathA boolean value |
that instructs the program to skip the path planning calculations completely. If set to |
in both directions, i.e. from the pick position towards the pallet and back from the pallet to the waiting position. (See details in Customize the Robot's Path ). Possible values
ExampleIn one of Pally’s callback, use the ‘Script’-node in Polyscope to assign a value to the |
In Detail: rf_custom_path
The variable rf_custom_path
is crucial for the custom path feature in Pally. It can be used to turn the custom feature on or off, depending on the issues you are experiencing with the robot movement generated by Pally instructs the program to skip the path planning calculations completely. Set the variable to True
if you want to have full control over the robot motion. This can be especially useful in projects where the default path planning calculations would fail, or otherwise not desired.
Below, the use of rf_custom_path
is explored in two scenarios .
...
If you wish to override the path outlined by Pally for all boxes in the selected pattern, then simply set the rf_custom_path
variable to True
in the beforePallet-callback (as shown in the screenshot above)initial MoveJ node.
Info |
---|
You must follow the steps outlined by Customize the Robot's Path to successfully use the custom path feature when |
Customize Path for Some Boxes
A common scenario is that there are only a few boxes in the pattern that are causing problems. In this case, it is possible to extend the customPath.script
outlined in Customize the Robot's Path and create a function that sets a suitable value for the rf_custom_path
variable based on the current box position.
An example of this sort of function, called CheckProblematicPosition()
, is shown in the extended version of the customPath.script
belowIf you need to handle exceptional box positions for some reason, e.g. where the default path planning calculations would fail, or otherwise not neeeded, just add rf_custom_path=True
for specific box positions in the onNextTask callback. This will instruct the program to skip path planning calculations for the given positions only.
Example:
Code Block | ||
---|---|---|
| ||
p_boxfree = p[0,0,0,0,0,0] p_boxfree2= p[0,0,0,0,0,0] p_boxfree3= p[0,0,0,0,0,0] p_exit= p[0,0,0,0,0,0] j_exit = [0,0,0,0,0,0] p_approach = p[0,0,0,0,0,0] p_waypoint = p[0,0,0,0,0,0] def CheckProblematicPosition(): if (PalletNr == 1 and ProductCount == 12): rf_custom_path = True else: rf_custom_path = False end end def GetBlend(to_point, next_point): this_point = get_actual_tcp_pose() d1 = point_dist(this_point, to_point) d2 = point_dist(to_point, next_point) if (d1 < d2): return d1 * 0.25 else: return d2 * 0.25 end end def MoveToTarget(): if (rf_custom_path): # move up p_boxfree = pose_trans(get_actual_tcp_pose(), p[0,0,-rf_box_free,0,0,0]) # move closer to the robot p_boxfree2= p_boxfree d = sqrt(rf_camera[0] * rf_camera[0] + rf_camera[1] * rf_camera[1]) / sqrt(p_boxfree2[0] * p_boxfree2[0] + p_boxfree2[1] * p_boxfree2[1]) p_boxfree2[0] = p_boxfree2[0] * d p_boxfree2[1] = p_boxfree2[1] * d # move up p_boxfree3= p_boxfree2 if (MoveTarget[2] + ProductHeight > p_boxfree3[2]): p_boxfree3[2] = MoveTarget[2] + ProductHeight end # move away from the conveyor and rotate if (PalletNr == 1): p_exit = pose_trans(p[-0.35, 0, 0, 0, 0, 0], p_boxfree3) else: p_exit = pose_trans(p[0.35, 0, 0, 0, 0, 0], p_boxfree3) end p_exit[3] = MoveTarget[3] p_exit[4] = MoveTarget[4] p_exit[5] = MoveTarget[5] # approach the pallet if (PalletNr == 1): p_approach = pose_trans(p[0.05, -0.05, 0.05, 0, 0, 0], MoveTarget) else: p_approach = pose_trans(p[-0.05, -0.05, 0.05, 0, 0, 0], MoveTarget) end # this may be actual for the top layer: # the approach should be closer than usual to have enough reach if (not is_within_safety_limits(p_approach)): # should not use normally p_approach = MoveTarget end # a waypoint before approach p_waypoint = p_approach if (p_waypoint[2] < p_boxfree[2]): p_waypoint[2] = p_boxfree[2] end if (p_waypoint[2] < MoveTarget[2] + ProductHeight + rf_approach[2]): p_waypoint[2] = MoveTarget[2] + ProductHeight + rf_approach[2] end movel(p_boxfree, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_boxfree, p_boxfree2)) movel(p_boxfree2, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_boxfree2, p_boxfree3)) movel(p_boxfree3, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_boxfree3, p_exit)) movel(p_exit, a=rf_max_acceleration, v=rf_speed, r=0.01) j_exit = get_actual_joint_positions() if (is_within_safety_limits(p_waypoint)): movej(p_waypoint, a=rf_max_acceleration, v=rf_speed, r=0.01) movel(p_approach, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_approach, MoveTarget)) else: movej(p_approach, a=rf_max_acceleration, v=rf_speed, r=0.01) end movel(MoveTarget, a=rf_precise_acceleration, v=rf_precise_speed, r=0) MovePerformed=True end end def MoveBack(): if (rf_custom_path): if (is_within_safety_limits(p_waypoint)): movel(p_waypoint, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_waypoint, p_exit)) else: movel(p_approach, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_approach, p_exit)) end movej(j_exit, a=rf_max_acceleration, v=rf_speed, r=0.01) movel(p_boxfree3, a=rf_max_acceleration, v=rf_speed, r=GetBlend(p_boxfree3, p_boxfree2)) movel(p_boxfree2, a=rf_max_acceleration, v=rf_speed, r=0) MovePerformed=True end end |
An example of how the customPath.script
may look like. Please note the addition of the function CheckProblematicPosition()
.
The example of a customPath.script
, as defined above, shows how the function CheckProblematicPosition()
assigns a value to rf_custom_path
at a certain position in the palletizing process. In this case, it is for the right pallet (PalletNr == 1
1) and box number 13 (ProductCount == 12
2) that the custom path feature will be enabled. For the remaining boxes, the path outlined by Pally will be used.
The CheckProblematicPosition()
is added to the beforeGrab-callback in Pally, such that the rf_custom_path
variable is properly assigned before the path is calculated. The image below shows how the robot program may look like:
...
An example of how to skip path planning calculations for box position 12 on the right pallet.
Adding CheckProblematicPosition()
in the onNextTask callback will instruct the program to skip path planning calculations for box position on the right pallet. Modify the program as needed. Please note the else-branch where rf_custom_path
is set back to False
when the special conditions don't met.
Please note: You should not set rf_custom_path=True if you want to modify the robot motion in only one direction, i.e. from the pickup to the pallet or back from the pallet to the next pickup. You must override both directions when rf_custom_path is set to True.
Footnotes:
1PalletNr
is either 1
or 2
, where 1
is the right pallet and 2
is the left pallet.
...