How to create reference line from 2 points?

Hello everyone,

I am currently trying to create a reference line from two points, in order to move the cobot along this line.
I managed to write a URScript to get the TCP poses of the reference points, but I’m stuck with trying to use them to create a line.
Does anyone know how to define a line with the first point as the origin and the second point as the direction?

Have a nice day,
Mathis

Hello @mathis.michel,

So firtsly : The line as a feature is represented by one point (a 6 axis vector). So if you would like to use one point as origin and second as direction use x,y,z of point one, and rx, ry, rz of second point to create a third point which will be your line origin point (vector with start in point 1 and direction to point 2)

From the other hand:
If you would like to change or dislocate any position in reference to a vector of two reference points, check this sample of .urp code :
image

So, line_1_pos and line_2_pos is your two reference position which you would like to create a line. Then, using pose_sub() function you will get the 6 axis vector between these two points, so theoretically the line (or for sure the point which can represent your line as a vector in [x,y,z,rx,ry,rz] coordinates.

Then the new_pos is any position, and the final pose is just adding this vector to new_pose using script function pose_add().

Then you will receive final_pose which will be new_pose wherever you will set it displaced by a vector between the points line_1_pos and line_2_pos.

I hope that is what you will would like to receive.

Best!
Wojciech

Thank you for your reply.
The points I will go to will be along the line created, but I only know the x and y offsets from the origin, not their excat location in the base coordinates system.
Can the line created by the pose_sub script function be used as a new coordinates system and in the pose_trans function?

Hello @mathis.michel,
Yeah, it could be used as cs and in the pose_trans() function which will gave you quite the same output.
Like:
image

Regards,
Wojciech