To get started with an Ubuntu VM, you'll first need to download VirtualBox, an open-source virtualization program available on most major operating systems. You can download the appropriate version for your machine here, under "VirtualBox platform packages". Once downloaded, follow the installation wizard provided by VirtualBox.
Once VirtualBox is installed, you can now load in the Ubuntu VM we've created for this class. Follow these steps:
.vmdk
and .ovf
file from this link. Make sure both files are downloaded to
the same directory.File > Import Appliance
..ovf
file is saved and import it into the
blank "File:" field. Press "Continue".Settings > System
and increase "Base Memory" to 2048MB.Settings > Display
and increase "Video Memory" to 40MB.Your VM should now be ready to boot!
The default password for the VM is: ubuntu
.
Once you open up your VM and log in successfully, you'll need to run the following commands in the terminal in order to ensure that your network settings will be set up correctly where your VM will have a unique IP address on the intro-robo
network.
$ sudo rm /etc/machine-id
$ sudo systemd-machine-id-setup
$ sudo reboot
When you want to power off the VM, simply close the window running the VM. You will be presented with three options:
Do NOT select "Power off the machine"! This option has been known to cause many issues. Instead, select either "Save the machine state" (recommended option, as it saves the VM the way you leave it) or "Send the shutdown signal" (shuts down the VM).
In order to teleoperate the Turtlebot3, your machine and your Ubuntu VM will need to be connected to it via the
same Wi-Fi network.
This network will most likely be the router that is being used for the class (intro-robo
). Follow the
steps below:
Settings > Network
in the GUI.Adapter 1
tab, which should be the default. In the Attached to:
field,
set the option to Bridged Adapter
, if it isn't already.Adapter 1
, set the Name:
field to your wireless
adapter. On a Mac, this will likely be en0: Wi-Fi (Wireless)
.
Adapter 1
, click the refresh button to the right of the
MAC Address
field to ensure that your virtual machine has a unique address.
Adapter 2
tab. Set Attached to:
to Internal Network
. The
Name:
field should already be set to intnet
-- go ahead and change it if it's not.
ROS should already be installed on your VM, but you will not be able to use ROS commands from the terminal without running a setup script. If this is your first time launching the VM, run the following commands to ensure that the setup script is executed every time you open a new terminal.
$ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
You can check that the setup script has been executed by running the roscore command in a terminal
window. You should see an output that looks like the following:
... logging to ~/.ros/log/9cf88ce4-b14d-11df-8a75-00251148e8cf/roslaunch-machine_name-13039.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://machine_name:33919/
ros_comm version 1.15.8
SUMMARY
======
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.8
NODES
auto-starting new master
process[master]: started with pid [13054]
ROS_MASTER_URI=http://machine_name:11311/
setting /run_id to 9cf88ce4-b14d-11df-8a75-00251148e8cf
process[rosout-1]: started with pid [13067]
started core service [/rosout]
You might see one of the following two errors:
bash: roscore: command not found
WARNING: unable to configure logging. No log files will be generated
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
Resource not found: roslaunch
The traceback for the exception was written to the log file
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/roslaunch/__init__.py", line 322, in main
p.start()
File "/usr/lib/python3/dist-packages/roslaunch/parent.py", line 277, in start
self._start_infrastructure()
File "/usr/lib/python3/dist-packages/roslaunch/parent.py", line 226, in _start_infrastructure
self._load_config()
File "/usr/lib/python3/dist-packages/roslaunch/parent.py", line 137, in _load_config
self.config = roslaunch.config.load_config_default(self.roslaunch_files, self.port,
File "/usr/lib/python3/dist-packages/roslaunch/config.py", line 447, in load_config_default
load_roscore(loader, config, verbose=verbose)
File "/usr/lib/python3/dist-packages/roslaunch/config.py", line 92, in load_roscore
f_roscore = get_roscore_filename()
File "/usr/lib/python3/dist-packages/roslaunch/config.py", line 84, in get_roscore_filename
return os.path.join(r.get_path('roslaunch'), 'resources', 'roscore.xml')
File "/usr/lib/python3/dist-packages/rospkg/rospack.py", line 207, in get_path
raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound: roslaunch
If you do see one of these two errors or are otherwise unable to run roscore, re-run the commands to automatically execute the setup script:
$ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
Now, you should be able to run roscore and it should show the correct output.
If you are still not seeing the correct output when you run roscore, please reach out to the teaching team for help by posting in the #computer-setup-help channel in our course Slack.