Qt ROS2 Examples
These examples show how to build Qt/QML applications on top of ROS 2 using the Qt ROS2 Bridge — from a single publisher in a dozen lines of QML to a full robot-monitoring dashboard and a 6-DOF teach pendant. Each one is a self-contained Qt application; the ROS 2 side (topics, services, actions, and TF) is spoken entirely through the generated QtRos2 QML modules.
The examples live in the examples/ directory of the repository and are excluded from the default workspace build via a COLCON_IGNORE marker, so they do not slow down a module build. Open an example's CMakeLists.txt in Qt Creator (from a shell that has sourced your ROS 2 environment) to build and run it.
Before you start
All of the examples need a running ROS 2 environment. Source it in every terminal you use — the one that launches Qt Creator or the application, and any terminal running a ROS 2 backend such as turtlesim_node or a simulation:
source /opt/ros/jazzy/setup.bashNote: Before running an example, make sure every ROS 2 node from a previous example has been terminated — both the Qt application and any backend nodes (turtlesim_node, simulation launches, controllers). Two nodes that claim the same node name, topics, or TF frames will interfere with each other and produce confusing results such as jumping poses or missing data.
The examples
The list below is ordered roughly from simplest to most complete. If you are new to the bridge, start with Simple Publisher and Simple Subscriber, which introduce the Node type and a single publisher/subscriber, continue with Simple Service and Simple Service Client, which show both ends of a ROS 2 service, then move on to the TurtleSim Controller, which adds actions.
Publishing a geometry_msgs/PoseStamped message from QML with a single publisher. | |
Subscribing to a geometry_msgs/PoseStamped message and binding its fields into the UI. | |
Answering std_srvs/SetBool requests from QML with a single, mostly declarative service server. | |
Calling a std_srvs/SetBool service declaratively from QML by binding the request property. | |
Driving the classic ROS 2 turtlesim with all four communication patterns — publisher, subscriber, service, and action — from one QML app. | |
Importing a URDF robot as a Qt Quick 3D module with physics collision shapes, driven either by an animation or by live ROS 2 joint states. | |
An RViz-style monitoring and control dashboard for a Nav2 mobile robot, combining a live 3D scene, a camera feed, and navigation actions. | |
A teach pendant for a 6-DOF arm: a live 3D model driven by TF, joint jogging and waypoint programming driven by joint trajectories. |
Where to go next
- For the message types the examples publish and subscribe to, see the Qt ROS2 QML Types reference.
- For guidance on picking sensor message types, see Choosing Sensor Message Types.
- For sending velocity commands and navigation goals, see Teleoperation and Remote Control.
© 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.