WSL + x-server can work quite nice, but it requires some twidling.
Gazebo native client is a brutal cpu hog, so a better option to display the simulation is to use the Gazebo web client, GzWeb
Now we can use wsl in it's normal headless mode and let it host a web server and view the simulation in a browser from the windows side.
-
Be sure to be on Windows build 1809 or later
You can use windows update assistant to force an upgrade to one of the major builds.
If you do force an upgrade then make sure to run windows update after the upgrade has been completed. -
Use Ubuntu 18.04
For installation see Windows Subsystem for Linux Documentation
Then have a look at how to set up ssh and a nice terminal in the repo readme
-
Install ROS distro
Follow the official instructions for how to install Melodic.
Choose to install the feature Desktop-Full to include Gazebo 9 (the simulator) with all the libraries you will need. -
Configure ROS environment
Follow the official instructions -
Add ROS environment and workspace configuration to your shell session script
Add the following to.zshrc
to ensure ROS environment and workspace are ready for each new session:# Run ROS environment and workspace setup source /opt/ros/melodic/setup.zsh source ~/catkin_ws/devel/setup.zsh
Note that I have chosen to use the
zsh
setup, there are similar files forbash
etc.
Follow the official GzWeb installation instructions with some exceptions:
-
Exception - Do not install any Gazebo version
You have everything you need if you installed ROS with the Desktop-Full feature. -
Exception - The
nodejs npm nodejs-legacy
dependency installation
You might want to control the nodejs installation using a node virtual environment manager likenvm
orn
.
I went withn
as there supposedly are some issues with nvm and Gazebo. You can have a look at my install of nodejs and related tooling in the ../nodejs/bootstrap.sh script.