Search code examples
rosubuntu-20.04

How to setup ROS environment variable on Ubuntu 20.04?


I tried following this guide to install ROS, but even after adding ROS source.list and its key

sudo apt install ros-melodic-desktop-full

gave error.

E: Unable to locate package ros-melodic-desktop-full

Then I ran this command

sudo apt search ros

to see if any such package exists. I couldn't find ros-melodic-desktop-full but I found another similar package ros-desktop-full. So I installed it instead. The installation went smooth without giving any errors.

Next step in the guide is to set-up ROS environment variable, but I have no such directory

/opt/ros

So how do I setup the environment variable?

P.S.

I also installed some tools and dependencies with this command

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

and initialized rosdep

sudo rosdep init
rosdep update

Solution

  • From the documentation here, melodic is only supported on Ubuntu 18.04. The ROS version targeting Focal (20.04) is Noetic, but that one has not been released yet (see Distributions). I'm not sure what ROS version Ubuntu packages (the ros-desktop-full one you installed), but I was not successful in using it.

    If you really do want to use Ubuntu 20.04, then I think your best option currently is to compile from source. Last time I checked the precompiled debs for Noetic are not yet available at http://packages.ros.org/ros/ubuntu (you can track release progress at github issue 21513). No idea if compiling Noetic from source is easy or hard, but I was able to compile ROS2 foxy from source without too much trouble though.