Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing ROS Melodic on Ubuntu 18.10

Tags:

boost

ros

I can't be the only person interested in this combination of Cosmic (with Wayland) and Melodic.

I'll be up-front: I seem to have successfully managed this on my XPS 13 (9370), or at least the install script [eventually] completed successfully. However, there's a really hacky workaround. I'll gladly vote up replies of others who attempt an installation, regardless of outcome.

Basically, I ran the instructions on http://wiki.ros.org/Installation/Source for a "desktop" install, and here's how I dealt with the various snags along the way:

  • Override the distro, using bionic instead of cosmic:
    rosdep install --from-paths src --ignore-src --os=ubuntu:bionic --rosdistro melodic -y

  • Boost library errors...
    (See Michal Fapso's solution below. It's quicker, easier, less buggy...)
    After installing aptitude, switch back-and-forth between Boost 1.65 and Boost 1.67, retrying the installation after each switch. Seriously. The two commands to do this are:
    sudo aptitude install libboost1.65-all-dev
    and:
    sudo apt install libboost1.67-all-dev
    Alternate about a dozen times, making sure you get to a higher package number each time. [I think the next generation of ROS will need the Boost date_time function called differently.]

  • Random libraries---OGRE, libyaml:
    OGRE can be installed nice and easily with apt (libogre-1.9-dev)
    libyaml... can also be installed, except I tried three or four versions before this one stuck (libyaml-cpp0.3-dev)


roscore runs, showing melodic version 1.14.3. Turtlesim runs with turtle_tf2_demo (teleoperation), rviz works, as well as rosgraph and the Python (rospy) modules.

Report your errors, please!

like image 376
Brian Wright Avatar asked Nov 12 '18 16:11

Brian Wright


People also ask

Which Ubuntu version is best for ROS melodic?

ROS Melodic Morenia is primarily targeted at the Ubuntu 18.04 (Bionic) release, though other Linux systems as well as Mac OS X, Android, and Windows are supported to varying degrees.

How do I know if ROS melodic is installed?

dpkg -s ros-noetic-<pkg> will give you info only if installed. Either using that or another dpkg tool, you could find if the base ROS binary is installed as a way to know if ROS is around, e.g. dpkg -s ros-<distro>-ros .

Does ROS work on Ubuntu Server?

Ubuntu has been the primary platform for ROS from the very beginning, thanks to its flexibility and user-friendliness. ROS is led by Open Robotics, similar to how Canonical supports Ubuntu; Open Robotics steers the ship but it is driven by the community.


1 Answers

Thanks for your hints, Q. Wright. Here is a more detailed guide for ROS beginners like myself :)

This part is from http://wiki.ros.org/melodic/Installation/Source and includes Q. Wright's trick with specifying older ubuntu distro:

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential
sudo rosdep init
rosdep update
mkdir ~/projects/ros_catkin_ws
cd ~/projects/ros_catkin_ws
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall
wstool init -j8 src melodic-desktop-full.rosinstall
rosdep install --from-paths src --ignore-src --os=ubuntu:bionic --rosdistro melodic -y

Now, before we run the build process, there are boost library errors which Q. Wright mentioned. They are caused by the 'boost::posix_time::milliseconds' function which in newer boost versions accepts only an integer argument, but the actionlib package in ROS, gives it a float on several places. You can list all files using that function:

find -type f -print0 | xargs -0 grep 'boost::posix_time::milliseconds' | cut -d: -f1 | sort -u

Open them in your text editor and search for the 'boost::posix_time::milliseconds' function call. Float argument is passed in these files:

./src/actionlib/include/actionlib/client/simple_action_client.h
./src/actionlib/include/actionlib/destruction_guard.h
./src/actionlib/include/actionlib/server/simple_action_server_imp.h
./src/actionlib/src/connection_monitor.cpp
./src/actionlib/test/destruction_guard_test.cpp

and replace calls like this:

boost::posix_time::milliseconds(loop_duration.toSec() * 1000.0f));

to:

boost::posix_time::milliseconds(int(loop_duration.toSec() * 1000.0f)));

and these:

boost::posix_time::milliseconds(1000.0f)

to:

boost::posix_time::milliseconds(1000)

Now we can finally build ROS, hopefully without any error:

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
like image 141
Michal Fapso Avatar answered Oct 01 '22 00:10

Michal Fapso