###### tags:`ROS` `EPFL` `TP` # Preparing a ROS VM for the Robotics Practicals > Revisions > 12-Dec-2020: Initial version ## 1. Install VMWare Fusion ROS Noetic requires Ubuntu 20.04. So, if you are a mac or windows user, we recommend you to install a virtual machine (e.g., VMWare Fusion) for an fairly easy installation of the linux OS. This guide was created using VMWare Fusion Pro 11.5.7 on macOS Catalina (v 10.15.7). But it should work for any future VMWare Fusion version (v12 already available) and any other operating systems (e.g., Windows), although not tested. EPFL students can download VMWare for free from: * vmware-edu.epfl.ch * https://wiki.epfl.ch/macos/vmware ## 2. Installing Linux Ubuntu 20.04.1 A. Download the "ubuntu-20.04.1-desktop-amd64.iso" file from: [here](https://releases.ubuntu.com/20.04/ubuntu-20.04.1-desktop-amd64.iso). B. Create the VM with VMWare Fusion (this step should take approx. 30-60 minutes): * Go to the menu: File → New ![](https://i.imgur.com/EtoJMaX.png =500x) * Click on "Install from disc or image" and select the Ubuntu iso file. ![](https://i.imgur.com/EFSFHtm.png =500x) * Follow the installation. ==Create a user called "**student**" with password "**epfl_student**"==. * On the created VM settings, pick a minimum of 2 processors and 4 GB of RAM. Ideally, 4 processors and 8 GB of RAM (like the image below). ![](https://i.imgur.com/Or1BJTH.png =500x) C. Run the new VM and login with the "student" credentials. ## 3. Installing necessary applications A. Install the "Terminator" multi-terminal. It allows to have multiple terminal sessions in one window. ``` $ sudo apt-get update $ sudo apt-get install terminator ``` If the previous doesn't work, it might be necesary to run: ``` $ sudo add-apt-repository ppa:gnome-terminator ``` Documentation: [here](https://terminator-gtk3.readthedocs.io/en/latest/index.html) and tutorial: [here](https://blog.arturofm.com/install-terminator-terminal-emulator-in-ubuntu/). B. Install the "htop" and "tree" program ``` $ sudo apt-get install htop $ sudo apt-get install tree ``` C. Install git ``` $ sudo apt-get update $ sudo apt-get install git ``` D. Install pip3 ``` $ sudo apt install python3-pip ``` ## 4. Installing ROS Noetic ![](https://i.imgur.com/kyqXtUl.png =300x) Follow the official guide: http://wiki.ros.org/noetic/Installation/Ubuntu Test the installation running: ``` $ rosversion -d noetic ``` ```$ roscore``` ![](https://i.imgur.com/Ep7SBvq.png =600x) ## 5. Environment configuration A. Open the Terminator terminal B. Create a git folder at home ``` $ cd ~ $ mkdir git ``` C. Adding "source" command to every new terminal For every new terminal it is required to run the command below. So let's add it to the .bashrc file so every new terminal window will automatically execute it. ``` $ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc $ source ~/.bashrc ``` D. If the installation was successful, after running the command ```$ roscore``` you should see something like: ``` Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://ubuntu:40443/ ros_comm version 1.15.9 SUMMARY ======== PARAMETERS * /rosdistro: noetic * /rosversion: 1.15.9 NODES auto-starting new master process[master]: started with pid [33494] ROS_MASTER_URI=http://ubuntu:11311/ setting /run_id to c1e4726c-4223-11eb-b125-c580e3decc35 process[rosout-1]: started with pid [33504] started core service [/rosout] ``` E. Test with turtlesim 1. Run ```$roscore``` in one terminal. 2. On a second terminal run ```$ rosrun turtlesim turtlesim_node```. You should see: ![](https://i.imgur.com/oG9vwe5.png =300x) 3. On a third terminal run ```rosrun turtlesim turtle_teleop_key``` to use the keyboard to control the turtle. To control the turtle this terminal should be on focus. 4. On a fourth terminal run: - List the available topics: ```$ rostopic list``` - Display the messages from the /turtle1/pose topic: ```$ rostopic echo /turtle1/pose``` F. Install multiple ROS related applications Install catkin tools. To allow the use of ```catkin build```, instead of ```catkin_make```. ``` $ sudo pip3 install git+https://github.com/catkin/catkin_tools.git ``` Install Rosdep ``` $ sudo apt install python3-rosdep2 ``` Install Rosmsg ``` $ sudo apt install python3-rosmsg ``` Install Rospack To enable tab auto-complete with rosmsg command. ``` $ sudo apt-get install rospack-tools ``` G. ``` # Set ROS alias command alias cw='cd ~/catkin_ws' ``` **ROS workspace** Tutorial [here](http://wiki.ros.org/catkin/Tutorials/create_a_workspace) E. Create and build a catkin workspace: ``` $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/ ???? ``` ==Eb. Don't use this: Create and build a catkin workspace:== ``` $ mkdir -p ~/catkin_ws/src $ cd ~/catkin_ws/ $ catkin_make ``` <font color="#ccc">catkin_make documentation: [here](http://wiki.ros.org/catkin/commands/catkin_make)</font> F. Check the content of the "catkin_ws" folder. It should have the folders: "build", "devel" and "src". ``` $ ls build devel src ``` G. Source your workspace ``` $ cd ~/catkin_ws/ $ source devel/setup.bash ``` [OPTIONAL] You can delete your buildspace and install space whenever you want, and re-create them using the steps above. The main purpose of this is to 'uninstall' packages you have built or make install'ed previously. ``` $ cd ~/catkin_ws $ rm build devel install ``` H. Add your workspace to the .bashrc file such that it is sourced every time you start a new shell (terminal). ``` echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc ``` I. To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you're in. ``` $ echo $ROS_PACKAGE_PATH /home/student/catkin_ws/src:/opt/ros/noetic/share ``` J. At this stage the final lines of your .bashrc file should look like: ``` $ cat ~/.bashrc (bunch of other stuff here)... source /opt/ros/noetic/setup.bash source ~/catkin_ws/devel/setup.bash ``` ## Sharing the VM ## References 1. https://rsl.ethz.ch/education-students/lectures/ros.html 2. https://ethz.ch/content/dam/ethz/special-interest/mavt/robotics-n-intelligent-systems/rsl-dam/ROS2020/HowToSetupDeveloperPC_18-04.pdf 3. http://wiki.ros.org/catkin/Tutorials/using_a_workspace ## TEMP Symlink the new package to your catkin workspace ``` > ln -s ~/git/ros_best_practices/ ~/catkin_ws/src/ ```