ROS QT界面开发步骤

你需要ROS人机交互软件吗?

GitHub - chengyangkj/Ros_Qt5_Gui_App: ROS human computer interface based on Qt5(基于Qt5的ROS人机交互界面)

https://blog.csdn.net/qq_38441692/category_9863968.html

bilibili html5 player

安装ros对qt pkg的支持

sudo apt-get install ros-melodic-qt-create
sudo apt-get install ros-melodic-qt-build
sudo apt-get install qtmultimedia5-dev

qt下载地址

How to Install (Users) — ROS Qt Creator Plug-in documentation

创建工程包

mkdir catkin_test

cd catkin_test

mkdir src

cd src

创建qt相关的pkg包:catkin_create_qt_pkg testgui roscpp rospy std_msgs

catkin_make 进行编译

编译出现问题

1 需要修改CMakeList.txt文件

 

2 修改main_window.hpp文件

 

##############################################################################
# CMake
##############################################################################cmake_minimum_required(VERSION 2.8.0)
project(testgui)set(CMAKE_INCLUDE_CURRENT_DIR ON)
##############################################################################
# Catkin
############################################################################### qt_build provides the qt cmake glue, roscpp the comms for a default talker
find_package(catkin REQUIRED COMPONENTS qt_build roscpp)
include_directories(${catkin_INCLUDE_DIRS})find_package(Qt5 REQUIRED Core Widgets)
set(QT_LIBRARIES Qt5::Widgets)
# Use this to define what the package will export (e.g. libs, headers).
# Since the default here is to produce only a binary, we don't worry about
# exporting anything. 
catkin_package()##############################################################################
# Qt Environment
############################################################################### this comes from qt_build's qt-ros.cmake which is automatically 
# included via the dependency call in package.xml
rosbuild_prepare_qt4(QtCore QtGui) # Add the appropriate components to the component list here##############################################################################
# Sections
##############################################################################file(GLOB QT_FORMS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/*.ui)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/*.qrc)
file(GLOB_RECURSE QT_MOC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/testgui/*.hpp)QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})##############################################################################
# Sources
##############################################################################file(GLOB_RECURSE QT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS src/*.cpp)##############################################################################
# Binaries
##############################################################################add_executable(testgui ${QT_SOURCES} ${QT_RESOURCES_CPP} ${QT_FORMS_HPP} ${QT_MOC_HPP})
target_link_libraries(testgui ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS testgui RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

qt creator 打开ROS项目

编译运行设置


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部