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!
I have similar problem. I added a display panel exactly as what you did. I can add the default plugins, but not the plugins that I made. I can see them, but when I add, the program will crash (core dumped). Do you know how to add in my own plugin lib? I guess it does not know where to look for them.
Sorry, @shen612, I just now noticed your comment. You should really ask this as a new question. If your plugin shows up, it's found. However, I have had issues with custom plugins -- the only one I figured out was resolved with a custom message queue (probably won't help you). More following...
I tracked another issue I had down to the nVidia driver. Since it is/was a closed source blob, I gave up at that point and just found a different way to display the data. Sorry I can't be of more help...