当前位置:网站首页>ROS Qt环境搭建
ROS Qt环境搭建
2022-06-22 07:01:00 【冰激凌啊】
下载Qt
- S1:
sudo apt-get install qtcreator可能安装版本太久,所以官网安装:https://download.qt.io/archive/qt/ - S2:选择版本https://download.qt.io/archive/qt/5.9/5.9.9/: qt-opensource-linux-x64-5.9.9.run
- S3:进入安装目录下,更改执行权限:
chmod a+x qt-opensource-linux-x64-5.9.9.run - S4:双击安装,一直next,安装组件选择
Desktop gcc 64-bit即可,其他按需安装 - S5:然后在安装目录下双击Qtreator就可以运行了,但是为了方便,因此添加到环境变量
sudo nano /usr/bin/qtcreator
添加如下内容:#!/bin/sh export QT_HOME=/home/guyue/Qt5.9.9/Tools/QtCreator/bin $QT_HOME/qtcreator $*ctrl+o写入,ctrl+x退出 - S6:添加执行权限:
sudo chmod a+x /usr/bin/qtcreator - S7:终端运行:
qtcreator
ROS依赖
S1:安装依赖
sudo apt-get install ros-melodic-qt-create sudo apt-get install ros-melodic-qt-build # sudo apt-get install qtmultimedia5-devS2:创建Qt功能包
catkin_create_qt_pkg 功能包名 依赖1 依赖2 # 示例: cd ~/am_ws/src catkin_create_qt_pkg class1_ros_qt_demo roscpp rvizS3.1:此时
catkin_make会报错,进行如下修改:
# 1/ 设置包含当前目录: set(CMAKE_INCLUDE_CURRENT_DIR ON) # 2/ 添加qt库: find_package(Qt5 REQUIRED Core Widgets) set(QT_LIBRARIES Qt5::Widgets) # 3/ 删除: rosbuild_prepare_qt4(QtCore QtGui) # 4/ 更改 # QT4_ADD_RESOURCES(QT_RESOURCES_CPP) ${QT_RESOURCES}) # QT4_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) # QT4_WRAP_CPP(QT_MOC_HPP ${QT_MOC}) # 改为: QT5_ADD_RESOURCES(QT_RESOURCES_CPP) ${QT_RESOURCES}) QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS}) QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})具体在CMakeList.txt中的修改可以参考下图:

S3.2:此时再次编译还会报错,需要更改
~/am_ws/src/class1_ros_qt_demo/include/class1_ros_qt_demo/main_window.hpp文件,将:#include <QtGui/QMainWindow>,改为:#include <QtWidgets/QMainWindow>S4:然后一切正常就可以进行测试了
测试
S1:运行下述指令,出现画面:
rosrun class1_ros_qt_demo class1_ros_qt_demo
S2:运行
roscore,此时点击上述界面的connect,即进行连接
Qt编译ROS工程
S1:配置Qt的ROS环境
使用Qt打开工作空间/src下的CmakeList.txt;
配置build目录为工作空间/build;
然后点击Configure Project
注意打开的是工作空间src下的CmakeList,而不是功能包的
S1.2:如果项目不能正常打开


S1.3:头文件都在
<Headers>里面,点击打开头文件,按F4键可以切换头文件和对应的cpp文件S2:运行配置
点击project,然后选择run,在run configure里设置需要运行的,如果为空,可以点击add按钮添加
S3:然后点击绿色图标运行即可
参考
边栏推荐
- 流程引擎解决复杂的业务问题
- EMC solutions
- 自然语言处理理论和应用
- Five common SQL interview questions
- 【实习】跨域问题
- Xh_CMS渗透测试文档
- [outside distribution detection] your classifier is secret an energy based model and you head treat it like one ICLR '20
- 猿辅导最强暑假计划分享:暑假计划这样做,学习玩耍两不误
- Leetcode--- search insertion location
- SQL injection vulnerability (XII) cookie injection
猜你喜欢
![[fundamentals of machine learning 04] matrix factorization](/img/f5/373bfe68f1a3422e907056c20a0db3.jpg)
[fundamentals of machine learning 04] matrix factorization

Golang appelle sdl2, lit l'audio PCM et signale une erreur lors de l'exécution externe du Code.

Blog add mailbox private message shortcut

Advanced usage of setting breakpoints during keil debugging

Fundamentals of neural network (notes, for personal use)

Single cell literature learning (Part3) -- dstg: deconvoluting spatial transcription data through graph based AI

6. 安装ssh连接工具(用于我们连接实验室的服务器)

JDBC查询结果集,结果集转化成表

On vector norm

How can we effectively alleviate anxiety? See what ape tutor says
随机推荐
Training penetration range 02 | 3-star VH LLL target | vulnhub range node1
2021-05-12
Py's scorecardpy: a detailed introduction to the introduction, installation and use of scorecardpy
JS中对数组进行去重的几种方法
OpenGL - Draw Triangle
Generate string mode
Five common SQL interview questions
Jupyter notebook file storage location
Tpflow v6.0.6 official release
[rust notes] 01 basic types
一个算子在深度学习框架中的旅程
Quelles industries les diplômés recherchent - ils en 2022?
Solutions to newinstance() invalidation
Correspondence between pytorch and torchvision
How to learn 32-bit MCU
June 21, 2022: golang multiple choice question, what does the following golang code output? A:3; B:4; C:100; D: Compilation failed. package main import ( “fmt“ ) func
Great progress in code
The song of cactus - marching into to C live broadcast (2)
低代码开发一个合同应用
C语言——深入理解数组
