Environment Setup
Read all the documents in this lab script before starting to do/type anything. Ask if anything is unclear before doing something.
If you do something you need to know what effect it will have, otherwise you could damage the VM or ROS and be unable to work properly.
Setup Environment and Desktop
Command Prompt - Terminal
ROS Environment
Study the lectures, and other sources before approaching the coursework.
If you are not familiar with Linux OS follow tutorials and familiarise with the shell environment.
For any command that you do not know, please research what it does and when to use it e.g. source
It is important to understand why commands are entered and what is the expected outcome as part of your learning.
Some machines might have some of the following elements installed, check before proceeding.
The Console to use is the Xfce Terminal, which will be referred to as terminal for the rest of the document.
Create ROS Workspace
Read the appropriate sources before proceeding; two key links are listed below, but you should extend your research to other sources too.
-
Tutorial on how to create a workspace from the ROS wiki.
-
Tutorial on how to create a package from the ROS wiki.
Todo: Create a folder within /rosdata which will serve as your workspace. Name it e.g. ros_ws_loc
(any name will do).
Try: Initialize the workspace. Use catkin_make
command which would allow you to compile, develop and run the ROS project(s).
Todo: source
the workspace if catkin_make
command is not found.
Todo: Create your first ROS package.
Todo: Use the example provided to test if all works (available on Moodle).
Make Your Life Easier by Changing the bashrc File
Please do not change this file unless you understand the role of the function source, if this file is damaged in some cases other software might not work correctly, so proceed with caution!
This action is optional but recommended (check if these lines already exist).
This modification allows you to avoid having to source
and set environment variables each and every time you open a terminal window (you will open many - so this can save a lot of time).
Open ~/.bashrc
file with a text editor e.g. mousepad that can be found in the start menu on your remote machine.
The correct bashrc
file to change is the one in your home folder indicated by the symbol ~
.
To open the file via shell you need command + file_name, for example:
Add these two lines at the end of the file:
The first line recreates a specific environment variable. Please research the use of the export
command yourself.
The second line source
’s the overall ROS framework setup file.
This last section might not be clear until you read and experiment with your first ROS package and it’s compilation, and are familiar with the workspace concept. Therefore, you might want to apply these changes later.
After these lines, add the source to the specific workspace you are working in (the local folder of your ROS workspaces).
If you want, you could use a folder within your H
drive. Feel free to do so but be aware;
- the behavior might vary
- you will need to adapt the following as needed
This will select the #workspace you are working in.
Work With Two ROS Workspaces
If you decide to have more than one workspace (for example local to the VM and in your H drive) you will need to source the local setup.bash files of the specific workspace you are using before using one or the other. You can have two lines and comment the one you do not use in your bashrc file.