Ask Your Question
1

rviz setViewController doesn't hook up mouse events?

asked 2017-03-03 19:38:37 -0600

lucasw gravatar image

updated 2017-03-06 12:52:59 -0600

I have an librviz application https://github.com/lucasw/visualizati... which works fine with the default view controller, but I would like to use a different controller. It seems like this should be done with setViewController(), it renders the view from a default zero starting point but the mouse doesn't rotate or translate the view.

This is in my constructor:

  ...
  manager_->initialize();
  manager_->startUpdate();

  rviz::ViewController* view = new rviz::OrbitViewController();
  if (view)
  {
    view->initialize(manager_);
    render_panel_->setViewController(view);
  }

Is something missing that will cause the view controller handleMouseEvents() to get called? Some additional comments are here:

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

And a visualization_tutorial issue here https://github.com/ros-visualization/...

edit retag flag offensive close merge delete

Comments

Is this a straight-up rviz or rqt plugin? I ask 'cuz your link is to a librviz question and my experience with rqt is minimal. Can you post more information (and code/links) to better describe your situation?

kramer gravatar imagekramer ( 2017-03-05 08:52:22 -0600 )edit

It is an rqt plugin that uses librviz. Do you have any code that uses setViewController? I can try to duplicate the problem with visualization_tutorials/librviz_tutorial independent of rqt.

lucasw gravatar imagelucasw ( 2017-03-06 11:12:46 -0600 )edit

I've added a link to a setViewController version of librviz_tutorial and rqt is no longer part of the issue.

lucasw gravatar imagelucasw ( 2017-03-06 12:02:57 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-06 19:00:01 -0600

lucasw gravatar image

The solution is to use view manager setCurrentViewControllerType

  manager_ = new rviz::VisualizationManager( render_panel_ );
  render_panel_->initialize( manager_->getSceneManager(), manager_ );
  manager_->initialize();
  manager_->startUpdate();

  QString class_id = "rviz/Orbit";
  manager_->getViewManager()->setCurrentViewControllerType(class_id);

Using setViewController leaves the view manager still holding on to the default view controller which gets updated, but is no longer getting rendered.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-03-03 19:38:37 -0600

Seen: 157 times

Last updated: Mar 06 '17