Welcome to the ROS Qt Creator Plug-in wiki¶
Installation¶
How to Install (Users)¶
This wiki explains the procedure for installing the ROS Qt Creator Plug-in.
Note
If you primarily want to use this tool for development of other ROS packages (ie: not to work on the plugin itself), please follow the following instructions.
Installation¶
Important
The install method has changed from using the ppa method to a custom installer. This is to enable the ability to provide richer support leveraging existing ros tools which was not possible using the ppa.
Installation Procedure for Ubuntu 16.04¶
Install Prerequsites:
sudo apt install libqtermwidget5-0
Next proceed to Qt Installer Procedure
Important
If previously installed using the ppa please follow the procedure below to remove old version.
sudo apt install ppa-purge
sudo ppa-purge -o beineri
sudo ppa-purge levi-armstrong/qt-libraries-xenial
sudo ppa-purge levi-armstrong/ppa
Warning
The ppa-purge removes everything installed from the ppa, so if the ppa is used for other development do not purge.
Installation Procedure for Ubuntu 14.04¶
Install Prerequsites:
sudo add-apt-repository ppa:levi-armstrong/qt-libraries-trusty sudo add-apt-repository ppa:levi-armstrong/ppa sudo apt install libqtermwidget59-0
Next proceed to Qt Installer Procedure
Important
If previously installed using the ppa please follow the procedure below to remove old version.
sudo apt install ppa-purge
sudo ppa-purge -o beineri
Warning
The ppa-purge removes everything installed from the ppa, so if the ppa is used for other development do not purge.
Archived Versions¶
If for some reason you need a version other than the latest, all installers may be found here.
Qt Installer Procedure¶
Download Installer
- Online Installer (Recommended)
- Offline Installer
Note
The Offline Installer is to be used on machines that do not have internet access.
Then right click on the installer file, select properties and enable execution under permissions.
Next double click the installer and it should open and step throught the installer.
How to get future updates, open Qt Creator and on the menubar under Help select “Check for Updates”.
Installation Issues and Conflicts¶
- No known issues
Testing Plugin.¶
Start Qt Creator
Option 1: Launch using the desktop icon.
Option 2: Launch from terminal.
qtcreator-ros
To verify that the plugin exist, goto File>New File or Project>Projects>Other Project>ROS Workspace. If the ROS Workspace is present then everything built correctly and is ready for development and testing.
How to Install (Developers)¶
Note
If you’d like to contribute to the development of the ROS Qt Creator Plug-in, you are considered a developer, please follow the following instructions.
Installation¶
Installation Procedure for Ubuntu 14.04¶
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo add-apt-repository ppa:levi-armstrong/qt-libraries-trusty
sudo add-apt-repository ppa:levi-armstrong/ppa
sudo apt-get update && sudo apt-get install qt57creator-plugin-ros libqtermwidget57-0-dev
Installation Procedure for Ubuntu 16.04¶
sudo add-apt-repository ppa:levi-armstrong/qt-libraries-xenial
sudo add-apt-repository ppa:levi-armstrong/ppa
sudo apt-get update && sudo apt-get install qt57creator-plugin-ros libqtermwidget57-0-dev
Configure system to use the new version of Qt¶
After installation you need to tell qtchooser where to find this install. Replace the two lines in the file below with the location to the local version shown below. Make sure to change username and version in the file path to match your system.
File:
sudo gedit /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
File content:
/opt/qt57/bin
/opt/qt57/lib
Run ROS Qt Creator setup script¶
Clone your fork of the repository.
git clone -b master https://github.com/<username>/ros_qtc_plugins.git
Next in a terminal, navigate into the repository directory and execute the command below.
bash setup.sh -d
Note
Instruction 2 can can be repeated to get the latest updates for Qt Creator source. The developer must manually update there fork to get the latest version of ros_qtc_plugins.
Testing Plugin¶
Execute the command below or launch using the desktop launcher.
qtcreator
To verify that the plugin exist, goto File>New File or Project>Projects>Other Project>ROS Workspace. If the ROS Workspace is present then everything built correctly and is ready for development and testing.
Debug issues with Plugin¶
Next in a terminal, navigate to the repository ros_qtc_plugin and execute the command below.
bash setup.sh -di
Now launch qtcreator using gdb as shown below and after the plugin segfaults post the trace back in the active/new issue.
gdb <local>/qt-creator-build/bin/qtcreator (gdb) run
After error:
(gdb) bt
FAQ¶
Frequently Asked Questions¶
This wiki highlights the frequently asked questions on the issue tracker.
- How to show empty folders?
- Are new files automaticly added to the CMakeLists.txt file?
- Warning: This file is not part of any project.?
How to show empty folders?¶
By default Qt Creator hides empty folders. In the above image you can see that the workspace src folder is not shown. Under the project filters uncheck Hide Empty Directories.
Are new files automaticly added to the CMakeLists.txt file?¶
Currently it is the developers responsibility to edit the CMakeLists.txt file.
Warning: This file is not part of any project.?¶
This can be for several reason.
- The workspace has not been built from within Qt Creator. Specific flags are passed to cmake which create specific project files which the IDE can parse to build a code model.
- The file or files have not been added to the CMakeLists.txt file followed by a build from within Qt Creator.
- Sometime is persist event if you address the previous items, but if code following is working then it should be ignored.
Users Help¶
Setup Qt Creator for ROS¶
Setup Ubuntu to allow debugging/ptrace¶
- Open file:
sudo gedit /etc/rc.local
- Add this line before the exit 0 line:
echo 0 | tee /proc/sys/kernel/yama/ptrace_scope
- Reboot computer
Set Theme¶
If version 3.3.1 or higher was installed you are able to set the theme to dark following the steps bellow.
- Open Qt Creator
- Goto: Tools > Options > Environment > General
- There should be a setting for Theme in the “User Interface” group containing a drop down box with two options “default or dark”.
Set Syntax Color Schemes¶
- Open Qt Creator
- Goto: Tools > Options > Text Editor > Font & Colors
- There is a drop down box in the “Color Scheme” group where you select different syntax color schemes.
- Addition schemes can be added as explained in the below links.
Set ROS Code Format¶
- Open Qt Creator
- On the sidebar: Projects > Editor
- Changing it globally at Tools > Options > C++ or within Projects > Code Style does not work.
Setup Clang Formatting¶
Install Clang sudo apt-get install clang-format-3.6
Goto: Tools > Options > Environment > External Tools
Select: Add > Add Tool
Fill in the information below.
Description: Clang Cpp Format
Executable: /usr/bin/clang-format-3.6
Arguments:
-style="{Language: Cpp, AccessModifierOffset: -2, AlignAfterOpenBracket: true, AlignEscapedNewlinesLeft: false, AlignOperands: true, AlignTrailingComments: true, AllowAllParametersOfDeclarationOnNextLine: true, AllowShortBlocksOnASingleLine: false, AllowShortCaseLabelsOnASingleLine: false, AllowShortIfStatementsOnASingleLine: false, AllowShortLoopsOnASingleLine: false, AllowShortFunctionsOnASingleLine: All, AlwaysBreakAfterDefinitionReturnType: false, AlwaysBreakTemplateDeclarations: false, AlwaysBreakBeforeMultilineStrings: false, BreakBeforeBinaryOperators: None, BreakBeforeTernaryOperators: true, BreakConstructorInitializersBeforeComma: false, BinPackParameters: true, BinPackArguments: true, ColumnLimit: 80, ConstructorInitializerAllOnOneLineOrOnePerLine: false, ConstructorInitializerIndentWidth: 4, DerivePointerAlignment: false, ExperimentalAutoDetectBinPacking: false, IndentCaseLabels: false, IndentWrappedFunctionNames: false, IndentFunctionDeclarationAfterType: false, MaxEmptyLinesToKeep: 1, KeepEmptyLinesAtTheStartOfBlocks: true, NamespaceIndentation: None, ObjCBlockIndentWidth: 2, ObjCSpaceAfterProperty: false, ObjCSpaceBeforeProtocolList: true, PenaltyBreakBeforeFirstCallParameter: 19, PenaltyBreakComment: 300, PenaltyBreakString: 1000, PenaltyBreakFirstLessLess: 120, PenaltyExcessCharacter: 1000000, PenaltyReturnTypeOnItsOwnLine: 60, PointerAlignment: Left , SpacesBeforeTrailingComments: 1, Cpp11BracedListStyle: true, Standard: Cpp11, IndentWidth: 2, TabWidth: 8, UseTab: Never, BreakBeforeBraces: Allman, SpacesInParentheses: false, SpacesInSquareBrackets: false, SpacesInAngles: false, SpaceInEmptyParentheses: false, SpacesInCStyleCastParentheses: false, SpaceAfterCStyleCast: false, SpacesInContainerLiterals: true, SpaceBeforeAssignmentOperators: true, ContinuationIndentWidth: 4, CommentPragmas: '^ IWYU pragma:', ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ], SpaceBeforeParens: ControlStatements, DisableFormat: false}" -i %{CurrentDocument:FilePath}
Working directory: %{CurrentProject:Path}
Output: Show in Pane
Error output: Show in Pane
Environment: No Changes to apply.
Modifies current document: Checked
Select Apply
Now lets add a quick key.
Goto: Tools > Options > Environment > Keyboard
In the filter box type “Clang” and you should pull up the new tool.
In the Shortcut section enter the Target text box and press Ctrl + Shift + k to set the shortcut.
Now to apply the Clang format to a C++ file open the file in Qt Creator and press Ctrl + Shift + k and the file should be formatted correctly.
Preventing Qt Creator form stepping into Boost, Eigen, etc.¶
First clone this repository https://github.com/Levi-Armstrong/gdb-7.7.1.git
Follow the instruction in the README file
- ./configure
- make
- sudo checkinstall
Goto: Tools > Options > Debugger > GDB
Add the following code below to the “Additional Startup Commands”
skip pending on python for root, dirs, files in os.walk("/usr/include/boost/"): for file in files: if file.endswith(".hpp"): cmd = "skip file " + os.path.join(root, file) gdb.execute(cmd, True) for root, dirs, files in os.walk("/usr/include/eigen3/Eigen/"): for file in files: if file.endswith(".hpp"): cmd = "skip file " + os.path.join(root, file) gdb.execute(cmd, True) end skip enable
Now when you are stepping through your code it should not step into Boost or Eigen. You can also add additional directories following the same process.
Also if you would like to skip a particular function refer to the GDB documentation for instruction. It is something along the lines of skip function function_name.
How to Import a ROS Workspace¶
This wiki explains the procedure for importing a ROS Workspace.
Note
The pictures may not look identical based on version but the process flow is the same.
User Guide¶
Step 1¶
On the Welcome screen select New Project and the following screen should show.
Step 2¶
Under Projects select Other Projects > ROS Workspace then select Choose... and the following screen should show.
Step 3¶
Fill out the project information.
Field | Description |
---|---|
Name | Name of the project. |
Distribution | The ROS Distribution (indigo, kinetic, etc.) |
Build System | The desired build system. |
Workspace Path | The path to the workspace folder. |
Step 4¶
Select Next and the following screen should show and select Finish .
Step 5¶
The project should be open look similar to the screen below.
Step 6 (Optional)¶
By default Qt Creator hides empty folders. In the above image you can see that the workspace src folder is not shown. Under the project filters uncheck Hide Empty Directories.
Debugging Catkin Workspace¶
Prerequisite¶
- Allow ptrace by following these instructions
Attach to a unstarted process¶
- Next in Qt Creator browse to the file you wish to debug and insert break points.
- Menu Bar > Debug > Start Debugging > Attach to Unstarted Application...
- Browse to the executable then select Start Watching.
- Now run your project. Ctrl + R
- Now depending on where the breakpoints were placed in qt, it should be stopped at a break point when it reaches one.
Attach to a running process¶
- Next in Qt Creator browse to the file you wish to debug and insert break points.
- Now run your project. Ctrl + R
- Menu Bar > Debug > Start Debugging > Attach to Running Application...
- Now select the Process ID and then click the button Attach to Process.
- Now depending on where the breakpoints were placed in qt, it should be stopped at a break point when it reaches one.
Note
- Sometime it will be paused at a ros::spin, so check after it has attached and if it is passed and not at a inserted breakpoint click the continue button in the debugger.
- Some nodes can execute fast enough to where the debugger is not fully attach to the process before it reaches the first breakpoint, resulting in it never stopping at the breakpoint. To solve this add a sleep(NumberOfSeconds) command at the start of the node to allow enough time for the debugger to attach. Usually 3 seconds is enough but varies depending on the size of the node.
Developers Help¶
Where to find Qt Creator Plug-in Support¶
There are three reliable ways to get into contact:
- There is the bug tracker on bugreports.qt.io. People here are very aware of everything entered there, but may not react immediately. But this is the best place for feature requests, bug reports and similar things that should not be forgotten.
- Our mailing list is actively read by all developers. That is available here which should get most questions answered.
- The fastest option is IRC: #qt-creator on the freenode network. All developers hang out there, at least while they are in the office. So European business hours tend to work best.
Note
This link provides a good overview of names to ping for specific questions.
Video Tutorials¶
How to configure the run and build settings.
Note
Videos may not always be up-to-date so if you are not sure about something please refer to the User Help section.