Error: MultiLibraryClassLoader: Could not create class of type

asked 2023-05-20 23:14:56 -0500

yolic gravatar image

I made a plugin which had been compiled. However, it doesn't work in the rviz. The error message is as followed:

The class required for this panel, 'path_mark_plugin/PathMarkPlugin', could not be loaded. Error: MultiLibraryClassLoader: Could not create class of type autolabor_plugin1::PathMarkPlugin

here is my rosbag file: CMakeLists.txt package.xml plugin_description.xml path_mark_plugin.h path_mark_plugin.cpp

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(path_mark_plugin)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  path_server
  random_numbers
  rviz
  geometry_msgs
  std_msgs
  actionlib_msgs
  tf2
  tf2_ros
)

catkin_package(
  CATKIN_DEPENDS message_runtime
#  LIBRARIES path_mark_plugin
#  CATKIN_DEPENDS roscpp rviz
#  DEPENDS system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

link_directories(${catkin_LIBRARY_DIRS})


set(CMAKE_AUTOMOC ON)

if(rviz_QT_VERSION VERSION_LESS "5")
    message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
    find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
    ## pull in all required include dirs, define QT_LIBRARIES, etc.
    include(${QT_USE_FILE})
else()
    message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
    find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
    ## make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
    set(QT_LIBRARIES Qt5::Widgets)
endif()

add_definitions(-DQT_NO_KEYWORDS)

add_library(path_mark_plugin src/path_mark_plugin.cpp include/path_mark_plugin/path_mark_plugin.h)
add_dependencies(path_mark_plugin ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(path_mark_plugin ${QT_LIBRARIES} ${catkin_LIBRARIES})

package.xml

<package>
  <name>path_mark_plugin</name>
  <version>0.0.0</version>
  <description>The path_mark_plugin package</description>

  <!-- One maintainer tag required, multiple allowed, one person per tag -->
  <!-- Example:  -->
  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
  <maintainer email="colin@todo.todo">colin</maintainer>


  <!-- One license tag required, multiple allowed, one license per tag -->
  <!-- Commonly used license strings: -->
  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
  <license>TODO</license>


  <buildtool_depend>catkin</buildtool_depend>

  <build_depend>qtbase5-dev</build_depend>
  <build_depend>rviz</build_depend>
  <build_depend>path_server</build_depend>
  <build_depend>random_numbers</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>actionlib_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>tf2</build_depend>
  <build_depend>tf2_ros</build_depend>

  <run_depend>libqt5-core</run_depend>
  <run_depend>libqt5-gui</run_depend>
  <run_depend>libqt5-widgets</run_depend>
  <run_depend>rviz</run_depend>
  <run_depend>path_server</run_depend>
  <run_depend>random_numbers</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>message_runtime</run_depend>
  <run_depend>actionlib_msgs</run_depend>
  <run_depend>tf2</run_depend>
  <run_depend>tf2_ros</run_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <rviz plugin="${prefix}/plugin_description.xml"/>
  </export>
</package>

plugin_description.xml

<library path="lib/libpath_rviz_plugin">
    <class name="path_mark_plugin/PathMarkPlugin"
           type="autolabor_plugin1::PathMarkPlugin"
           base_class_type="rviz::Panel">
        <description>
            A panel widget is used to record path.
        </description>
    </class>
</library>

path_mark_plugin.h

#ifndef PROJECT_PATH_MARK_PLUGIN_H
#define PROJECT_PATH_MARK_PLUGIN_H

# include <ros/ros.h>
# include <rviz/panel.h>

#include <QHBoxLayout>
#include <QPushButton>
#include <QString>

#include <random_numbers/random_numbers.h>

#include <ros/package.h>

#include <string>
#include <fstream>

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>

#include <path_server/SetPathName.h>
#include <std_srvs/Empty.h>
#include <nav_msgs/Odometry.h>
#include <nav_msgs/Path.h>
#include <geometry_msgs/PoseStamped.h>

#include <tf/transform_datatypes.h>

#include <std_srvs/Empty.h>
#include <actionlib_msgs/GoalID.h>

#include <geometry_msgs/PoseStamped.h>


#include <cstdio>

#include <ros/console.h>

#include <fstream>
#include <sstream>

#include <QPainter>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QLabel>
#include <QTimer>
#include <QDebug>
#include <QtWidgets/QTableWidget>
#include <QtWidgets/qheaderview.h>

#include <string>



#include <tf2_ros/transform_listener.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>



#include <QPushButton>
#include <QTableWidget>
#include <QCheckBox>

#include <visualization_msgs/Marker.h> ...
(more)
edit retag flag offensive close merge delete