Moving camera with librviz does not update view

asked 2019-05-15 08:58:19 -0600

jotwe gravatar image


I am on Ubuntu 16.04 with ROS Kinetic and trying to move the camera position in a 3D visualizer widget programmatically using librviz. I basically followed the provided tutorial and came up with

manager_ = new rviz::VisualizationManager( render_panel_ );
render_panel_->initialize( manager_->getSceneManager(), manager_ );
controller_ = manager_->getViewManager()->getCurrent();
controller_->getCamera()->moveRelative(Ogre::Vector3(0, 0.1, 0));

Unfortunately, this does not do anything. Also controller_->getCamera()->setPosition(...) does not have any effect.

I can only see a change when I add a controller_->getCamera()->lookAt(...) to the code. This will result in the desired change of the position plus an in general unwanted change in orientation.

It seems like moveRelative(...) and setPosition(...) do not trigger an update of the view?! Is there a solution to make this work without the lookAt(...) or do I miss something important here?

edit retag flag offensive close merge delete


Maybe, it would be enough to call lookAt(...) with a point that is directly located in front of the camera. Or is there a another option run it without visual impact?

jotwe gravatar imagejotwe ( 2019-05-16 06:42:54 -0600 )edit