Skip to content

Custom RViz Configuration

Erick Mejia Uzeda edited this page May 31, 2020 · 1 revision

Written by: Trudie Cheung

This allows us to customize and save an RViz configuration such that it is loaded automatically upon launch (removing the need to manually add desired topics every time).

The method shown is just one way to approach this--besides using the RViz GUI, this can be done through code as well.

Saving the RViz Configuration

Start by launching RViz with the following commands:

$ roslaunch caffeine caffeine_gazebo.launch
$ roslaunch caffeine caffeine_rviz.launch

Within the RViz GUI, make the configuration changes that you would like save. Once you are ready to save, go to the drop-down menu near the top of the window and click on File --> Save Config As. Save the configuration with the desired name with the .rviz extension (e.g. rviz_custom.rviz), and save it within the caffeine package, in the rviz folder.

Modifying the Launch File

If you have saved a configuration file with new name, you must also modify caffeine_rviz.launch to reflect this change. Modify the following line in the launch file, replacing [new_name] with the name of your file:

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find caffeine)/rviz/[new_name].rviz" output="screen"/>

Now you can see if you have done everything correctly by running $ roslaunch caffeine caffeine_rviz.launch!

Further notes:

When using RViz, you may be asked whether or not you want to the save the configuration before exiting/closing. If you would like to keep the changes you have made, clicking save will override the existing rviz configuration saved within the caffeine/rviz folder with the current configuration. If you do not wish to keep the changes, choose close without saving.