User frame program
This article describes the UR user frame program. More information about the logic of this program can be found in the robot-independent surface treatment and dispensing article.
User frames in UR
This example program uses the concept of a user frame.
In UR robots, the concept of a user frame can be applied using the pose_trans
function.
This function allows to define a pose with respect to a frame set by the user.
In surface treatment and dispensing applications, the robot trajectory is based on the location of a user frame. This means that trajectory following programs can be reused quickly following changes in the pose of the part. When the part is shifted, only the user frame has to be updated.
In this example program, the user frame is defined based on the object pose PickitPick
sent from Pickit (updated based on a detection).
Teaching
The program robot_guidance_teaching.urp
is shown below.
This program follows the generic Pickit trajectory teaching logic.
First, the user has to teach the desired trajectory points
Waipoint_1
,Waipoint_2
andWaipoint_3
. Keep the workpiece in place after teaching the points.Move the robot to the detection pose.
Check if Pickit is in Robot mode.
If so, select the setup and product file and trigger a detection.
If an object is found, the trajectory points are saved as installation variables
i_rel_w1
,i_rel_w2
andi_rel_w3
relative to the pick point that plays the role of a user frame. Installation variables are persistent and will be used by the execution program. They are saved in the filerobot_guidance.variables
.If the ROI is empty, no object is found, or no image is captured, the program stops.
Execution
The program robot_guidance_execution.urp
is shown below.
This program follows the generic trajectory execution logic.
First, move the robot to the detection pose.
Check if Pickit is in Robot mode.
If so, select the setup and product file and trigger a detection.
If an object is found, the position of the trajectory points
w1
,w2
andw3
with respect to the robot base are calculated using the updated object pose and the saved relative trajectory pointsi_rel_w1
,i_rel_w2
andi_rel_w3
.If the trajectory points are still reachable after updating the user frame, the robot follows the trajectory and goes back to the first step.
If the trajectory poses are unreachable, the program stops.
If the ROI is empty, no object is found, or no image is captured, the program stops.
Note
Both programs robot_guidance_execution.urp
and robot_guidance_teaching.urp
share the same installation file robot_guidance.installation
and variables file robot_guidance.variables
.
Before running the program
The example program require Pickit to be installed and set up with your robot. For installation instructions, please refer to the Universal Robots installation and setup article.
Make sure that a robot-camera calibration was performed before starting the program. Please refer to the Universal Robots calibration program.
Define fixed points
These points needs to be defined depending on the application.
Detect
: Where to perform object detection.Waipoint_1
,Waipoint_2
andWaipoint_3
: Trajectory points to be defined relative to the workpiece in the teaching program.
Note
This program uses three trajectory points as an example, but more points can be added if needed. If a trajectory point is added, make sure that the programs are updated accordingly and a new installation variable is created.
Execute the user frame program
Attention
Before running the robot program for the first time, make sure that:
There exists a valid robot-camera calibration.
The robot speed is set to a low value, so unexpected behavior can be identified early enough to prevent the robot from colliding with people or the environment.
Pickit is in robot mode, which is enabled in the Pickit web interface.
Now you can run the program.