Robotics StackExchange | Archived questions

Failed initializing plugin rqt_rviz

Hello.

I am using ros2 in the following environment.

PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"

ROS_DISTRO=humble

I'm trying to use rqt plugin called rqt_rviz in the ROS2 environment.

I got the source code from github below but it was the ROS1 code.

https://github.com/ros-visualization/rqt_rviz

So I tried to migrate this to ROS2.

The rqt_rviz plugin appears in the rqt plugin list.

So I clicked and ran rqt_rviz, but rqt ended and error message is displayed.

[rviz_common:debug] Load pixmap at package://rviz_common/images/splash_overlay.png, at /home/voc/ros2_humble/src/ros2/rviz/rviz_common/src/rviz_common/load_resource.cpp:71
[rviz_rendering:debug] Available Renderers(1): OpenGL Rendering Subsystem, at /home/voc/ros2_humble/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:301
[rviz_rendering:info] Stereo is NOT SUPPORTED, at /home/voc/ros2_humble/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:543
[rviz_rendering:info] OpenGl version: 4.6 (GLSL 4.6), at /home/voc/ros2_humble/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:284
[rviz_common:debug] Load pixmap at package://rviz_common/icons/plus.png, at /home/voc/ros2_humble/src/ros2/rviz/rviz_common/src/rviz_common/load_resource.cpp:71
[rviz_common:debug] Load pixmap at package://rviz_common/icons/minus.png, at /home/voc/ros2_humble/src/ros2/rviz/rviz_common/src/rviz_common/load_resource.cpp:71
libGL error: failed to create drawable
libGL error: failed to create drawable
[rviz_rendering:info] Stereo is NOT SUPPORTED, at /home/voc/ros2_humble/src/ros2/rviz/rviz_rendering/src/rviz_rendering/render_system.cpp:543
Segmentation fault (core dumped)

I think it was caused by the wrong modification of the source code. (VisualizationFrame, initialize)

Please check if there is anything wrong.

If there is another way to use rqt_rviz plugin on ROS2, I would really appreciate it if you could share it.

[rviz.cpp]

#include <OgreLogManager.h>

#include <QCloseEvent>
#include <QFileDialog>

#include <pluginlib/class_list_macros.hpp>
#include <boost/program_options.hpp>
#include <fstream>

#include <include/rqt_rviz/config_dialog.h>
#include <include/rqt_rviz/rviz.h>

...

void RViz::initPlugin(qt_gui_cpp::PluginContext& context)
{
  context_ = &context;

  parseArguments();

  // prevent output of Ogre stuff to console
  Ogre::LogManager* log_manager = Ogre::LogManager::getSingletonPtr();
  if (!log_manager)
  {
    log_manager = new Ogre::LogManager();
  }
  QString filename = QString("rqt_rviz_ogre") + (context.serialNumber() > 1 ? QString::number(context.serialNumber()) : QString("")) + QString(".log");
  log_ = log_manager->createLog(filename.toStdString().c_str(), false, false, !ogre_log_);

  qt_widget_ = new QWidget();
  rviz_iptr_ = rviz_common::ros_integration::RosNodeAbstractionIface::WeakPtr();

  widget_ = new rviz_common::VisualizationFrame(rviz_iptr_, qt_widget_);

  // create own menu bar to disable native menu bars on Unity and Mac
  menu_bar_ = new QMenuBar();
  menu_bar_->setNativeMenuBar(false);
  menu_bar_->setVisible(!hide_menu_);
  widget_->setMenuBar(menu_bar_);

  widget_->initialize(rviz_iptr_, QString::fromStdString(display_config_));

...

}    
}
}
PLUGINLIB_EXPORT_CLASS(rqt_rviz::RViz, rqt_gui_cpp::Plugin)

Thanks.

Asked by voc-sy on 2023-06-08 01:10:04 UTC

Comments

Answers

[Edit]

I modified the source file.

The issue where rqt was terminated has been resolved, but a warning message appears as below.

Should I modify the settings file? (ex: CMakelist.txt, plugin.xml, ...)

Or should I modify the source file?

[warning msg]

RosPluginlibPluginProvider::load_explicit_type(rqt_rviz/RViz) failed initializing plugin (context is already initialized)
PluginManager._load_plugin() could not load plugin "rqt_rviz/RViz": RosPluginlibPluginProvider.load() could not load plugin "rqt_rviz/RViz"

Asked by voc-sy on 2023-06-08 05:31:42 UTC

Comments