ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

rviz setViewController doesn't hook up mouse events?

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

lucasw gravatar image

updated 2020-11-21 11:35:27 -0500

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 image kramer  ( 2017-03-05 08:52:22 -0500 )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 image lucasw  ( 2017-03-06 11:12:46 -0500 )edit

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

lucasw gravatar image lucasw  ( 2017-03-06 12:02:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Question Tools

2 followers

Stats

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

Seen: 427 times

Last updated: Mar 06 '17