ros-industrial / ros_qtc_plugin

ROS Qt Creator Plug-in (https://ros-qtc-plugin.readthedocs.io)
400 stars 214 forks source link
catkin plugin qt-creator ros ros-industrial

ros_qtc_plugin

This repository contains simple to install and use ROS-related plugins for the Qt Creator IDE. See the repository wiki for installation and additional information.

Overview

The ROS Qt Creator Plug-in is developed specifically for ROS to increase a developers' efficiency by simplifying tasks and creating a centralized location for ROS tools. Since it is built on top of the Qt Creator platform, users have access to all of its existing features like: syntax highlighting, code indexing, editors (C++ , Python, etc.), code completion, version control (Git, Subversion, etc.), debuggers (GDB, CDB, LLDB, etc.), and much more.

The ROS Qt Creator Plug-in provides the following capabilities:

Installation (Binary)

Snap with Qt Creator and Plugin

Get it from the Snap Store

You can install Qt Creator with the ROS corresponding plugin via the snap store. This will make sure that the Qt Creator version and the ROS plugin version will use matching API and update automatically once a new version has been released. You can install the qtcreator-ros snap by searching in the software centre or from the command line:

sudo snap install qtcreator-ros --classic

Manual Qt Creator and Plugin Installation

Qt Creator can be installed via the official online and offline installer.

Download the plugin archive from the release page and extract it into the root of a Qt Creator installation. The Qt Creator root will be ~/Qt/Tools/QtCreator for the online installer and ~/qtcreator-${version} for the offline installer.

The following script extracts the archive to the default online installer location:

sudo apt install libarchive-tools # needed for bsdtar
curl -SL $(curl -s https://api.github.com/repos/ros-industrial/ros_qtc_plugin/releases/latest | grep -E 'browser_download_url.*ROSProjectManager-.*-Linux-.*.zip' | cut -d'"' -f 4) | bsdtar -xzf - -C ~/Qt/Tools/QtCreator

Note: Qt Creator from the online installer may notify you about available updates and install them when instructed to do so. The plugin API is only compatible with patch-level updates. A major or minor update will break the plugin API and Qt Creator will then refuse to load the plugin. Make sure that a compatible plugin version is available before updating Qt Creator as it is not possible to downgrade to an older Qt Creator version using the online installer. The offline installer installs a specific Qt Creator version and does not provide updates.

Build (Source)

Dependencies

To build the Qt Creator plugin, you will need Qt Creator, the matching "Plugin Development" package and a recent Qt version. These can be installed either via the official binary installer or via the install-sdk.py script. The latter method allows you to adjust the target Qt Creator version via versions.yaml.

Additionally, you need:

The dependencies can be installed via apt on Ubuntu:

sudo apt install libgl1-mesa-dev ninja-build libutf8proc-dev

The install-sdk.py script needs additional Python dependencies:

pip install pyyaml requests py7zr==0.21

Install Qt Creator, its development files and Qt to a folder of your choice:

./install-sdk.py --install_path ~/Downloads/

The script will print the CMake commands for building the plugin and create an archive.

Build the Plugin Archive

If Qt Creator and the Plugin Development package are not installed in one of the default folders, you have to tell CMake via CMAKE_PREFIX_PATH where those can be found. With the install-sdk.py command above, this could be (adjust CMAKE_PREFIX_PATH and the Qt version if necessary):

cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="~/Downloads/qtc-sdk/Tools/QtCreator;~/Downloads/qtc-sdk/6.6.0/gcc_64"
cmake --build build --target package

This will create the plugin archive ROSProjectManager-${version}-Linux-${arch}.zip inside the build folder (build by default). This archive has to be extracted to the Qt Creator root path (e.g. ~/Qt/Tools/QtCreator/ for the online installer version).

On Debian-based distributions, you can generate a Debian package via CPack:

# install the experimental Qt Creator package
# from the `cpack_experimental` folder under https://download.qt.io/*_releases/qtcreator/
wget $(./packaging/format-deb-url.py) --directory-prefix=/tmp
sudo apt install /tmp/qtcreator-opensource-linux-*-*.deb

# generate and install the plugin package
cd build
cpack -G DEB
sudo apt install ./ROSProjectManager-*-Linux-*.deb

Development & Debugging

To develop on the plugin and test changes iteratively, build the plugin in Debug mode and skip creating the plugin archive:

cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="~/Downloads/qtc-sdk/Tools/QtCreator;~/Downloads/qtc-sdk/6.6.0/gcc_64"
cmake --build build

This creates a shared plugin library at build/lib/qtcreator/plugins/libROSProjectManager.so.

To test the changes to the plugin, launch Qt Creator and point it to the location of the compiled plugin:

~/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator -pluginpath build/lib/qtcreator/plugins/

To debug the plugin with gdb, prefix the above command with gdb --ex=r --args:

gdb --ex=r --args ~/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator -pluginpath build/lib/qtcreator/plugins/

To further debug the inner workings of Qt Creator, you have to install the Qt Creator "Debug Symbols". If you are using the online installer, those are available via the "Qt Maintenance Tool".