On this page

Quaternion QML Type

Factory functions for constructing quaternion values. More...

Import Statement: import QtRos2.GeometryMsgs
Status: Experimental Extension

Methods

Detailed Description

A singleton helper (mirroring QtQuick3D's Quaternion type) that exposes the quaternion factory functions to QML. For example: Quaternion.fromEulerAngles(0, 90, 0).

Method Documentation

quaternion fromEulerAngles(vector3d eulerAngles)

Construct a quaternion from Qt Quick 3D Euler angles in degrees.

Components of eulerAngles are in the Qt Quick 3D convention (Y-up): x = pitch about X, y = yaw about the vertical Y axis, z = roll about Z, as for Node.eulerRotation. The result is the equivalent orientation as a ROS (Z-up) quaternion. For roll/pitch/yaw in the ROS convention use fromRpyDegrees instead. An overload taking three real arguments (x, y, z) is also available.

quaternion fromQuaternion(QQuaternion q)

Construct a quaternion from a quaternion.

Takes the components of q in ROS order.

quaternion fromRpy(vector3 rpy)

Construct a quaternion from roll/pitch/yaw in radians.

rpy is (x = roll about X, y = pitch about Y, z = yaw about Z) in the ROS convention (Z-up), in radians. An overload taking three real arguments (roll, pitch, yaw) is also available. See also fromRpyDegrees.

quaternion fromRpyDegrees(vector3 rpyDegrees)

Construct a quaternion from roll/pitch/yaw in degrees.

rpyDegrees is (x = roll about X, y = pitch about Y, z = yaw about Z) in the ROS convention (Z-up), in degrees, and is kept in double precision. This is what to publish a roll/pitch/yaw attitude with. An overload taking three real arguments (roll, pitch, yaw) is also available

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.