Move TCP to Midpoint Between Two Contact Points

Script:

def midpoint(first, second):
  mid = get_actual_tcp_pose()
  mid[0] = (first[0] + second[0]) / 2
  mid[1] = (first[1] + second[1]) / 2
  mid[2] = (first[2] + second[2]) / 2
  
  return mid
end

Add a script file into your before start sequence and type in/paste that into it. Then use an Assignment node to store the points after contact, and use another Assignment node to call the script and pass in the 2 stored points. You can use this newly assigned Midpoint just like any other waypoint, and just use a Variable waypoint and choose that one.

image

I got a little ahead of myself actually and didn’t read your post all the way through. This will find the midpoint between any 2 poses. If you want to do only one axis at a time or something, feel free to modify the script.

2 Likes