ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Building mavros failed (Having tried three ways)

asked 2018-03-16 12:36:09 -0600

updated 2018-03-17 04:02:14 -0600

I have tried to build the recent mavros package from its source. I have tried three different ways; they all failed. My OS is Ubutnu 16.04.03 LTS (xenial).

Can anyone let me know the right way to compile the package?

First try

$ git clone https://github.com/mavlink/mavros.git mavros_recent

$ catkin_make -DCATKIN_WHITELIST_PACKAGES="mavros_recent"

The compilation does not work, with the following message produced:

Multiple packages found with the same name "libmavconn":
- mavros/libmavconn
- mavros_recent/libmavconn
Multiple packages found with the same name "mavros":
- mavros/mavros
- mavros_recent/mavros

Second try

Then, I tried a more direct way.

$ cd src/mavros_recent/mavros/
$ mkdir build; cd build; cmake ..

I got an error from CMake

-- Could not find the required component 'geographic_msgs'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "geographic_msgs"
  with any of the following names:

    geographic_msgsConfig.cmake
    geographic_msgs-config.cmake

  Add the installation prefix of "geographic_msgs" to CMAKE_PREFIX_PATH or
  set "geographic_msgs_DIR" to a directory containing one of the above files.
  If "geographic_msgs" provides a separate development package or SDK, be
  sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:7 (find_package)


-- Configuring incomplete, errors occurred!

Third try

According to a ROS official page

You can use rosdep and catkin to build any package in the ROS repository. Say that you want to build a package called AMAZING_PACKAGE, that you hadn't built on your machine before.

rosdep install AMAZING_PACKAGE

In my case, the amazing_package is mavros. It seems rosdep does not recognize mavros as a package, as shown from the error message below:

$rosdep install mavros

ERROR: Rosdep cannot find all required resources to answer your query
Missing resource mavros
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share

So, what's the right way to build it from source?

[EDIT] I would like to build from source, instead of use apt-get, because eventually I will need to build mavros of a special commiit hash.

edit retag flag offensive close merge delete

Comments

1

You didn't say what your OS is, but assuming you're using Ubuntu 16.04 did you try

sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras

instead of building it?

jayess gravatar image jayess  ( 2018-03-16 23:34:31 -0600 )edit

Thanks and it is good to know the apt-get way. However, I would like to build from source instead of use apt-get, because eventually I will need to build mavros of a special commiit hash.

Zhoulai Fu gravatar image Zhoulai Fu  ( 2018-03-17 00:17:00 -0600 )edit
1

Maybe try reading documentation first next time.

l4ncelot gravatar image l4ncelot  ( 2018-03-20 04:45:17 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-17 01:04:45 -0600

Hamid Didari gravatar image

Hi for installing geographic go to mavros/scripts and type ./install_geographiclib_datasets.sh in your terminal

edit flag offensive delete link more

Comments

Thanks. But that gives me another error: scripts/install_geographiclib_datasets.sh: line 27: hash: geographiclib-get-geoids: not found

Zhoulai Fu gravatar image Zhoulai Fu  ( 2018-03-17 03:11:32 -0600 )edit

try

sudo apt-get install geographiclib-* ros-kinetic-geographic-*

then try again with scrip

Hamid Didari gravatar image Hamid Didari  ( 2018-03-17 06:25:39 -0600 )edit

After running the apt-get command above, and then the script you mentioned. catkin_make now gives me a new error "Could not find a package configuration file provided by "geographic_msgs" with any of the following names "geographic_msgsConfig.cmake, geographic_msgs-config.cmake"

Zhoulai Fu gravatar image Zhoulai Fu  ( 2018-03-19 04:58:46 -0600 )edit

try

sudo apt-get install ros-kinetic-geographic-msgs

and make again

Hamid Didari gravatar image Hamid Didari  ( 2018-03-19 05:02:31 -0600 )edit

With your suggested command, the Console responds: "ros-kinetic-geographic-msgs is already the newest version." Actually, if I ran "dpkg -l | grep geo ", I found ros-kinetic-geodesy, ros-kinetic-geographic-info, ros-kinetic-geographic-msgs, and ros-kinetic-geometry-msgs installed.

Zhoulai Fu gravatar image Zhoulai Fu  ( 2018-03-19 07:22:17 -0600 )edit

Finally, it works!

Zhoulai Fu gravatar image Zhoulai Fu  ( 2018-03-20 03:33:23 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-03-16 12:36:09 -0600

Seen: 4,178 times

Last updated: Mar 17 '18