# Delta Tau Forums

Full Version: ellipse in motion program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have been looking over the ellipse example in the circular interpolation.pdf file but I have some questions about it. First the example talks about the use of a NORMAL command but this command is not listed in the example program. Second the example has a couple of blocked out areas in the example that i am guessing are important to the example.

Does anyone else have any examples on how to draw ellipses?

Thanks in advance
NORMAL defines the direction vector that points in the direction perpendicular to the plane of the circle. For example, if you point the nomal vector in the Z direction and you do a CIRCLE move in the X-Y plane you get a true circle. Now, if you point the direction vector in a direction that is an angle to the X-Y plane and then do a CIRCLE move in the X-Y plane, PMAC computes the CIRCLE in X-Y-Z space, but only makes the move in the X-Y plane, hence you get an ellipse. Think of it like the X-Y plane is cutting a cylinder whose axis is parallel to the NORMAL vector. If you play with this a bit you will understand how to do the algebra to get what you want.
In Example 1, the NORMAL command is used.
However, because of wrong break in the command line, the command got into the comment.
This is a typo.

If you look at that example again, you will see what I mean.
The command line should be:

NORMAL k-1 j (-TAN(60))

(12-12-2012, 09:33 PM)dholden Wrote: [ -> ]I have been looking over the ellipse example in the circular interpolation.pdf file but I have some questions about it. First the example talks about the use of a NORMAL command but this command is not listed in the example program. Second the example has a couple of blocked out areas in the example that i am guessing are important to the example.

Does anyone else have any examples on how to draw ellipses?

Thanks in advance
(12-14-2012, 10:25 AM)JayL Wrote: [ -> ]In Example 1, the NORMAL command is used.
However, because of wrong break in the command line, the command got into the comment.
This is a typo.

If you look at that example again, you will see what I mean.
The command line should be:

NORMAL k-1 j (-TAN(60))

(12-12-2012, 09:33 PM)dholden Wrote: [ -> ]I have been looking over the ellipse example in the circular interpolation.pdf file but I have some questions about it. First the example talks about the use of a NORMAL command but this command is not listed in the example program. Second the example has a couple of blocked out areas in the example that i am guessing are important to the example.

Does anyone else have any examples on how to draw ellipses?

Thanks in advance

Seems no effect on power pmac, only circle in x-y-z space is made, what I need is an ellipse in x-y-z space. Anyone can help?
Maybe the attached application note from the Delta Tau website will help.
(08-09-2017, 10:36 AM)Gregs Wrote: [ -> ]Maybe the attached application note from the Delta Tau website will help.

my motion prog:

open prog 4

ts 100;
ta 210;
F10;
inc
inc(I,J,K);
normal k-1 j(-tan(60));
circle1;
i-10 j0;

close

I have learnt that.
By gatering x-y-z pos with a plc, the tcp path is a true circle in space.
what I need is an ellipse in space, not a true circle. :)
lovu,

Can you redefine your axes? If you were to scale them differently, then draw a circle, your result would be an ellipse.

Alternately, if you can generate a list of points along your elliptical path, you could use a SPLINE move and simply command the tool tip to move through all of the points.

We're trying to think of if there's a better way...theoretically, drawing a circle in 3D space, projecting it into 2D space to get an ellipse, and then performing an axis transformation to rotate it would lead to your tool tip truly being commanded along an ellipse, but I don't feel it's particularly elegant.
(08-10-2017, 09:03 AM)AAnikstein Wrote: [ -> ]lovu,

Can you redefine your axes? If you were to scale them differently, then draw a circle, your result would be an ellipse.

Alternately, if you can generate a list of points along your elliptical path, you could use a SPLINE move and simply command the tool tip to move through all of the points.

We're trying to think of if there's a better way...theoretically, drawing a circle in 3D space, projecting it into 2D space to get an ellipse, and then performing an axis transformation to rotate it would lead to your tool tip truly being commanded along an ellipse, but I don't feel it's particularly elegant.

Hello AAnikstein,

Many thanks for your kindly reply.
Yes, I know the desired ellipse can be got from a projected translated spacial circle.
Do you mean PPMAC cannot draw ellipse directly? I want to draw it with a robot .
Hi Lovu,

NO, PMAC can't draw an ellipse directly.

