Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Oculus rift plugin with librviz (segfaults)

Is there a trick to getting the oculus rift plugin to play nicely with librviz?

In a custom Qt application that uses librviz, loading the Oculus Display (as provided via the 'oculus_rviz_plugin' package) segfaults, I think when it attempts to create/start the OVR::DeviceManager thread. It works without a hitch in regular RViz.

I'm running hydro on Ubuntu 12.04 (linux-generic-lts-raring, 3.8.0 kernel), with oculus SDK 0.3.2; tested on multiple x86_64 computers, graphics cards including GeForce GT 545, GeForce GT 610, and GeForce GT 650M.

Probably the easiest way to test is to slightly modify the librviz tutorial (which works for hydro, although it's marked as groovy). I just added a DisplaysPanel to manually add the Oculus Display after application startup. The CMakeLists.txt and main.cpp don't need to be changed, just the myviz.h and myviz.cpp.

Add two lines to the myviz.h file, a forward class declaration and a private object:

namespace rviz {
class DisplaysPanel; // add this line for forward class declaration
...
private:
  rviz::DisplaysPanel* displays_panel_; // add this line for the panel

Then modify the myviz.cpp; first, add the includes:

#include <QHBoxLayout>
#include "rviz/displays_panel.h"
Next, modify the application layout set up in the constructor by adding a displays panel to the left of the render panel:
  render_panel_ = new rviz::RenderPanel();
  // replace the following lines:
  //QVBoxLayout* main_layout = new QVBoxLayout;
  //main_layout->addLayout( controls_layout );
  //main_layout->addWidget( render_panel_ );

  // with these:
  displays_panel_ = new rviz::DisplaysPanel();
  QHBoxLayout* panels_layout = new QHBoxLayout;
  panels_layout->addWidget(displays_panel_);
  panels_layout->addWidget(render_panel_);
  QVBoxLayout* main_layout = new QVBoxLayout;
  main_layout->addLayout( controls_layout );
  main_layout->addLayout( panels_layout );

Finally, a bit further down in the constructor, add the new panel initialization:

  render_panel_->initialize( manager_->getSceneManager(), manager_ );
  displays_panel_->initialize( manager_ );   // add this line
  manager_->initialize();
As I said, the oculus plugin works without a hitch in regular RViz, but it's not clear to me what needs to happen to use it with librviz. Naturally, I'll provide any additional information that may be needed...thanks for any help offered!