I mean… you HAVE the waypoints ahead of time from the “other system.” The robot is going to go in, as @efn said, a straight line for MoveL, and a ROUGHLY straight line for MoveJ (depending on speed, blend radius, etc).
So if I had 3 waypoints whose data looked like:
p1 = [1,1,3,0,0,0]
p2 = [2,1,3,0,0,0]
p3 = [2,2,3,0,0,0]
Then I know, before the robot even moves, that it’s going to go 1 unit in the positive x direction, followed by 1 unit in the positive y direction.
Your original problem statement is that the object you are trying to avoid colliding with is moveable, and the destination waypoint is not the same. Unless you’re using some sort of vision system to generate the path data (in which case I’m not sure why you’d be colliding) then I’m not sure what you plan to DO with the information about the path. Say you were able to confirm that the robot IS going to collide. What now? You just reprogram it? You do that every time?
If you’re saying the working envelope is narrow, and there’s an obstacle at a random location inside that narrow envelope, and you don’t have any sort of vision to detect it, I would honestly write some small routine that uses Force on the robot to approach the target destination, and if it hits something along the way, retract X amount of distance, shift the current TCP some direction, and try again. Like this:
In the crappy paint sketch above, you moving from the BLUE circle to the GREEN circle and the RED box is the obstacle we can’t detect. In this example, I “don’t know” where the robot is going to go, because I don’t care. It moves towards the green circle with force and bumps the red obstacle. I then retract some distance to the PURPLE dot. Then I shift my TCP right, represented by the ORANGE dot. Then I move to the green circle again. If I do this in a loop, I will eventually avoid the obstacle and arrive at the green circle.
I could be missing some very obvious problems with this, not fully understanding your situation,