CR 4: Programmatic control over RViz

Customers

  • ROS developers using rviz to build applications and application prototypes

Current state

Currently, the user interface of RViz is aimed at expert users and designed to be customizable and feature-rich. It is mostly used by the software developers themselves.

The user can add and remove displays, change their parameters, has full control over the camera and the window layout.

RViz can save its state into a config file, which includes the displays, their parameters and the camera settings.

Plugins allow the development of custom visualizations. Markers and Interactive Markers allow developers to display things inside the 3D view of RViz and let the user interact with them.

It is not currently possible to change an rviz viewpoint except by one of these methods:

  • Using the GUI with the mouse.
  • Publishing a TF frame to be used as a viewpoint controller, then setting that frame as the "target" frame in rviz, then moving the frame around with TF messages. This solution behaves poorly when a user actually does use the GUI with the mouse.
  • Writing an rviz plugin.

Problem Description

If you want to develop a custom GUI for your application, you have to either start from scratch or provide a custom config file for RViz. An example for the second option are the Interative Manipulation tool. However, the custom config does not include the window layout, and it only determines the initial state or RViz. The user can still customize everything, adding a degree of complexity that is not desired for applications targetet at non-expert users. There is no way of aiding the user by automatically changing the camera position etc.

Developers writing an interactive graphical system using rviz with Interactive Markers would like to assist their users by writing code which automatically positions the viewpoint to focus on task objects. The only way currently is to write a plugin, which has its own problems.

Other developers have also asked how they can programmatically add and remove displays in rviz. That is a similar problem which could be solved in similar ways.

Technical solution

A simple solution to this is to add a feature to rviz where it listens for messages which control the viewpoint. Perhaps though, if writing plugins were simpler, that method would be more attractive. There is a python scripting capability in rviz which I don't know much about. Perhaps a python script could solve the problem without changing the rviz source.

Another direction to look into is inspired by the RVE code which Josh Faust worked on before he left. The idea was to separate the display and rendering code into a library. The GUI program that is rviz would then be a user of that library, but other applications could be written with the library as well, using whatever UI elements and interaction behaviors the developers needed.

Separating RViz into a set of libraries would make it easier for developers to create their own full-fledged GUI based on the functionality found in RViz. It would be the last step in the hierarchy of ways to customize RViz, ordered by increasing complexity and control over the user experience:

  • RViz config files
  • Markers & Interactive Markers

  • Plugins
  • Custom RViz "clone" based on the RViz libs

Wiki: fuerte/Planning/rviz/CR4 (last edited 2011-09-29 11:33:29 by DavidGossow)