ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rviz does not know of custom panel

asked 2019-03-18 15:44:53 -0500

zlacelle gravatar image

updated 2019-03-18 16:52:52 -0500

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_rv...

https://github.com/ccny-ros-pkg/imu_t...

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-18 17:46:28 -0500

zlacelle gravatar image

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}
)
...
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-03-18 15:44:53 -0500

Seen: 574 times

Last updated: Mar 18 '19