0
$\begingroup$

Rosanswers logo

TL;DR I cannot get my custom rviz panel to show up in rviz.

EDIT: Initial problem was a hosed workspace somehow. New problem is missing symbol in the library.

CURRENT PROBLEM (MISSING SYMBOL DEFINITION):

When loading the panel (which exists in rviz) I get the following:

[ERROR] [1552945665.814417674]: PluginlibFactory: The plugin for class 'myrviz/CustomPanel' failed to load.  Error: Failed to load library /home/zlacelle/catkin_ws/devel/lib//libcustompanel.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/user/catkin_ws/devel/lib//libcustompanel.so: undefined symbol: _ZTVN10myrviz11CustomPanelE)

nm confirms this symbol is undefined.

I have the constructor defined, with a QWidget* argument, which is defaulted to '0' in the function definition.

ORIGINAL PROBLEM (SOLVED BY NEW WORKSPACE):

I'm running ROS Kinetic, using catkin to build my packages. I've made a custom rviz plugin to visualize some data, based on examples here:

https://github.com/OctoMap/octomap_rviz_plugins

https://github.com/ccny-ros-pkg/imu_tools/tree/indigo/rviz_imu_plugin

I've created a package.xml that:

  • Has <build_depend> on rviz
  • Has <exec_depend> on rviz
  • Has an <export> section that lists <rviz plugin="${prefix}/plugin_description.xml" />

I have a plugin_description.xml which has all of the normal fields.

I have a CMakeLists.txt which:

  • Has a find_package on rviz
  • Has CATKIN_DEPENDS on rviz
  • Has an install() on plugin_description.xml to the SHARE_DESTINATION

Finally, I have a PLUGINLIB_EXPORT_CLASS(myrviz::CustomPanel,rviz::Panel) at the bottom of my source code declaration.

All of this builds, and I then source my devel/setup.bash. I can see the library libcustompanel.so in devel/lib. I can also see my plugin_description.xml in install/share/custompanel.

However, I cannot see the plugin listed with rospack plugins --attrib=plugin rviz. It lists the following:

moveit_ros_visualization /opt/ros/kinetic/share/moveit_ros_visualization/robot_state_rviz_plugin_description.xml
moveit_ros_visualization /opt/ros/kinetic/share/moveit_ros_visualization/planning_scene_rviz_plugin_description.xml
moveit_ros_visualization /opt/ros/kinetic/share/moveit_ros_visualization/motion_planning_rviz_plugin_description.xml
moveit_ros_visualization /opt/ros/kinetic/share/moveit_ros_visualization/trajectory_rviz_plugin_description.xml
grid_map_rviz_plugin /opt/ros/kinetic/share/grid_map_rviz_plugin/plugin_description.xml
octomap_rviz_plugins /opt/ros/kinetic/share/octomap_rviz_plugins/plugin_description.xml
rviz_imu_plugin /opt/ros/kinetic/share/rviz_imu_plugin/plugin_description.xml
rviz /opt/ros/kinetic/share/rviz/plugin_description.xml

What's my next step to try and debug this issue?


Originally posted by zlacelle on ROS Answers with karma: 30 on 2019-03-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The answer was that I did not have the resulting MOC object files linked into my library, thus resulting in undefined symbols. The "qt5_wrap_cpp()" and "qt4_wrap_cpp()" calls each set a variable to a list of generated object files (in my case, simply called "QT_MOC". I had to add this to my "add_library()" call.

So my CMakeLists.txt looked like this:

...
qt5_wrap_cpp(QT_MOC include/my_panel.h)
...
add_library(${PROJECT_NAME}
 src/my_panel.cpp
 ${QT_MOC}
)
...

Originally posted by zlacelle with karma: 30 on 2019-03-18

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.