1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. General Category - Robot Forum
  4. Robot Geometry, Linear Algebra, Forward and Inverse Kinematics
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

ABB quaternions calculation

  • Raziel1000
  • April 27, 2025 at 11:39 AM
  • Thread is Unresolved
  • Raziel1000
    • April 27, 2025 at 11:39 AM
    • #1

    Hello All

    I need some answers for ABB quaternians . I am in develop of small appliation for ABB spray robots and there is necessary aply

    the possibility for spray gun tilting (use angles ) .

    Calculation in program is done . But calculated angles from quaternians do not give a sense .

    For example ABB robot modul : where are quternians values like -> LOCAL CONST robtarget p_201_013:=[[550,366,100],[0.128860,0.695266,-0.695266,-0.128860],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,240.925]];
    This quaternians values should by after conversion to eulers 0 for all xyz . But is't. It is x 159, y 0 ,z -90 .

    Could somebody explain if robot system calculate the 0 from base axis or from axis of world object or axis of tool .

    Thanks .

  • panic mode April 27, 2025 at 12:10 PM

    Approved the thread.
  • hermann
    Reactions Received
    406
    Trophies
    9
    Posts
    2,610
    • April 27, 2025 at 5:20 PM
    • #2

    The same as when you use euler angles.

    It's the angle of the actual tool in actual workobject. When you set workobject to zero/world it is the angle in respect to world, when you change the workobject to a different one, it is that workobject.

    Quote from Raziel1000

    Calculation in program is done ....

    Quote from Raziel1000

    LOCAL CONST robtarget p_201_013:=[[550,366,100],[0.128860,0.695266,-0.695266,-0.128860],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,240.925]];
    This quaternians values should by after conversion to eulers 0 for all xyz . But is't. It is x 159, y 0 ,z -90 .

    Nope, the euler equivalent values of quaternians in p_201_013 aren't all zero.

    Conclusion: calculation is wrong.

  • Raziel1000
    • April 27, 2025 at 11:23 PM
    • #3

    Dear Hermann

    Thanks for your reply .

    I use calculations from wikipedia


    From Q to E :

    struct Quaternion
    {
    double w, x, y, z;
    };

    // This is not in game format, it is in mathematical format.
    Quaternion ToQuaternion(double roll, double pitch, double yaw) // roll (x), pitch (y), yaw (z), angles are in radians
    {
    // Abbreviations for the various angular functions

    double cr = cos(roll * 0.5);
    double sr = sin(roll * 0.5);
    double cp = cos(pitch * 0.5);
    double sp = sin(pitch * 0.5);
    double cy = cos(yaw * 0.5);
    double sy = sin(yaw * 0.5);

    Quaternion q;
    q.w = cr * cp * cy + sr * sp * sy;
    q.x = sr * cp * cy - cr * sp * sy;
    q.y = cr * sp * cy + sr * cp * sy;
    q.z = cr * cp * sy - sr * sp * cy;

    return q;
    }

    From E to Q :

    Code
    struct Quaternion {
        double w, x, y, z;
    };
    
    struct EulerAngles {
        double roll, pitch, yaw;
    };
    
    // this implementation assumes normalized quaternion
    // converts to Euler angles in 3-2-1 sequence
    EulerAngles ToEulerAngles(Quaternion q) {
        EulerAngles angles;
    
        // roll (x-axis rotation)
        double sinr_cosp = 2 * (q.w * q.x + q.y * q.z);
        double cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y);
        angles.roll = std::atan2(sinr_cosp, cosr_cosp);
    
        // pitch (y-axis rotation)
        double sinp = std::sqrt(1 + 2 * (q.w * q.y - q.x * q.z));
        double cosp = std::sqrt(1 - 2 * (q.w * q.y - q.x * q.z));
        angles.pitch = 2 * std::atan2(sinp, cosp) - M_PI / 2;
    
        // yaw (z-axis rotation)
        double siny_cosp = 2 * (q.w * q.z + q.x * q.y);
        double cosy_cosp = 1 - 2 * (q.y * q.y + q.z * q.z);
        angles.yaw = std::atan2(siny_cosp, cosy_cosp);
    
        return angles;
    }
    Display More

    The problem is that as you wrote abowe that same axis of tool and Wobj do not give the zero rotation . Wobj is rotated in 130° on X from world .

    I am not ABB technician I must create application for robots witch was set by another company .

    Thanks Juraj .

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,424
    • April 28, 2025 at 6:40 PM
    • #4

    I think ABB uses ZYX sequence for Euler, rather than XYZ. That could be part of the problem.

    ABB RAPID includes OrientZYX() and EulerZYX() to convert between Euler and Quaternions the way that ABB does it.

  • MOM
    Reactions Received
    175
    Trophies
    7
    Posts
    1,424
    • April 28, 2025 at 9:03 PM
    • #5
    Quote from Raziel1000

    For example ABB robot modul : where are quternians values like -> LOCAL CONST robtarget p_201_013:=[[550,366,100],[0.128860,0.695266,-0.695266,-0.128860],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,240.925]];
    This quaternians values should by after conversion to eulers 0 for all xyz . But is't. It is x 159, y 0 ,z -90

    Using my tool I get the same result

  • MOM
    Reactions Received
    175
    Trophies
    7
    Posts
    1,424
    • April 28, 2025 at 9:13 PM
    • #6

    having x,y and z set to 0 you would need this quaternation

  • Raziel1000
    • April 30, 2025 at 3:44 AM
    • #7
    Quote from MOM

    Using my tool I get the same result

    Thanks for reply MOM ,

    That means calculation is good .

    Question is if there is set Wobj and the tool . And if I understand correctly or not , tool axis are set as in same position as Wobj axis after the rotation of tool should be 0 or not ?

    Or it is calculated form world axis ?

  • hermann
    Reactions Received
    406
    Trophies
    9
    Posts
    2,610
    • April 30, 2025 at 7:22 AM
    • #8

    You must think more abstract. Every coordinate is the position of actual tool in actual workobject. The coordinates convert into a tangible position when you move to that coordinates. The real position in real world changes when you use different tool or workobject.

    The calculation of quaternion from euler an vice versa is complete independent from tool and workobject.

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • General conversion between different coordinate system types (KUKA, Fanuc, ABB, etc)

    • SkyeFire
    • January 7, 2022 at 5:36 PM
    • Robot Geometry, Linear Algebra, Forward and Inverse Kinematics

Users Viewing This Thread

  • 1 Guest
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download