Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Qt App Templates
Description: Speeding app development with quickstart templates via roscreate-qt-pkg.Tutorial Level: BEGINNER
Show EOL distros:
Goal
Generate a qt-ros application package with roscreate-qt-pkg.
Generate a qt-ros application package with catkin_create_qt_pkg.
Details
Currently the creational script generates only one template app, though this may be expanded in future. Features include:
- a ros master chooser
- separate ui and ros node classes
- ros node class has connections for gui logging and a spinner
Usage
> rosrun qt_create roscreate-qt-pkg qdude
You can either build with rosbuild (native) or catkin (native/cross-compiles). Refer to the mingw build environment and the mingw qt-ros tutorials for more details.
> source /path/to/my/source/workspace/devel/setup.bash > cd /path/to/my/workspace/src > catkin_create_qt_pkg qdude > cd /path/to/my/workspace > catkin_make --force-cmake > rosrun qdude qdude
> source /path/to/my/source/workspace/devel/setup.bash > cd /path/to/my/workspace/src > catkin_create_qt_pkg qdude > cd /path/to/my/workspace > catkin_make --force-cmake > rosrun qdude qdude
Simply catkin_make in place (native compile) to compile. We've temporarily dropped cross compiling support with the mingw cross compiler on groovy (we're not using any longer) but is possible. Feel free to ask questions if you want to get it working.
Once compiled and running, you can:
Affect gui changes in main_window.ui with qt designer
Modify qt code in main_window.hpp/main_window.cpp
Do ros topics and services in qnode.hpp/qnode.cpp.
For more advanced qt options (e.g. specifying qt components), see the notes in qt_build for a more detailed explanation now how to use the cmake api to configure your package.
Screenshot