how to get the Angle A,B,C if Point and Normal of the surface is known

  • Hi All,


    I am having hard time with the 3D co-ordinate system finding the proper angle for A,B and C in Cartesian Co-ordinate in KUKA Programming.


    I get the point and Normal from an STL File and my work object is curved one. I applied all the possible math that I know to find the angle but nothing seems to be working as expected. may be my understanding about point, normal and unit vector are sparse.


    can you any one share some knowledge about these angles.


    my manually moving the axis in different points on the work object the expected angle variable like A= -89 to + 80 B = -10 to 25 and C = -179 to + 150


    Jibesh

  • Well, the best archived thread on this topic (over in the math&geometry sub-forum) appears to have been lost during the last forum upgrade. Dangit.


    KRL orientation is defined by Euler angles, in the sequence Rz (A), Ry (B), Rx (C). A and C are constrained to +/- 180deg, and B is constrained to +/-90deg. I don't have the math chops to tell you how to go from a point&normal to ABC (especially since I don't know how you're defining "normal" -- there are many different valid methods), but there ought to be a fairly standard conversion for it somewhere.


    One of the things I salvaged from the now-lost discussion thread was a matrix conversion for XYZABC that I have stored at kuka.skyefire.org. If you have a grasp of linear algebra, this might be of help to you.

  • I suppose it really depends on what format you have the point an angle in. What software/language are you using? Its actually not much harder than projecting the vector to the ortho planes and then measuring the angle relative to a reference vector. Are you trying to do it all in krl, as that could be a little more difficult?

  • Thanks SkyeFire and wes_mcgee for your response. for some reason I didnt get the e-mail notification of your replies and today I accidentally checked my post.


    I got the formula to find the angle by taking the tangent between and X,Y and Z axis of the Normal vector , one of my colleague helped me to find this.

    This is what I applied to find the angle. since the rotation about the Z axis (Angle A) is not important to me I set this as 0 and for B and C I use


    angleA = 0;
    angleB = Math.Atan2(toolNormal.Y , -toolNormal.Z);
    angleC = Math.Atan2(-toolNormal.X, toolNormal.Z);


    I am using .Net class to generate KRC Programs and feed to KRC through Directory loader in KRC4.

  • so toolNormal.Y is the y vector of the tool? I am not sure what your method is giving you, but if you have the y vector, then to get B you simply flatten/project this vector to the YZ plane, and measure the angle between the world Y and your flattenedToolNormal.Y. Typically you need a little logic to get the signs correct, and understand B won't exceed 180 or -180. Not saying this is the easiest or most elegant way, but it works for me.


    admittedly, your method looks to be doing that as well, so maybe you have it close and its just the sign wrong or something? what does your code produce?

  • Quote

    Can you really not specify a tool def for example as [0,0,0,0,120,0]?


    Of course you can. But this orientation is equal to {X 0,Y 0,Z 0,A 180,B 60,C 180} as you can see by entering {X 0.0, y 0.0, z 0.0, a 0.0, b 120, c 0.0}:$NULLFRAME in e.g. VarCor. Its just like sinus or cosinus functions which have a standard interval of [0,2pi], but any other interval of length 2pi will lead to the same results. Internally the controller always converts the orientation to the standardized intervals given previously by SkyeFire. On this standardized intervals the values A,B,C are unique (apart of the Euler singularity at B exactly +-90°, where only the sum of A and C is unique).


    Fubini

    Edited once, last by Fubini ().


  • so toolNormal.Y is the y vector of the tool? I am not sure what your method is giving you, but if you have the y vector, then to get B you simply flatten/project this vector to the YZ plane, and measure the angle between the world Y and your flattenedToolNormal.Y. Typically you need a little logic to get the signs correct, and understand B won't exceed 180 or -180. Not saying this is the easiest or most elegant way, but it works for me.


    admittedly, your method looks to be doing that as well, so maybe you have it close and its just the sign wrong or something? what does your code produce?


    Y is not a vector it is a component of Normal vector. 'toolNormal' is the normal vector for the 3D place and X,Y and Z are the components of the vector.

  • lets say my object is a rectangle with X length and Y breadth, origin is at the center of the rectangle then I get the value for A,B and C as 0,0,180. I do convert the result into degree my multiplying 180 / Math.PI


    eg:
    X length = 300; Y length = 200 and Z height = 100; origin at 0,0 middle center



    if I perform the rotation about Z axis by 180 degree I get C

  • Well, in KUKA reference, A=Rz, B=Ry, and C=Rx. But other systems use other equally valid Euler sequences. Which can create some real confusion when you try to link a KUKAbot with another system that uses Rx for A, Rz for C, etc.


  • Well, in KUKA reference, A=Rz, B=Ry, and C=Rx. But other systems use other equally valid Euler sequences. Which can create some real confusion when you try to link a KUKAbot with another system that uses Rx for A, Rz for C, etc.


    SkyeFire I understand the rotation about each axis. But my calculation in finding the angle works fine in one direction and having sign program in other direction.


    in my case the base is calibrated with Angle A = -179, B=0 and C=-0.056; The origin of my work piece is middle center 0,0.


    so If I want to move a point X=3 and Y = -170 , I get the Normal Vector from the STL as " Normal X=0 Normal Y= -0.409 and C = 0.0913


    toolNormal = -toolNormal; // invert X,Y and Z pointing the Z down
    angleA = 0;
    angleB = Math.Atan2(toolNormal.X , -toolNormal.Z) * 180 / PI; // given angle in degrees, using only X and Z components
    angleC = Math.Atan2(-toolNormal.Y, toolNormal.Z) * 180 / PI ; // given angle in degrees


    applying the above formula gives
    0,0,-155 which is the expected result


    but If I moved to opposite edge eg: X = -250, Y = 50 I get the angle values like
    A = 0,B = -19 and C = -179 where I expect C should be +ve. ( Normal at this point is : X = -0.33 Y = 0 and Z = 0.941 )


    I dont know how to adjust this sign change.

Advertising from our partners