-
Notifications
You must be signed in to change notification settings - Fork 13
Instructions for installing ROS and Gazebo!
Gazebo is a dynamic (3D) simulator that was developed to work with ROS. There are several quadcopter models that work in Gazebo and are controllable via ROS messaging.
See the hector_quadrotor instructions elsewhere on the wiki after installing Ubuntu bash + ROS + Gazebo, for an easy-to-get-started UAV model that works well in Gazebo.
As of late Spring 2020, Ubuntu 20.04 is out, but ROS does not really support this well yet. Please stick with Ubuntu 18.04 and ROS melodic for now!
If you've got Mac OSX, some pre-Win10 version of Windows, or otherwise want to make ROS work on Windows 10...
- Install VirtualBox
- Download the Ubuntu 18.04 desktop ISO
- Install Ubuntu 18.04 as a Virtual Machine under VirtualBox. (Instructions: link. Recommended CPU cores = 2-4, recommended memory = 4GB-8GB, recommended disk size = 20GB-40GB.)
- Start up the Ubuntu 18.04 VM under VirtualBox
- Download the Ubuntu 18.04 desktop ISO
- Set up Ubuntu to run dual-boot on your computer. (See: link or link from Windows, link from Mac OSX, link from another flavor of Linux.)
If you are installing Ubuntu 16.04 LTS: 1. Install ROS kinetic and gazebo. Instructions are here
1. (Note: if you install `ros-kinetic-desktop-full`, you get Gazebo along with it.)
1. Set up your catkin workspace. Instructions are here
If you are installing Ubuntu 18.04 LTS: 1. Install ROS melodic and gazebo. Instructions are here
1. (Note: if you install `ros-melodic-desktop-full`, you get Gazebo along with it.)
1. Set up your catkin workspace. Instructions are here
From here, you can start playing with ROS and Gazebo and get different models flying around in the sim.
Probably the easiest way to get Ubuntu on your system is to install the Ubuntu app. However, there are some issues with this...
- You need to have at least the Fall Creators Update (later than 2017) to get Bash on Ubuntu on Windows functionality / the Windows Subsystem for Linux (or WSL for short) and then be able to run the Ubuntu app properly.
- There are two versions of the Windows Subsystem for Linux as of 2020-2021 or so. WSL1 should still be selected by default, but ROS1 messaging won't work under it properly at all. WSL2 seems to sort-of (potentially) support ROS1 messaging. *****HOWEVER!***** If you use WSL2 instead of WSL1, then you won't be able to run VirtualBox VMs or other VMs under Win10! *****Use WSL2 at your own risk!*****
Ubuntu 20.04 installation and setup instructions for trying ROS1 (still broken for WSL1, works for WSL2!)
- Update Windows to the newest major update (for the most-recent Ubuntu app), at least 1903 or 1909 for WSL2
- To check your version and build number, select Windows logo key + R, type winver, select OK. (If the "OS Build" is 18362.1049+ or 18363.1049+, with the minor build # over .1049, then you're good for WSL2!)
-
Install the Ubuntu app -- follow these instructions (and/or see also: link)
- If Win10 is 1903 or 1909 or newer, install WSL2 instead of WSL1 at this step
- You may want to make sure you're updated to using the newest version of WSL2 by downloading this .msi installer file and then running it, too
- I recommend that you install the specific Ubuntu 20.04 app at this step -- see link
- If Win10 is 1903 or 1909 or newer, install WSL2 instead of WSL1 at this step
- Install VcXsrv
Then:
- Run VcXsrv XLaunch program
- Select
Multiple Windows
, Display number0
- Select
Start no client
- Select/checkboxes for
Clipboard
andPrimary Selection
andNative opengl
andDisable access control
- It's recommended that you
Save configuration
to the desktop at the end so you can just double-click the file the next time
- Select
- Run the Ubuntu 20.04 app
- Run at the Ubuntu 20.04 app commandline:
sudo apt update sudo apt upgrade sudo apt install net-tools gedit gnome-terminal vi ~/.bashrc
- Inside
.bashrc
, use the arrow keys to scroll down to the very bottom of the file, and the end of the last line.
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
Hit the 'Esc' key, type ':w' (colon w) and hit enter, type ":q" (colon q) and hit enter.
- Then run at the Ubuntu 20.04 app commandline:
source ~/.bashrc
- And then try opening gnome-terminal (which should pop up as a new terminal in a new GUI window):
gnome-terminal &
- Then try installing ROS1:
sudo apt install git sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt update sudo apt install ros-noetic-desktop-full echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential sudo rosdep init rosdep update mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make source devel/setup.bash roscore
roscore should run.
- You may need to:
export LIBGL_ALWAYS_INDIRECT=0
in order for gazebo
to run properly.
Note that ROS still does NOT currently work under the "Bash on Ubuntu on Windows" Windows Subsystem for Linux on the newer Windows 10 major updates if you are using WSL1 instead of WSL2! To install a working version of ROS for the older Linux subsystem, you will need to install VirtualBox (see above) or use WSL2.
The following has not been tested as of yet -- use at your own caution!
Generally discussed under "Step 3 Enable Virtual Machine Feature" here and "Set your distribution version to WSL 1 or WSL 2" here as well as here
Other refs:
- Change version of WSL used by Ubuntu apps(s) in Win10
- Enable feature in Win10
- Disable feature in Win10
- Note that the
wsl --set-distribution
command may take a few minutes...
- Get the list first
wsl --list --verbose
- Set the WSL version for the distribution
wsl --set-version <distribution name> <versionNumber>
Replace <distribution name>
with the actual name of your distribution (from wsl -l -v
) and <versionNumber>
with the number '1' or '2' (1 for WSL1 and 2 for WSL2).
Note that if any distribution is using WSL2, that you may not be able to disable the WSL2 feature.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /all /norestart dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Not sure why you'd want to disable WSL1, but for completeness:
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
If you've enabled or disabled either or both of the WSL1 or WSL2 Win10 features, you're going to want to restart again before trying to use any Ubuntu app or Virtual Machine program again.
1. Update Windows to the newest major update (for the most-recent Ubuntu app) 1. Install the Ubuntu app 1. Install XMing
Make sure you restart your computer before proceeding if you had to enable the "Windows Subsystem for Linux" as part of the above process!
Then:
- Run XMing
- Run the Ubuntu app (/ Bash on Ubuntu on Windows)
- Run at the Ubuntu app (/ Bash on Ubuntu on Windows) commandline:
echo "export DISPLAY=:0" >> ~/.bashrc source ~/.bashrc sudo apt update & sudo apt install gedit gnome-terminal
Note that if you're using the vagrant-rss scripts to install ROS, then aptdcon and dbus need to be installed for the ROS stuff to install / work at all due to the methods being used in the scripts for installation. Install these via the following:
sudo apt install dbus dbus-x11 sudo service dbus start sudo systemd-machine-id-setup
(Ref.s: link, which discusses installing dbus and creating a machine-id)
And then try installing ROS using the vagrant-rss scripts:
sudo apt install git mkdir git_pulls cd git_pulls git clone https://github.com/AS4SR/vagrant-rss.git cd vagrant-rss/single_installers sudo su ./quick_install_ros_gazebo_and_catkin_ws.sh kinetic @USER@
replacing @USER@ with your username.
This will have roscore working -- but -very- laggy -- under Windows 10 Fall Creators Update (or newer). Try this out in a new `gnome-terminal` window:
# tab 1: source ~/catkin_ws/devel/setup.bash roscore # tab 2: source ~/catkin_ws/devel/setup.bash rostopic echo /testint # tab 3: source ~/catkin_ws/devel/setup.bash rostopic pub /testint std_msgs/Int32 "data: 5"
Note that ROS still does NOT currently work under the "Bash on Ubuntu on Windows" Windows Subsystem for Linux on the newer Windows 10 major updates if you are using WSL1 instead of WSL2! To install a working version of ROS for the older Linux subsystem, you will need to install VirtualBox (see above) or use WSL2 (see above).
Probably the easiest way to get Ubuntu 16.04 on your system is to:
- Update Windows to the Fall Creators Update (for the most-recent Ubuntu app)
- Otherwise, update Windows to the Creators Update (for Bash on Ubuntu on Windows)
-
Install the Ubuntu app if you have the Fall Creators Update (Oct-Nov 2017)
- Install Bash on Ubuntu on Windows if you have the Creators Update (early-2017)
- Install XMing
Then:
- Run XMing
- Run the Ubuntu app (/ Bash on Ubuntu on Windows)
- Run at the Ubuntu app (/ Bash on Ubuntu on Windows) commandline:
echo "export DISPLAY=:0" >> ~/.bashrc source ~/.bashrc sudo apt update & sudo apt install gedit gnome-terminal
Note that if you're using the vagrant-rss scripts to install ROS, then aptdcon and dbus need to be installed for the ROS stuff to install / work at all due to the methods being used in the scripts for installation. Install these via the following:
sudo apt install aptdcon dbus sudo service dbus start
(Ref.s: link, link, and you may need to create the machine-id manually via link, but -don't- do link because we want it using Unix sockets not Windows protocols)
And then try installing ROS using the vagrant-rss scripts:
sudo apt install git mkdir git_pulls cd git_pulls git clone https://github.com/AS4SR/vagrant-rss.git cd vagrant-rss/single_installers sudo su ./quick_install_ros_gazebo_and_catkin_ws.sh kinetic @USER@
replacing @USER@
with your username.
This will have roscore working -- but -very- laggy -- under Windows 10 Fall Creators Update (or newer). Try this out in a new gnome-terminal
window:
# tab 1: source ~/catkin_ws/devel/setup.bash roscore # tab 2: source ~/catkin_ws/devel/setup.bash rostopic echo /testint # tab 3: source ~/catkin_ws/devel/setup.bash rostopic pub /testint std_msgs/Int32 "data: 5"
Note that ROS does NOT currently work under the "Bash on Ubuntu on Windows" Windows Subsystem for Linux on the Windows 10 Creators Update! To install a working version of ROS for the older Linux subsystem, you will need to install VirtualBox (see above).
- This is due to issues with ros_comm! (See link and link for more information.)
- As of 2017-05-17 and the Windows Creators Update version of the Windows Subsystem for Linux (WSL), you may be able to install and compile under bash on Win10, but if you try running
roscore
and thenrostopic echo /rosout
, you'll get a TCP/IP warning/error after awhile, saying that you can't connect. - If you try running
roslaunch hector_quadrotor_demo indoor_slam_gazebo.launch
, because of theros_comm
TCP/IP stack issues, thecontroller_manager
will 'warn' that it isn't able to load the controllers, and none of the services necessary to control the UAV are loaded --rosservice list
does now show/enable_motors
or any of the/controller_manager/*
services, an example of what you should see is here: link).
cd ~/Downloads && mkdir -p ros_comm_fix/src cd ros_comm_fix/src git clone -b transport_tcp_kinetic https://github.com/andyli/ros_comm.git catkin_init_workspace cd .. catkin_make catkin_make install