Universal Robots Forum

Keeping toolflange parallel to surface

Hello,

I just wrote my first program which moves to a variable position.
The X, Y, Z coordinates are doing very well and behaving like expected.
However, I would like my tool to stay parallel to a certain surface for some movements (not all movements).
I have tried setting the RX, RY, RZ to a fixed value but this only created some very strange and impossible robot positions.

So: I would like to keep the robot parallel to the wooden background while moving to the blue marble (see picture below). How would I go about doing this?

I’ve also included the code that I use