ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

unable to run gmapping (couldn't find executable)

asked 2019-10-13 10:03:34 -0500

davidem gravatar image

updated 2019-10-14 11:28:06 -0500

I am running Ubuntu 18.04, ROS Melodic.
ROS root dir: /opt/ros/melodic/share, catkin_ws dir= /home/foo/catkin_ws

I was trying to install gmapping because I'm going through the navigation tutorials and it says that I need to build a map for the upcoming tutorials and to do so, gmapping is required. I then cloned the repo in /opt/ros/melodic/share and run rosdep install gmapping, sourced the environment and run catkin_make.

When I try to run it, as they say, via rosrun gmapping slam_gmapping scan:=base_scan it doesn't work, just outputs

Couldn't find executable named slam_gmapping below /opt/ros/melodic/share/slam_gmapping/gmapping

edit retag flag offensive close merge delete



You have a from-source build of Melodic on Ubuntu 16.04?

Why do you clone repositories into /opt/ros/melodic/share? Even if you are building packages from source, that is not where packages should be cloned to. It's very likely that the package hasn't been built.

Please clarify what sort of setup you really are running. gmapping has been released into both Kinetic and Melodic, so unless you absolutely must build Melodic from source on Xenial, using apt and a supported version of ROS would be very much preferred.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-13 12:21:22 -0500 )edit

Hi, thanks for your comment. I am cloning repos there because i don't want them to be included in my workspace, where i keep the packages i am working on. Or, at least, that's the meaning I give to the word "workspace", something where you work but not where your tools are, such as catkin_ws. i'm then running rosdep install gmapping and that call succeedes, or at least should.

Am i wrong to clone repos there? is there a way to do otherwise without cloning them into the ws, as that seems to be the problem?

davidem gravatar image davidem  ( 2019-10-14 11:05:26 -0500 )edit

Please answer the question whether you are building ROS Melodic from source on Ubuntu Xenial.

And if yes, then why?

gvdhoorn gravatar image gvdhoorn  ( 2019-10-14 11:06:47 -0500 )edit

I am sorry, I misstyped the version of Ubuntu, it's Beaver 18.04, anyway no, I downloaded it via apt but is it meaningful?

davidem gravatar image davidem  ( 2019-10-14 11:29:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-14 11:44:14 -0500

gvdhoorn gravatar image

updated 2019-10-14 11:50:48 -0500

I am sorry, I misstyped the version of Ubuntu, it's Beaver 18.04, anyway no, I downloaded it via apt but is it meaningful?


Seeing as you aren't building ROS Melodic on Ubuntu Xenial and as you are on a supported architecture (as you've already installed ROS using apt) you can just install gmapping using apt:

sudo apt install ros-melodic-slam-gmapping

Is there any specific reason you did not do that?

Building ROS packages from source should not be your primary way of installing them. If possible, always prefer to install ROS packages using apt on Ubuntu.

I've explained how you can determine whether you can use apt (ie: whether binary packages are available) to install a package in #q320046.

In general there are very few circumstances in which building from source is needed or desirable. I would say for normal usage it's almost never needed. Except your own packages of course.

I then cloned the repo in /opt/ros/melodic/share

If you must build packages from source, don't place them in that directory. It will not work.

Clone packages in the source space of your workspace, run rosdep to install all dependencies and then build the workspace (using catkin_make, as you've been doing, or catkin build (from catkin_tools)). After source-ing the devel/setup.bash of your workspace, the package(s) should be available to you.

and run rosdep install gmapping

while this is a valid command, I don't believe it does what you think it does in this case. It does not register the package with ROS, or something similar. rosdep is a tool used to install dependencies of ROS packages.

sourced the environment and run catkin_make.

if you're building your workspace, those two steps should probably be reversed.

Refer to #q252478 for an example workflow that shows the steps in the correct order.

Am i wrong to clone repos there? is there a way to do otherwise without cloning them into the ws, as that seems to be the problem?

Cloning repositories (ie: building packages from sources) does have its uses, but I would strongly suggest to only do it when absolutely needed. As I wrote in #q320046, there are quite a few steps to get right, multiple points at which things can fail, and it's always more time consuming than a simple apt install.

If you still want or need to build packages from sources, but don't want those packages in your 'main workspace', then I'd suggest to take a look at workspace overlaying. You place the packages you don't want in your main workspace in the underlay, build the underlay, source it and then continue working in your main workspace.

Finally: I would remove any packages you've placed in /opt/ros/melodic/share and try to install whatever you need using apt. If it's not available, use an underlay workspace.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-10-13 10:03:34 -0500

Seen: 766 times

Last updated: Oct 14 '19