Morning all. I have a UR10 with a WireTank dispenser for an effector. We stake a lot of PC boards around here. I’m beginning to get my head around variable waypoints and scripted moves, just enough to be dangerous and overly ambitious. My plan is to create a library of parts that I can drop into a program as subprograms to speed up programming of our hardware. Am I going to be able to use multiple copies of the same subprograms within the main program without running into proplems with duplicate variable and waypoint names?
I write the programs for the parts using a single fixed waypoint on the front left corner. My current attempt at this is to create the various staking locations using variable waypoints, scripted and direction motions. The waypoints are being generated by creating variables using the physical dimensions of the component. I am having trouble getting the variable waypoints to behave as expected.
For example, I have a quad pack that is 57mm square and 8mm tall. Waypoint FL_1 is the front left corner of the part. The variables X_Long and Y_Wide are 57, Z_High is 8. Variable waypoint FL_2 should be (FL_1 + Y_Wide). FL_3=(FL_1 + X_Long + Y_Wide) and so forth. This seems simple, but I cannot get it to work with pose_trans or pose_add. What am I missing to get these waypoints to work?
Unfortunately the way subprograms seem to be handle is that before they are run (or compiled??) all of the script files are stuck together… so you need to make sure you don’t use variable names in multiple subprograms other wise you will have issues.
Scoping of variables with subprograms is quite hard to control.
Regarding the variable waypoints. It may be easier to create a feature plane (where FL_1 is) and then you do all your other ways points in the coordinate system of that feature plane.
So then you can just move to X,Y,Z coordinates directly if you specify tool orientation, or get the tool orientation from the current position (or another taught waypoint). This is an example of how I am doing it.
global FoundPose = get_target_tcp_pose() #get the current blade pickup position (ignore x,y and z, just orientation really)
textmsg("TargetPose in base:", FoundPose)
global FoundPose = pose_trans(pose_inv(CurBladeStack), FoundPose) #get current position in CurBladeStack Coordinate System
textmsg("CurrentTCP in CurBladeStack:",FoundPose)
global FoundPose = p[Xpos/1000.0,Ypos/1000.0,FoundPose[2],FoundPose[3],FoundPose[4],FoundPose[5]] # set x and y from Camera Coordinates.
Just from my experience subPrograms seem useful, but actually cause many problems.
If there is a good way to achieve what you want without subprograms I would try for that.
If your library of targets was just an array/list of xyz coordinates to go to you could have a common robot program that just looped through the array for whichever part was selected. It would just make it a bit difficult to adjust points because you couldn’t manually move the robot to that program step (although really no different with variable waypoints).