[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Using rqt_console and roslaunch.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Using rosed to edit files in ROS

Description: This tutorial shows how to use rosed to make editing easier.

Tutorial Level: BEGINNER

Next Tutorial: Creating a Msg and Srv

Using rosed

rosed is part of the rosbash suite. It allows you to directly edit a file within a package by using the package name rather than having to type the entire path to the package.

Usage:

$ rosed [package_name] [filename]

Example:

$ rosed roscpp Logger.msg

This example demonstrates how you would edit the Logger.msg file within the roscpp package.

If this example doesn't work it's probably because you don't have the vim editor installed. Please refer to Editor section. If you don't know how to get out of vim, click here.

If the filename is not uniquely defined within the package, a menu will prompt you to choose which of the possible files you want to edit.

Using rosed with tab completion

This way you can easily see and optionally edit all files from a package without knowing its exact name.

Usage:

$ rosed [package_name] <tab><tab>

Example:

$ rosed roscpp <tab><tab>

Editor

The default editor for rosed is vim. The more beginner-friendly editor nano is included with the default Ubuntu install. You can use it by editing your ~/.bashrc file to include:

export EDITOR='nano -w'

To set the default editor to emacs you can edit your ~/.bashrc file to include:

export EDITOR='emacs -nw'

NOTE: changes in .bashrc will only take effect for new terminals. Terminals that are already open will not see the new environmental variable.

Open a new terminal and see if EDITOR is defined:

$ echo $EDITOR

Now that you have successfully configured and used rosed, let's create a Msg and Srv.


2017-09-16 12:30