Ask Your Question
1

Using rqt_rviz with custom .rviz config

asked 2013-11-05 10:27:53 -0500

abencz gravatar image

updated 2013-11-14 10:12:28 -0500

tfoote gravatar image

We’re planning to use rqt_rviz as part of a laymen-facing robot GUI. The current plan is to create a .rviz configuration for RViz that limits what ROS stuff the user sees and then use rqt_rviz with additional rqt plugins to provide an integrated UI. Ideally the RViz menu bar would not be visible to the user either.

Is it possible to load the rqt_rviz plugin with an RViz config file? Also, is there an easy way to remove the menu bar from the rqt_rviz plugin?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2013-11-11 10:35:59 -0500

abencz gravatar image

updated 2013-11-11 10:38:29 -0500

Answered my own question by looking at the code :P

No it's not possible at the moment to do this from a script/launch file, rqt_rviz initializes the RViz frame with no configuration file argument at all. However, if you're willing to modify the rqt_rviz C++ code, it's a trivial matter of adding a filename (or better yet a ros parameter) as an argument to _widget->initialize() in RViz::initPlugin. Likewise the menu bar can be removed by deleting the call to _widget->setMenuBar().

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

  // 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);

  widget_ = new rviz::VisualizationFrame();

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

  widget_->initialize("my_config.rviz");

  ...
edit flag offensive delete link more

Comments

can we get this added into the main branch for rqt_rviz? this is an extremely useful enhancement

flynneva gravatar imageflynneva ( 2019-08-19 16:10:54 -0500 )edit

You're posting a comment on an answered question that is over 6 years old. That is not a good way to draw attention to this.

If this isn't already supported in rqt_rviz, then the quickest way to get it in is to submit a Pull Request.

gvdhoorn gravatar imagegvdhoorn ( 2019-08-20 01:56:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-11-05 10:27:53 -0500

Seen: 949 times

Last updated: Aug 19