Community
HSM Post Processor Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculating Euler Angles

5 REPLIES 5
Reply
Message 1 of 6
bob.schultz
2796 Views, 5 Replies

Calculating Euler Angles

Two common methods for defining a working plane for 3+2 machining is to use the actual rotary table positions to define the working plane, typically on machines that don’t support TCP, or to output a G68.2 style block using Euler angles. HSM post processors have access to functions that will define the Euler angles for a given tool orientation using the Matrix.euler--- attributes, where ‘---‘ designates the rotation order for the axis rotations defining the Euler angles, for example XYZ, YZY, etc.


The programming manual for each control will define whether it expects Euler angle input and what order the rotations are in. In the current version of HSM the rotation order does not match up with the designated rotation order in the Matrix.euler--- attributes, which makes it difficult to get the desired rotations for the G68.2 block. The following table contains a list of the possible Euler angle rotation orders and the corresponding Matrix.euler--- attributes to use to obtain the proper rotation values for these orders.

 

 

Rotation Order   Matrix Attribute
XYX              eulerXZX_R
XYZ              eulerZYX_R
XZX              (no solution)
XZY              eulerYZX_R
YXY              eulerXYX_R
YXZ              eulerZXZ_R
YZX              eulerZYZ_R
YZY              eulerXYZ_R
ZXY              (no solution)
ZXZ              (no solution)
ZYX              (no solution)
ZYZ              eulerYXZ_R

A new function Matrix.getEuler2() has been added to the post processor so that the requested Euler angles match the specified order. The argument passed to the getEuler2 function defines the order of the Euler angle calculations, such as EULER_XZX_R, EULER_XYZ_R, etc. To use this new function and add backward support for previous versions of HSM you will need to use code similar to the following example.

 

 

 

eulers = workPlane.getEuler2 ? workPlane.getEuler2(EULER_XYZ_R) : workPlane.eulerZYX_R;

Notice that Euler angle orders in the two methods do not match in the above command. The eulerZYX_R attribute is taken from the above table that shows the corresponding Euler order for the proper Euler angle calculation order.


The euler2.cps post processor is furnished in this post. You can use this post processor to gain a better understanding of Euler angles, to test the Euler angle calculations, and to help to determine the correct Euler angle order to use when sample output from another CAM system is provided. When you post against euler2.cps using the default property settings it will calculate the Euler rotations for each possible Euler order and output the results in a .dmp file.

Order  Results  Euler Angles                  Forward Vector              Right Vector
XYZ    good     -119.805, 29.406, -130.601    0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
XYX    good     127.371, 124.538, 53.413      0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
XZX    good     -142.629, -124.538, -36.587   0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
XZY    good     90, -41.41, 139.107           0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
YXY    good     -138.59, -90, -40.893         0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
YXZ    good     131.41, -49.107, 90           0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
YZX    good     -138.59, 40.893, -90          0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
YZY    good     131.41, 90, 49.107            0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
ZXY    good     -90, 48.59, -130.893          0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
ZXZ    good     146.995, 115.659, 33.69       0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
ZYX    good     130.893, -30, 120             0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491
ZYZ    good     -123.005, -115.659, -56.31    0.5, 0.75, -0.433           -0.5669, 0.6614, 0.491

You can then find the output rotations that match the known rotations and use the corresponding Euler angle order in your post. If you are using a version of HSM that does not support the new getEuler2 function, then the results will list BAD for every possibility (some may be marked as good for common 90 degree rotations), which you can ignore and you will use the Euler Matrix attribute listed in the table that has the rotations that correspond to your requirements.

 


If you know the required Euler angles, forward vector (tool axis), and optionally the right vector (X-axis) of the work plane, then you can enable the findAngleOrder property and enter these values into their associated properties. You can run the post against any model and only the angles and vectors entered into the property table will be tested. The output .dmp file will only display the results that match the specified angles and vectors. Once again if the getEuler2 function is not supported, then you will have to use the associated Matrix attribute listed in the table that corresponds to the returned Euler order displayed in the .dmp file.
Euler Properties.png

