ZERO Notificatons

NO Feedback yet!!

okay

xparo
X.P.A.R.O



Quaternion ↔ Euler Converter

Convert between quaternions and roll, pitch, yaw using ROS conventions, and copy the matching tf2 command or code.

Euler angles (roll, pitch, yaw)

In degrees. ROS order: fixed-axis X, then Y, then Z (REP 103).

Quaternion (x, y, z, w)

Same order as geometry_msgs/Quaternion. Edit either side and the other updates.

Rotated frame

Coloured arrows: rotated axes (X red, Y green, Z blue). Dashed grey: original frame. Drag to orbit.

Quaternion
Same rotation (−q)
Roll, pitch, yaw
In radians
Axis–angle
Rotation matrix

Copy into your project

Static transform (quaternion)

Static transform (roll, pitch, yaw)

URDF fixed joint

geometry_msgs orientation (YAML)

Python, tf_transformations

Python, SciPy

C++, tf2

How to use the converter

  1. Type angles or a quaternion. Edit roll, pitch and yaw (in degrees or radians), or paste the four quaternion numbers from a message or a log. The other side updates as you type.
  2. Check the picture. The coloured arrows show where the rotated frame's axes point. If a camera "looking forward" shows its blue Z arrow pointing up, the rotation is not what you meant.
  3. Copy the result. Set the parent and child frame names, then copy a ready-made static_transform_publisher command, a URDF joint, or code for Python and C++.

The convention this tool uses

ROS defines its axes in REP 103: X forward, Y left, Z up for a robot body, angles positive counter-clockwise by the right-hand rule. Roll, pitch and yaw are rotations about X, Y and Z, applied about the fixed axes in the order X, then Y, then Z. That is the same as yaw first, then pitch, then roll about the moving axes, and gives the rotation matrix:

R = Rz(yaw) · Ry(pitch) · Rx(roll) qx = sin(r/2)cos(p/2)cos(y/2) − cos(r/2)sin(p/2)sin(y/2) qy = cos(r/2)sin(p/2)cos(y/2) + sin(r/2)cos(p/2)sin(y/2) qz = cos(r/2)cos(p/2)sin(y/2) − sin(r/2)sin(p/2)cos(y/2) qw = cos(r/2)cos(p/2)cos(y/2) + sin(r/2)sin(p/2)sin(y/2)

This matches tf2::Quaternion::setRPY, tf_transformations.quaternion_from_euler, URDF rpy attributes and SciPy's lowercase 'xyz' sequence. We check the converter against SciPy and tf_transformations on thousands of random orientations; they agree to about 10−13 radians.

Three things that trip people up

Camera images use a different frame (REP 103 "optical" frame: Z forward, X right, Y down). The Optical frame example above gives the rotation from a body frame to an optical frame: roll −90°, yaw −90°.

Frequently asked questions

What order are x, y, z, w in?

ROS messages such as geometry_msgs/Quaternion store x, y, z first and w last. Some libraries (Eigen's constructor, many maths texts) put w first, so check before copying numbers.

What rotation order does ROS use for roll, pitch, yaw?

Roll about the fixed X axis, then pitch about the fixed Y axis, then yaw about the fixed Z axis. That is the same as yaw, then pitch, then roll about the moving axes.

Why do I get a different but equivalent answer?

q and -q describe the same rotation, and near pitch = ±90° (gimbal lock) many roll/yaw pairs give the same orientation. The converter shows the standard solution.

My quaternion is not normalised. Is that a problem?

A rotation quaternion must have length 1. The converter normalises it for you and warns you, because an unnormalised quaternion in a message usually means a bug upstream.

Guides for this tool

In-depth articles that explain the ideas behind the Quaternion ↔ Euler Converter, with worked examples.

Quaternion ↔ Euler Converter has its own project page with the story behind the tool, a gallery and every guide in one place.

Visit the project page →

More free tools

Every tool runs in your browser. Nothing you enter is uploaded.