RE: Robot theory and how to use it in UR robots

Continuing the discussion from Script function to create a Plane with 3 variables points:

First of all, sorry for the beginner’s question, but I’m quite inexperienced in programming.
I am trying to use the script function to define a plane variable that will be used in place of “taught” installation feature.

I was expecting that running the robotics_r1.script after teaching the p1 p2 p3 points, would have generated a plane variable usable as a feature (for example in a MoveJ node) but there is no “feature_plane” option among the selectable features.

The robotics_r1.script returns a variable called “feature_plane” and it looks like a list variable and I don’t know how to use it in a pose_trans function.

This line: movel(pose_trans(feature_plane,p[0,0,0,0,0,0])) should move the robot to the feature_plane’s origin, but it returns an error because the feature_plane variable is a list variable and not a pose variable.

Assuming that the feature_plane variable might be a pose representation with the UR cartesian cordinates structure [x,y,z,Rx,Ry,Rz], I tried to create a pose variable with the same exact values p[x,y,z,Rx,Ry,Rz], but that didn’t work either.

How should I use the feature_plane vairable resulting from the script to go from the Home position of the robot to the feature_plane’s origin and then move from there to a another position, like for example X=100 Y=0 Z=100?

Moreover, could you please confirm that if I teach the 3 points needed for the plane p1 (origin) p2 (x+ axis) p3 (y+ axis) using the freedrive() function, the resulting feature_plane will retain the tcp orientation as while teaching in p1, p2 and p3?

Thank you very much for helping me solving this matter.

Hello Zungiu,

a feature is generally saved as a single Pose Variable representing the origin and orientation of the correspondent plane/point/line.

The return value of the get_feature_plane() - Function in the linked script is not a pose but an array holding the values dedicated for a pose. You can either transfer the return value into a pose, or adjust the script yourself.

For me the the Script was working as expected and the calculated Feature is the same as the one generated using our wizard in the installation. See the following picture for reference:

This pose is already in base coordinates, so you can approach it directly in using a move-command. It is important to safe the scripts return value in a pose variable. Otherwise it will be interpreted as joint angles!

From there you can use pose_trans() as described: movel( pose_trans( feature_plane,p[ 0.1,0,0.1,0,0,0 ] ) )

The orientation of the TCP does not affect the orientation of the generated plane. Only the position will be used to calculate the correspondent pose. You can try out different poses in the Simulator and see how it affects the overall orientation of the plane.

During the usage of the script function I ran into an issue. Having the plane parallel to the base plane led to the following result:


The script needs to be adjusted to catch some corner cases.

sko

Thank you for your reply, very helpful indeed.

I compared the actual poses of a taught feature with those coming from the script and it turns out that my program was almost ok, but it required additional rx and ry parameters in the pose trans command.

When it was like this: movel(pose_trans(feature_plane,p[0,0,0,0,0,0]))
the robot tried to face the plane from behind, exactly a 180° rotation.

I changed it to: movel(pose_trans(feature_plane,p[0,0,0,3.14,0,0])) and it works perfectly.

One more thing: how can I transfer my script programmed feature_plane to an installation feature?
I have a long program written with polyscope which is full of Move and Direction commands wrt to a “taught plane" (installation feature).
I would like to keep the polyscope version by changing the taught feature in the Move nodes with the calculated plane and avoid rewriting every Move node as script code.
I hence tried to assign the calculated “feature_plane” to the “taught plane" variable, but it doesn’t work.

To me the behaviour it’s kind of strange: :

#00# I have a taught_plane among my installation features, at the beginning of the program the taught_plane variable shows the (x1,y1,z1,rx1,ry1,rz1) values as stored in the installation.

#10# freedrive() and get_actual_position() to get the three points needed for the feature_plane

#20# feature_plane calculation script code which return a feature_plane (x,y,z,rx,ry,rz)

#30# convert the feature_plane in a pose variable p[x,y,z,rx,ry,rz]

#40# taught_plane = feature_plane (in this way I try to change the stored plane feature

At this point the taught_plane variable shows the (x2,y2,z2,rx2,ry2,rz2) values as the calculated feature plane

#50# Move nodes in polyscope wrt “modified” taught_plane feature

It doesn’t work: the Move node at #50# make still reference to the installation feature as it was displayed at #00#

Any idea?

It is not possible via Script to provide a Plane to the installation. This can only be achieved via the Plane Wizard or a URCap.

Changing the Plane Pose during the program would also be the approach I recommend. But the change has no influence on the pre-taught plane in the installation. The change in the planes pose will be reverted, once the program is stopped. The value in the installation is not affected.

Can you share the correspondent part of the script code?

In that case, I would rather store the plane in another installation variable, before passing it to the feature plane variable, to keep it after the robot restarts.

I am not sure what script to share, my program is in polyscope apart from the plane definition script, which I downloaded from the forum.
Could you please clarify your question?

I was referring to the Script code / program part handling the actions above.

freedrive_mode()
Popup: Set Origin
p1≔get_actual_tcp_pose()
Popup: Set X+ axis
p2≔get_actual_tcp_pose()
Popup: Set Y+ axis
p3≔get_actual_tcp_pose()
end_freedrive_mode()

Script: robotics_r1.script

The script returns a plane as a list variable “feature_plane”, I converted it in an position variable “plane_cstm_scrpt” which is an installation variable

 plan_cstm_scrpt = p[feature_plane[0],feature_plane[1],feature_plane[2],feature_plane[3],feature_plane[4],feature_plane[5]]

“plane_cstm_inst” is an installation feature plane that I use to temporary transfer the script calculated plane to.
You have to do the assignment in every program: once the program is closed, the installation feature plane will get the previous values back.

 plane_cstm_inst≔plan_cstm_scrpt

Usage Examples:

 MoveL
   Direction: plane_cstm_inst Z+
     Until (distance)

I can use the Move commands wrt the calculated plane by setting “plane_cstm_inst” as a feature in the polyscope “Move” dialog box.
In my program I had to set up the rx ry rz values = 3.14 , 0 , 0 to reach the plane from the right direction