Order  Results  Euler Angles                  Forward Vector              Right Vector
XYZ    good     -90, 0, -135                  0.7071, 0.7071, 0           -0.7071, 0.7071, 0

 



Bob Schultz
Sr. Post Processor Developer

5 REPLIES 5
Message 2 of 6
scottmoyse
in reply to: bob.schultz

Hi Bob,

 

I see this has been fixed in the latest version of Fusion 360, which builds of Inventor HSM & HSMWorks was it fixed in please?


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


Design & Manufacturing Technical Services Manager at Cadpro New Zealand

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

Message 3 of 6


@scottmoyse wrote:

Hi Bob,

 

I see this has been fixed in the latest version of Fusion 360, which builds of Inventor HSM & HSMWorks was it fixed in please?


Pretty sure this is in HSMWorks2017-R1.41441.

Laurens Wijnschenk
3DTechDraw

AutoDesk CAM user & Post editor.
René for Legend.


Message 4 of 6
bob.schultz
in reply to: scottmoyse


@scottmoyse wrote:

Hi Bob,

 

I see this has been fixed in the latest version of Fusion 360, which builds of Inventor HSM & HSMWorks was it fixed in please?


Hello Scott,

 

It should be in the latest versions of Inventor HSM 2017 4.2.0.042 and as Laurens wrote HSMWorks 2017-R1.41441.  You can run the euler2.cps post processor and if the results all return 'good' then the 'getEuler2' function is present.



Bob Schultz
Sr. Post Processor Developer

Message 5 of 6
ArjanDijk
in reply to: bob.schultz

Hi @bob.schultz,

 

I'm trying to calculate Euler angles but I can't get my head around the multiple solutions. This machine (B axis head, C axis table) expects Roll, pitch yaw angles, so EULER ZXZ. That means (as I understand) that the first rotation is around Z, the second around the new X, and the third around the new Z.

 

As you can see in this example we have 2 operations.First operation is on the right side (B45), second on the left (B-45)

The machinevendor (Mazak) gave me and example:

 

Right side:

G68.2 X0 Y0 Z0 I90 J45 K-90,

fortunatly this is matched by my post:

G68.2 X0. Y0. Z0. I90. J45. K-90.

 

Left side: 

G68.2 X0. Y0. Z0. I90. J-45. K-90.

this is not matched by my post: 

G68.2 X0. Y0. Z0. I-90. J45. K90.

 

But if I look at it, they both have the same outcome. Is there any preference over the first or the second?

euler.PNG170px-Euler2a

 


Inventor HSM and Fusion 360 CAM trainer and postprocessor builder in the Netherlands and Belgium.


Message 6 of 6
bob.schultz
in reply to: ArjanDijk

As you noticed there are 2 solutions when solving for the Euler angles.  The getEuler2 function will only return one of the valid solutions, it does not have the option of selecting between the 2 solutions.  On the machine it should not make any difference which set is used, since the Euler angles are not the rotary axes positions.  The machine should still select the proper rotary orientations.

 

It is easy to check the validity of the angles using the euler2.cps post processor for both solutions by utilizing the findAngleOrder and associated properties.  For example, in your case you can enter the post generated angles, forward vector, and right vector and the post will show that the results are good.

 

 

Sample.png

 

Order  Results  Euler Angles                  Forward Vector              Right Vector
ZXZ    good     -90, 45, 90                   0.7071, 0, 0.7071           0.7071, 0, -0.7071

You can then change the findEulerAngles property to 90,-45,-90 and again the results will show as good.

 

Order  Results  Euler Angles                  Forward Vector              Right Vector
ZXZ    good     90, -45, -90                  0.7071, 0, 0.7071           0.7071, 0, -0.7071

To determine if the Euler angles are valid the post actually mimics the machine and performs rotations internally.  It does not use the same formula for calculating and validating the angles.



Bob Schultz
Sr. Post Processor Developer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums