ROS学习笔记(八)ubuntu20.04 安装ros_qtc_plugin

前言 由于ros2 的不断成熟,多机器人协调也成为可能,因此,将原有的ubuntu18.04 升级到ubuntu20.04,升级导致原有的ros-qt离线插件无法使用,只能另谋出路,尝试使用vscode,vscode对ros很好的支持,但是配置相对比较复杂,代码不全功能不是很智能,另外,界面太过偏平化,习惯了qt的我一时无法适应vscode编写c++,所以还是回到qt插件问题上。

1. 安装依赖

sudo apt update
sudo apt install libgl1-mesa-dev ninja-build libyaml-cpp-dev libqtermwidget5-0-dev libutf8proc-dev
sudo apt install python3-pip
pip install pyyaml requests py7zr
git clone https://github.com/ros-industrial/ros_qtc_plugin.git

2. 编译插件

在安装包指定qt和qt相关路径即可进行编译 我的qtcreator是使用apt install qtcreator 安装的默认目录,导致无法找到对应的文件,所以我使用了setup.py脚本下载需要qtcreator版本进行编译,然后使用该版本导入插件即可

python3 setup.py
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/tmp/qtc_sdk/Tools/QtCreator;/tmp/qtc_sdk/5.15.0/gcc_64"
cmake --build build --target package

编译完成的包 ROSProjectManager-0.4.1-Linux-x86_64.zip 插件编译完所在的路径:

ros_qtc_plugin-0.4.3/build/_CPack_Packages/Linux/ZIP/ROSProjectManager-0.4.1-Linux-x86_64.zip

3. 安装插件

打开qtcreator,安装qt插件

help->aboutplugins->installplugs 选择 ROSProjectManager-0.4.1-Linux-x86_64.zip重启软件即可 如图所示: ROSProjectManager已经加载到插件列表:

安装完成后,打开qtcreator 新建,如下图所示 ros环境配置 在qtcreator中配置进行配置ros的基本环境 qtcreator-> tools->opttions->ros

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.

在qtcreator->project中选择选择编译工具

enjoy

参考:

经验分享 程序员 微信小程序 职场和发展