How move tool straight along x-axis and avoiding joint collision?

We have a UR5e that picks something out of a mold. It must pull in a straight line with no rotation of the part. Our problem happens when the joints hit some obstacles on its mounting base. How do I manipulate the joints to avoid collision while keeping the part in a linear path on the x-axis?

The joints of the robot will move what is required for the tool to move in a linear motion.
You cannot reach that position with having the joints rotated differently and still have the tool oriented the same as at the pickup. :slight_smile:

You should look at picking up the item from another orientation.
Or, as a quick test, you can turn the robot base 180 degrees and swing the arm over itself to see if the new orientation of the joints allows you to move as required (the wrist joints will point in the opposite direction).