Universal Robots Forum

Moving to waypoint by its name

Hello all!

I have a sequence of 70+ waypoints that I am moving through using moveP. I have a force/torque sensor to detect if/when I make a collision while moving through these points. I would like to move back to my start point via the waypoints I traversed if I detect a collision (calling them in reverse order after colliding).

The way I thought I might be able to implement this is by leaving waypoint to their default names (Waypoint_1, Waypoint_2,etc) and incrementing a counter if I reach my next my next point without collision. I if do collide, I would like to do something like: movep(“Waypoint_”+to_str(counter)_p, a=1.2, v=0.25, r=0). this would allow me to back out starting at any waypoint in my chain and move to the starting waypoint by decrementing my counter between moves. This line however does not work as the argument for the pose is still a string and not a pose.

Does anyone know of a way I can move to a waypoint by passing its name or a better way to get my desired behavior? I do not need to use movep if that is an issue, but that move is preferred to limit accelerations and noise in my F/T sensor

Robot: UR5e, Polyscope:5.9

I had a thought that could also get my desired behavior, but it has nothing to do with calling a waypoint by its name. I thought that if I could sequence all my waypoints in reverse order under a single movep, then change the UR program counter to jump to a specific line in the program tree, I could jump to the line making a movement to my desired waypoint and the counter would continue and move the robot to my starting waypoint. Does there currently exist a way to change the UR program counter so that I could jump to a specific line in my program tree?

I can’t think of a way to use the actual names of the waypoints. However, you should be able to store the actual poses for the waypoints in an array and iterate back through them in reverse order. You could create a function to do this. Call the function after you finish moving to each waypoint, the function would manage storing the pose of that current waypoint in the array and manage the index into the array. I would do all this in script as script removes some of the limitations that polyscope places on initializing large arrays, etc.

Wonderful! Yes that could do exactly what I’m looking for! For anyone looking for the same behavior I described in my original post, this should get you there. This doesn’t technically call waypoints by their name, so I’m not sure if I should mark it as a solution given that this was the title of the thread. Many thanks for the solution to my needs though!