However, if you manipulate your axis scaling, then you should be able to "stretch" a circle to ellipse.
the way to achieve this is, figuring out correct scale on each axis and then implement the scaling in transformation matrix.
to do this:
1. You need to calculate unit NORMAL vector XYZ direction component length. let's say they are Lx Ly Lz, and Lx^2+Ly^2+Lz^2 = 1
2. you need to define your ellipse's "long-axis" vector, and this will be the direction you want to stretch the circle. and of course, this vector has to be normal to NORMAL vector of the circle.
3. get XYZ direction components of this long-axis vector, let's say it's [Ax, Ay, Az]. and then you find the scaling between each direction. X-axis direction scaling will be Sx=Ax/Lx, and so on
4. Put these 3 values in transformation matrix. This part I won't explain here. Please see Turbo PMAC User Manual, Axis Transformation Matrices section.
5. In motion program, go to the short-axis position of your ellipse, and then to TSELn command, which will use transformation n to do the following move.
6. pmatch is the next command. This is to make sure that the axis position calculation is correct from current motor position after the scaling provided in matrix n. at this point, you should not see a position jump because the short-axis direction should have a unit scaling.
7. draw the circle with circle command.
8. when it finishes, do command TSEL0 to deselect the transformation.

Although we haven't tried it, this should work.
CORRECTION :

step 1,2,3:
it really should be just one step, and the scaling is not from the scale between NORMAL and long-axis vector.
The scaling should be directly from [Sx, Sy, Sz] = [Ax, Ay, Az]
Hi Louv,

the idea of previous post did not work out as I expected.
I apologize for that.
In order to do any 3D ellipse in 3D space, the idea is to stretch a 3D circle.
So, you have to find the correct transformation matrix to stretch the circle.
The idea is to find correct eigenvectors and eigenvalues, construct the transformation matrix, and then use the transformation.

the example I made below is drawing a circle, start from [0, 0, 0], and the circle center is at [1, 1, 0]
after drawing a circle, it is stretched in [-1, 1, 0] direction with scale of 2.

the eigenvectors and eigenvalues I choose are:

Lambda1 = 1, with V1=[-1/sqrt(2), -1/sqrt(2), 0], short-axis, from center to starting point
Lambda2 = 2, with V2=[-1/sqrt(2), +1/sqrt(2), 0], long-axis, from center to long-axis vertex point
Lambda3 = 1, with V3=[0, 0, 1], normal direction, NORMAL vector direction

let V=[V1, V2, V3], D=3x3 matrix with diagonal elements Lambda1, 2, 3

M = V*D*V'

with these, you can construct a transformation matrix:
[ 1.5 -0.5 0]
M = [ -0.5 1.5 0]
[ 0 0 1]
this is associated with XYZ axes.

so, with the following program, an ellipse can be drawn:

//=========

&1

#1->1000X
#2->1000Y
#3->1000Z

global Tdet = 0

open prog ellipse_test01

Tdet = tinit(1);
Tdata[1].Diag[6] = 1.5;
Tdata[1].Diag[7] = 1.5;
Tdata[1].Diag[8] = 1;
Tdata[1].xyz[0] = -0.5;
Tdata[1].xyz[1] = 0;
Tdata[1].xyz[2] = -0.5;
Tdata[1].xyz[3] = 0;
Tdata[1].xyz[4] = 0;
Tdata[1].xyz[5] = 0;

abs
linear
TA 0 TS 50 TD 0
F 5

X 0 Y 0
dwell 1000

normal K-1
abs
dwell 0
Gather.Enable=2

dwell 0
tsel -1
circle1
I 1 J 1
dwell 0

tsel 1
circle1
I 1 J 1

tsel -1

dwell 0
Gather.Enable=0
dwell 0

close

//=========
Hi Louv,

the code in previous post is in Power PMAC format , not Turbo.
Please change the transformation matrix setting as below, and ignore Gather.Enable command, which is for Power PMAC only.
Also, command tsel -1 is not for Turbo. Please use tsel 0 instead.

TSEL 1 ; Select Matrix 1
TINIT; initialize Matrix 1
Q40=1.5 Q41=-0.5 Q42=0 ; Variables for first row
Q43=-0.5 Q44=1.5 Q45=0 ; Variables for second row
Q46=0 Q47=0 Q48=1 ; Variables for third row
AROT 40 ; Assign these values to the rotation portion