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

Getting the OrbitViewController in librviz

asked 2019-03-08 11:20:57 -0500

Julien Audet gravatar image

Hello, ROS community.

I have been using librviz with Qt on ROS kinetic in order to create an interactive visualization of points cloud, paths, etc for an application. My problem is as follows. I am trying to change the camera distance of rviz current viewController using the librviz documentation [1] with C++. I have set the view controller to rviz::OrbitViewController [2], so using its function zoom(float amount) would be rather straightforward. The problem is that the getCurrent() function of the view manager only returns a rviz::ViewController, which means that the child functions of rviz::OrbitViewController cannot be accessed.

For example, this is what I want to do :

  // Set as the Orbit view controller
  QString class_id = "rviz/Orbit";
  manager_->getViewManager()->setCurrentViewControllerType(class_id);
  ...
  // When the zoom button is clicked
  manager_->getViewManager()->getCurrent()->zoom(1.0); // doesn't work

But the function zoom doesn't exist in the parent rviz::ViewController, only in the child rviz::OrbitViewController. My question is quite similar to https://answers.ros.org/question/2955... . There were no answers unfortunately. Thank you for your time.

Julien Audet

[1] http://docs.ros.org/kinetic/api/rviz/...

[2] http://docs.ros.org/kinetic/api/rviz/...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-27 09:30:44 -0500

Julien Audet gravatar image

Instead of getting the OrbitViewController class directly, it is possible to simply change the current view controller properties using the function subProp->setValue. For example, you can change the distance with :

     manager_->getViewManager()->getCurrent()->subProp("Distance")->setValue("20");

Hope this helps somebody else.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-03-08 11:20:57 -0500

Seen: 425 times

Last updated: Mar 08 '19