# Rotation program 180 degrees

• I have an almost mirrored part on my work surface and was wondering if it possible to just rotate the completed part of my program to create the other. For reference the photo attached is what I would like to achieve. Part A is the part already programmed and Part B is the outcome I am looking for. The robot is mounted above the parts with the world coordinates marked (+X brings the robot towards the parts.) The robot is a m20ia and the controller is a r30ib.

## Images

• I've done this for loading parts on a machining center with multiple pallets, but only translated in x and y directions.

In theory you could do something like this:

!Part A ;

PR[2:work frame]=UFRAME[3:Part A] ;

UFRAME[2:Temp]=PR[2:work frame] ;

UFRAME_NUM=2 ;

UTOOL_NUM=2 ;

J P[1] 30% CNT100 ;

J P[2] 30% CNT100 ;
J P[3] 30% CNT100 ;

J P[4] 30% CNT100 ;

J P[5] 30% CNT100 ;

J P[6] 30% CNT100 ;

!Part B ;

PR[13:OffsetWorkFrame]=PR[2:WorkFrame] ;

!Translate coordinate system 180 degrees about x axis ;

PR[13,4:OffsetWorkFrame]=PR[13,1:OffsetWorkFrame]+180 ;

!Translate coordinate system minus 1 unit in Y direction;

PR[13,2:OffsetWorkFrame]=PR[13,2:OffsetWorkFrame]-1 ;

UFRAME[2:Temp]=PR[13:OffsetWorkFrame] ;

UFRAME_NUM=2 ;

UTOOL_NUM=2 ;

J P[1] 30% CNT100 ;

J P[2] 30% CNT100 ;

J P[3] 30% CNT100 ;

J P[4] 30% CNT100 ;

J P[5] 30% CNT100 ;

J P[6] 30% CNT100 ;

You would have to teach user frame 3 as it relates to part A ( the lower left corner could be the origin) then copy the user frame you created to a position register and then copy the position register to a temporary user frame. Then teach the points in your program in user frame 2, when part A is complete copy the position register containing the information for user frame 3 to another position register, modify elements 4 and 2 of that position register and copy that new information to user frame 2, now all taught points are rotated 180 degrees and offset to the right, move to the same points as before.

I say this works in theory, but I'm not certain the robot will reach the points as intended, there may be singularities.

• That translation logic doesn't look right to me. The problem with any direct modification of a user frame is that you are modifying relative to world. So if your world is not planar with the user frame then you will be rotating on a tilted axis.

You have 3 options:

1. I think there may be a program utility to shift/rotate/mirror programs you could try.

2. Just teach 2 separate programs.

3. Use Matrix math to correctly rotate the frame relative to the current UF position.

UF[1] = your original user frame.

PR[1,1] likely needs to have a value to translate back due rotation about your origin

PR[1,2] likely needs to have a value to translate back due rotation about your origin

UF[2] = UF[1] X PR[1]

(the X above denotes matrix multiplication).

The problem with #1 and #3 is that it probably cause your tool to rotate 180 degrees as well. I'm guessing you don't actually want that. So solution #2 is probably the simplest and easiest. It appears you only have 6 points per part. Sometimes simple is good.

• Well I must be super lucky then I've done this type of translation on 5 different robot systems and I am able to translate a position register relative to the position register's user frame, not world. PR[i,j] wouldn't be very useful if it was only modifying relative to world.