版本
*/linux:Ubuntu 18.04
*/rosdistro: melodic
*/rosversion: 1.14.13
*/Qt: 5.12.9
这篇笔记主要记录使用Qt加载Rviz的过程,用于实时控制和显示小车状态。实现原理是基于Qt的.pro工程加载Rviz以及ros,而不是通过Qt中的ROS插件。
一.创建QT工程 如下:
二.修改*****.pro文件如下
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
##############################
#ros to qt
INCLUDEPATH += /opt/ros/melodic/include
DEPENDPATH += /opt/ros/melodic/include
LIBS += -L/opt/ros/melodic/lib -lroscpp -lroslib -lrosconsole -lroscpp_serialization -lrostime -lrviz
LIBS += /opt/ros/melodic/lib/libroscpp.so
LIBS += /opt/ros/melodic/lib/libroslib.so
INCLUDEPATH += /usr/include/OGRE
LIBS +=-lboost_system -ljsoncpp -lboost_thread -lboost_filesystem -lboost_regex -lconsole_bridge
##############################
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if