Hello to all...
I found post on the forum for angle conversion between euler and quaternions.
bit confusion if someone guide me.. From CAD drawing if i get angle between two points is 30 degrees.
How i ll convert it into quaternions.. 30 degree is from reference to the gap between two points (an ARC). how to tell robot what will be orientation when reached at 2nd point.


  • Hi Lordsikander, 

    I think I follow your question, let me know if the diagram below is correct? 
    You have a tool orientation at point A, and want to do an arc to Point B, and need to know the tool orientation at point B, rotated around some reference or origin position? 
    If you have a reference work object or pose at your origin point and define your positions relative to that and then use the PoseVect and PoseMult functions to get the rotation and/or position of the pose at point A rotated to point B. Hopefully the code below helps. In this example there is a work object at the origin, and the rotation is about the Z axis, clockwise, which is negative.  

    ! Work object for the origin to be rotated around
    PERS wobjdata wod_Origin;
    PROC Main()
        ! Robtargets for each point
        VAR robtarget rt_PointA;
        VAR robtarget rt_PointB;
        ! The tool pose at each point
        VAR pose ps_PointA;
        VAR pose ps_PointB;
        ! The angle to rotate to get from point A to point B
        ! 30 degrees clockwise is -30 around the z axis of the origin in this case
        VAR num n_RotationAngle := - 30;<br>
        ! Store the robtarget tool pose from pointA
        ps_PointA := [rt_PointA.trans, rt_PointA.rot];
        ! Use PoseMult to get the pose at point B
        ! Note that "[[0,0,0],OrientZYX(n_RotationAngle,0,0)]"
        !     represents a pose that is purely rotated about the z axis
        ps_PointB := PoseMult( [[0,0,0],OrientZYX(n_RotationAngle,0,0)], ps_PointA );
        ! Store the pose at B in the robtarget
        rt_PointB.trans := ps_PointB.trans;
        rt_PointB.rot := ps_PointB.rot;

    If points A and B are not defined relative to the point they are rotated around it just adds extra steps to first define them relative to that point, then rotate, then convert them back to their original work object coordinates, still using PoseMult and also PoseInv. 

    Note that for your arc you will likely need a mid point as well, however the same steps can be applied with a 15 degree rotation, or half of your main rotation. 

    Hope this gives you a starting point,

  • Sir thanks a lot for your help and appreciation for the example code..
    I got the idea from your example. Currently i was working on the concept of "EulerZYX'. Please guide me if i am doing wrong.
    manually teach first point and extract euler angle values at that point, Go for some random point between the semi circle length and check for euler values again. Calculate the constant step between the values. 
    Sir for my assignment, i have to drill a hole after every few degrees in a semi circle profile. to make it easy i was trying to use For Loop once calculate the constant values that will keep the exact orientation with respect to surface. then simply update the orientation values and re-orient the tool automatically.. 
    please correct me if i am on the wrong track..
  • lemster68
    lemster68 ✭✭✭
    Have you simply tried to solve this by using the RelTool function?
    Lee Justice