VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use. To download VirtualBox head to VirtualBox.org and choose the latest version for your operating system.
Then all you need to do is follow along with the set up wizard to install VirtualBox, when you are done you should be able to run it and see this window, without any virtual machines of course.
First you need to visit Ubuntu.com then go to the downloads page, choose Ubuntu desktop and select your desired version, your choosen version will determine which ROS version you can install, we will discuss that later when we get to installing ROS, I will be wroking on Ubuntu 20.04 Note that it's recommended to isntall an LTS version, which stands for long term support. After you finish downloading the Ubuntu ISO file we can start installing it on VirtualBox. Start VirtualBox, then hit the NEW button, fill in your machine name, type and version and then click next, as shown below:
The Next Few pages will have set up the specifications for your new virtual machine. follow the images below:
After you are done click on create, now your virtual machine should appear on your VirtualBox manager, select it and click on settings to customize and set up your machine before launching it. These settings can vary from one device to another, and prefrence may play part in some of it, here is my recommended settings:
Anything that is not shown can be left as default
And now to add the ISO file that we downloaded from Ubuntu, from settings select Storage, and under Storage Devices under Controller: IDE click on the empty disc, go to Attributes and click on the disc icon next to Optical drive:, then select Choose a dick file, then go to where you downloaded your ISO file and select it. Now your virtual machine is ready, exit settings, select your virtual machine and click on Start. Now your vitrual machine should be running, for your first time you will need to isntall and set up Ubuntu to run on it. After waitting for a bit an isntall window should pop up, select your language and click Install Ubuntu
Choose your keyboard layout
In the next page make sure to check the last 2 boxes
Finally keep this page as it is and click Install Now
Now you can continue by selecting your time zone, filling in your name and password, when you are done click Continue and Ubuntu should start installing. After sometime your installing will be complete and Ubuntu will require you to restart your virtual machine, click Restart and after restarting you should be able to use Linux on your virtual machine as you please.
Installing ROS will be stright forward, but first of all as we mentioned earlier, the version of ROS you will be installing depends on what version of Ubuntu you have For Ubuntu 20.04 download ROS Noetic For Ubuntu 18.04 download ROS Melodic For Ubuntu 16.04 download ROS kinetic
To install ROS go to your Linux terminal in your virtual machine, and once at a time enter these commands: Setup your computer to accept software from packages.ros.org.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
sudo apt install curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
To make sure your Debian package index is up-to-date
sudo apt update
Installing ROS Noetic
sudo apt install ros-noetic-desktop-full
Environment setup
source ~/.bashrc
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
cd ~/catkin_ws/src
Now to add a project, we will clone a robot arm project from Smart-Methods.
git clone https://github.com/smart-methods/arduino_robot_arm.git
cd ~/catkin_ws
rosdep install --from-paths src --ignore-src -r -y
sudo apt-get install ros-noetic-moveit
sudo apt-get install ros-noetic-joint-state-publisher ros-noetic-joint-state-publisher-gui
sudo apt-get install ros-noetic-gazebo-ros-control joint-state-publisher
sudo apt-get install ros-noetic-ros-controllers ros-noetic-ros-control
catkin_make
Finally to launch Ros with the added project
roslaunch robot_arm_pkg check_motors.launch
Note that you might encounter an erorr when launching a project, if you do try this command
source devel/setup.bash