Direction Until Variable Distance

Hi all,

I am utilizing the “Direction in Z- Until” node and am familiar with the three options: Until Distance, Until Expression, and Until I/O.

I would like to utilize something similar to the Until Distance option but use a stored variable (let’s call it z_dist) instead of a fixed distance. Is this possible to achieve without using a thread that is constantly evaluating my robot position? I feel like there is an easy work around that I just don’t know about.

Thanks for the help

I’m not away of a solution to this using the Direction node.
If you’re moving in a base axis (X, Y, or Z) then you can “just” do like this as an alternative, though.

image

This will move the robot in the base Z direction 15mm from its current position. :slight_smile:

Thank you for your reply. Unfortunately, the complex part of this problem stems from the fact that I am moving in a feature plane.

I can go two routes to achieve going a variable distance in an axis direction of a feature plane: vary my distance travelled to maintain a consistent starting pose or vary my starting pose to maintain a consistent distance.

Consistent Starting Pose Strategy:

Start_Pose=get_actual_tcp //100 mm above (Z+) desired point in feature Plane1

Current_Pose= p[x,y,z,rx,ry,rz] //50 mm above (Z+) desired point in feature Plane1

Z_Vector=pose_sub(pose_inv(Start_Pose), pose_inv(Current_Pose) // this results in vector that is p[0,0,.05,0,0,0] or 50mm difference with respect to Plane1

Z_Dist= -Z_Vector[2] // 50mm is distance to travel in Plane1 Z-

// I now want to apply this Z_Dist 50mm shift with respect to Plane1 to generate a new Start_Pose (but Start_Pose needs to be defined with respect to base). Is there a way to convert Z_Vector from with respect to Plane1 back to with respect to base to simply vector add it to Start_Pose? pose_trans maybe?


Consistent Distance Pose Strategy:

Start_Pose=get_actual_tcp //100 mm above (Z+) desired point in feature Plane1

Current_Pose= p[x,y,z,rx,ry,rz] //50 mm above (Z+) desired point in feature Plane1

Z_Vector=pose_sub(pose_inv(Start_Pose), pose_inv(Current_Pose) // this results in vector that is p[0,0,.05,0,0,0] or 50mm difference with respect to Plane1

Z_Dist= -Z_Vector[2] // 50mm is distance to travel in Plane1 Z-

//monitoring thread

while(actual_dist<Z_Dist):

actual_dist= actual_dist+pose_dist(Start_Pose, get_actual_tcp_pose) //but this would find my z value in relation to base, not Plane1?

sync()

end

I would prefer the first route, but if I can get either way to work, it would be wonderful.

You’re on the right track with pose_trans. :slight_smile: It’s just a question of where to put it (I personally always forget how to set it up correct).
Below program will move the variable distance in Z axis of CustomPlane. MoveL is (of course) in the CustomPlane feature.
image