\(\def\dt{\Delta t}\)
\(\newcommand{\transpose}[0]{^\mathrm{T}}\)
\(\newcommand{\half}[0]{\tfrac{1}{2}}\)
\(\newcommand{\Half}[0]{\frac{1}{2}}\)
\(\newcommand{\norm}[1]{\left\lVert#1\right\rVert}\)
\(\newcommand\given[1][]{\:#1\vert\:}\)
UP | HOME

Visualization Tools in ROS

Table of Contents

1 Introduction

We have already seen rviz a few times in this course. It is one of the most useful tools in ROS. Visualization is a very important tool for debugging and robot development. Additionally it is often important for user interfaces. Natively, rviz can visualize many important or useful types of data such as

  • transforms
  • paths
  • camera streams
  • point clouds
  • laser scans
  • maps
  • robot models

All of the current rviz display capabilities are described on the rviz Display Types wiki page.

The ROS developers have made it very easy to add capabilities directly to rviz. The following are a few of the features that will be discussed below:

  • You can programmatically insert basic shapes and control their motion. This is useful for animating 2D/3D data.
  • Inserted shapes that can be manipulated by a user within rviz. With this capability you can build user interfaces that work directly in rviz.
  • Write your own plugins or display types for rviz
  • Create custom GUIs that embed an rviz window.

All of these capabilities are documented on the rviz tutorials wiki page.

2 Markers

  • There are many visualization primitives defined in the visualization_msgs package
    • The most basic type is the Marker
  • Markers are a set of basic shapes that are all defined in the visualization_msgs/Marker message
  • If you publish a topic containing a Marker message, then you can set rviz to display those shapes
  • There are several built-in shape primitives defined in the Marker message
    • Arrow
    • Cube
    • Sphere
    • Cylinder
    • Line Strip
    • Line List
    • Cube List
    • Sphere List
    • Points
    • View-Oriented Text
    • Triangle List
    • Arbitrary mesh resources (.dae, .stl, .mesh)
  • These are all described in the Marker wiki page
  • Here is the Marker message definition
  • There are several useful tutorials on Markers:
  • Unfortunately, both of the above tutorials are in C++. But the Python syntax is not very different!

3 MarkerArray

  • Often you want to display many markers at once
  • The marker array is a special message type called visualization_msgs/MarkerArray that is simply a variable-length array of visualization_msgs/Marker messages
  • rviz has special capabilities for displaying all Markers in the array while only subscribing to a single topic
  • See the message definition

4 InteractiveMarkers

  • Interactive markers are a special type of marker that allows a user to control certain properties of the marker within rviz (typically by using their mouse)
    • You can control the position or orientation of the markers
    • The markers can be constrained to only move in certain ways
    • Interactive markers support context menus that users can select from
  • To use interactive markers, within your node, you must create an InteractiveMarkerServer
  • The InteractiveMarkerServer automatically creates publishers and subscribers to communicate between your node and rviz
    • You create a callback for when rviz notifies your node that something has changed
    • There are special functions for you to publish changes to the markers and have them be reflected in rviz
  • There is a special package called interactive_marker_tutorials that contains many demos in both C++ and Python
  • The demos that are contained in this package are thoroughly documented in 3 tutorials
    1. Interactive Markers: Getting Started
    2. Interactive Markers: Writing a Simple Interactive Marker Server
    3. Interactive Markers: Basic Controls

5 rviz Plugins

The underlying library for rviz has been written to facilitate the development of further rviz capabilities. It is very easy to write a variety of your own custom plugins that extend the base functionality of rviz. This is extremely common in more complex robotics projects. The primary methods for extending rviz are contained in three tutorials.

  1. Plugins: New Display Type
    This tutorial describes how to write a custom display for a new type of data in rviz
  2. Plugins: New Dockable Panel
    How to write your own panel that can be docked in an rviz window.
  3. Plugins: New Tool Type
    How to write custom tools for rviz.

As far as I know, this functionality is only available in C++. It likely wouldn't be hard to extend the rviz API to work with Python, but I'm unaware of anyone doing this. Note that adding this capability is more advanced than any of the other display options discussed in this lecture.

6 rqt

rqt is a basically a tool for creating arbitrary ROS GUIs. The GUIs are built using Qt, and the biggest feature of rqt is that each GUI is created as a plugin that can either be run standalone or docked into a standard rqt window. The rqt_common_plugins package contains nearly 20 plugins that can all be used standalone or embedded in the main rqt window. Collections of docked plugins can be saved as a perspective, and you can save and distribute these perspectives for reproducing configurations. The rqt_robot_plugins provides another group of plugins that are very useful for interacting with robots.

Each plugin is essentially a wrapper around a standard Qt widget. This means that if you already had a Qt widget, it would be trivial to convert it into an rqt plugin. Further, this means that it is very easy to generate your own custom plugins. The rqt/Tutorials page contains a set of tutorials for working with rqt.

6.1 Useful rqt Plugins

We've already used quite a few rqt plugins throughout this quarter. Below is a list of particularly useful plugins. Note that some of these plugins have install targets that allow them to be run without rosrun i.e. they are installed into locations that are on your PATH environment variable. These plugins can be run without typing a full rosrun command. For example, I can just type rqt_graph instead of rosrun rqt_graph rqt_graph. To see which you can run without rosrun simply type rqt into a terminal and then hit tab a few times.

rqt_graph
This tools shows you a visual representation of the current ROS system; you can see nodes, topics, debug information, filter, search, and more.
rqt_console
This is a tool for searching and filtering through all logging data from all nodes. You can also modify the logging levels for any node (or you could use the standalone rqt_logger_level). This is a very useful tool for debugging if you are working with a complicated system. It can be finicky to get setup just right, so don't forget to save your settings.
rqt_tf_tree
Used for visualizing your tf tree
rqt_bag
This tool allows you to see what topics are in a bag file, as well as the timing of each message published. There are basic tools for plotting numerical data, viewing camera feeds, bag file playback and recording, and exporting bag data to CSV files.
rqt_launch
This tool allows you to inspect all of the launch files included by a single launch file. You can specify argument values and run individual launch files separately. I haven't used this tool all that often, but it has been quite useful the few times I've needed it.
rqt_image_view
This is a great tool for viewing live camera data. It is similar to image_view, but it is more flexible and has a nicer UI.
rqt_publisher
This tool allows you to publish topics. You can control publish frequency, and even use Python expressions to fill out numerical fields.
rqt_plot
A great debugging tool, this allows you to plot numerical data. Note you can specify the topics to show at the command line. This is a nice tool, that I use all of the time, but my more complex plotting tasks have been completely replaced by PlotJuggler. It is more configurable, faster, and allows you to save and load complex configurations.

7 Resources

visualization_tutorials src
This page is the GitHub package that contains all of the source code for the visualization_tutorials metapackage. Which includes the interactive_marker_tutorials, the rviz_plugin_tutorials, and visualization_marker_tutorials
rviz/Tutorials
This page contains a list of all of the tutorials related to visualization and rviz
rviz/DisplayTypes/Marker
This page shows all of the shape primitives that can be represented by a visualization_msgs/Marker. I refer to this page every time I try to use a marker.
Marker Definition
This page contains the raw definition for the visualization_msgs/Marker message type. The comments in this file contain useful descriptions of most of the fields.
Getting Started with Interactive Markers
This tutorial explains most of the basics of interactive markers. It is very useful.
basic_controls Tutorial
This tutorial has a demo of a large variety of interactive marker applications.
rqt Tutorials
This page contains the listings of the main rqt tutorials.
Creative Commons License
ME 495: Embedded Systems in Robotics by Jarvis Schultz is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.