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

Revision history [back]

click to hide/show revision 1
initial version

This is not currently possible in RViz.

However as of ROS Groovy, RViz does support plugins which subclass rviz::ViewController.

For better or worse, the current set of view controllers all shares the property that when you set a "target frame" for the view to track, it actually only tracks the position of that target frame, it does not track the orientation. If it tracked both, you would only have to choose some TF frame as the "target frame" which was oriented the way you want relative to the world frame, and then it would behave as you like.

If you decide to write a plugin, you could either write something larger and more flexible which tracks the position and orientation of the target frame, which would then support arbitrary orientations as the reference frame, or you could write something (likely much easier) which is specific to the XZ plane that is what you really want.

If you go the easy route, it is probably as simple as subclassing OrbitViewController and overriding the "updateCamera()" function which computes the pose of the camera given the yaw, pitch, and focal point position.

Here is where the key math is done in OrbitViewController's version: https://github.com/ros-visualization/rviz/blob/hydro-devel/src/rviz/default_plugin/view_controllers/orbit_view_controller.cpp#L254

Though it is supported, there are not yet tutorials for writing plugins which subclass rviz::ViewController. Tutorials for writing other plugins may have useful information though, as many aspects of the boilerplate are the same - you just need to write a subclass of a different superclass and you need to specify the correct superclass in the plugin_description.xml file. Here: http://ros.org/doc/hydro/api/rviz_plugin_tutorials/html/display_plugin_tutorial.html is the tutorial for writing an rviz::Display plugin.