This is a collection of packages to work on ROS-based software from Emacs.
Supported are the versions of Emacs >= 24.3. For older versions please use the older-than-emacs24.3 branch.
The repo contains a
rosemacs package, which provides functions for starting a roscore,
monitoring ROS nodes etc (with corresponding Emacs key bindings).
And, in addition to that, it has a number of packages to simplify
development of roslisp-based packages. Among them is
a wrapper for Slime (Lisp interactive development environment) called
a contrib for Slime to work with ROS
and a Slime REPL called
roslisp_repl, configured to start slime, slime_ros and setup roslisp.
Not a Common Lisp programmer
If you don't work with Common Lisp and just use Emacs for C++ or Python or Java or Lisp dialects other than Common Lisp or whatever else, you just need to add the following lines to your Emacs initialization file (init.el or similar):
(add-to-list 'load-path "/opt/ros/DISTRO/share/emacs/site-lisp") (require 'rosemacs-config)
DISTRO is the name of your ROS distribution, e.g.
Common Lisp programmer
Currently, we are using an alternative branch of slime, which has not been merged into master yet. The version we use is distributed with the ROS Debian packages. Unfortunately, that means that our ROS Debian package of slime (
ros-indigo-slime-wrapper) and official Debian of slime (
slime) can collide.
It is strongly recommended to only use the ROS Debian package of
sudo apt-get purge slime if you installed one before.
If you work with roslisp, all you need to do is to start
roslisp_repl in the terminal.
If you want to start the REPL from inside of your Emacs process, add the following to your Emacs init script:
(require 'slime-config "PATH_TO_SLIME_ROS/slime-config.el")
PATH_TO_SLIME_ROS is what
rospack find slime_ros gives you, e.g.
if you're installing from source. After that line you can add the usual Slime
customization commands, like setting the
turning off the
Then you need to run
$ rosrun slime_ros slime_ros_init
which will create
.sbclrc-ros in your home directory
and add an entry into your
.sbclrs to load
Once set up, you can start the REPL from your Emacs by pressing
which means holding the
Alt key and pressing
x and then typing
There is one detail to take into account when compiling ros_emacs_utils from source:
in order for the code to work you not only need to run
catkin_make on the packages,
but also install them (
Why do we need to
catkin_make install? (Skip the next two paragraphs if you don't care.)
All the packages have their Emacs Lisp part contained in a single or multiple
During installation of the packages those files are being copied
YOUR_INSTALL_DIR/share/emacs/site-lisp. Therefore, you need to tell Emacs
in the initialization script to add that directory to the Emacs
in a recursive way. That is done in
In addition to the Emacs Lisp part, all the packages except
have a Common Lisp part, and all the
*.lisp files are being copied
this replicates the Debian approach to installing Emacs Lisp and Common Lisp files.
Therefore, you need to tell your Common Lisp compiler, actually linker, i.e. ASDF,
to search for systems in that directory. That is done in
or, more correctly, in
.sbclrc-ros. As you can see, right now only SBCL is supported.
The original file can be found in your
slime_ros ROS package under the name
When starting the
slime_ros_init is called,
which in its turn copies
sbclrc-ros into the home directory,
and adds a necessary entry into
slime_ros_init executable from
slime_ros package for more info.
- For Common Lisp developers: SBCL as the preferred compiler
- Q: Why doesn't my
roslisp_replstart properly / find
- A: Probably because you didn't install the
catkin_make installthem. Just follow the directions in the error pop up winodw (or echo buffer) of your Emacs.
- Q: It says component "swank" cannot be found.
- A: There might be something wrong in your
.sbclrc-ros. Try calling
rosrun slime_ros slime_ros_initif you haven't done that yet. (When starting REPL through
roslisp_replthe script is called automatically.)
- Q: It still doesn't work!
- A: Please file a bug report on Github.