Trying to implementing a Qt Widget with inside an rViz screen. Executing the code in Qt5 it run without problem but rViz generate the error:
The class required for this view controller, 'rviz/Orbit', could not be loaded. Error: Could not find library corresponding to plugin rviz/Orbit. Make sure the plugin description XML file has the correct name of the library and that the library actually exists.
more specifically the error message is as follows: error message
I post below the .pro file project hoping that someone can help me...
QT += core gui network printsupport multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = tifgui
TEMPLATE = app
CONFIG += c++17
INCLUDEPATH += /opt/ros/$$(ROS_DISTRO)/include
INCLUDEPATH += /usr/include/OGRE
INCLUDEPATH += /usr/lib/x86_64-linux-gnu/OGRE-1.9.0
INCLUDEPATH += $(HOME)/catkin_ws/devel/include
INCLUDEPATH += $(HOME)/catkin_ws/src/marta/marta_libraries/include
INCLUDEPATH+=$$absolute_path($$system(ls /opt/ros/$$(ROS_DISTRO)/include | grep opencv),/opt/ros/$$(ROS_DISTRO)/include/)
LIBS += -L/opt/ros/$$(ROS_DISTRO)/lib/ -lroscpp -lroslib -lrostime -lrosconsole -lrospack -lxmlrpcpp -lroscpp_serialization -lrosconsole_log4cxx -lrosconsole_backend_interface -lcpp_common -lconsole_bridge -lboost_thread -lboost_system -lboost_date_time -lyaml-cpp -lmarblewidget-qt5 -lastro
LIBS += -L/opt/ros/$$(ROS_DISTRO)/lib/x86_64-linux-gnu/ -lcv_bridge -lboost_filesystem -limage_transport -lcompressed_depth_image_transport -lcompressed_image_transport -limage_transport_plugins -ltheora_image_transport -limage_transport_plugins -lmessage_filters -lclass_loader -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_videoio -lopencv_imgproc
LIBS += -L/opt/ros/$$(ROS_DISTRO)/lib -lrviz -lresource_retriever -ltf -ltf2 -ltf2_ros -lactionlib
In particular in the .cpp file i use the class rviz::VisualizationFrame:
rviz::VisualizationFrame *rviz_frame_;
rviz_frame_ = new rviz::VisualizationFrame();
rviz_frame_->initialize("opt/ros/melodic/share/rviz/default.rviz");
ui->rviz_layout->addWidget(rviz_frame_, 0, 0, 1, 1);
Running rviz from the terminal
rosrun rviz rviz
Does not present any error. I think therefore that the problem is on the linking of libraries.