Embedded Motion Control 2013/Installation
This manual describes how to the install the necessary and sufficient software to start programming the Pico robot.
Ubuntu
Download Ubuntu 12.04 using these direct links: 32-bit or 64-bit. Then go to this page and follow the instructions to create a bootable USB stick. Reboot your computer with the newly created USB stick, and install Ubuntu. If you want to keep using Windows next to Ubuntu the most easy way is to have a dual-boot system, i.e., during startup you can choose to boot either Ubuntu or Windows. Of course you can also bring your notebook to the ICT servicedesk and ask them to install Ubuntu (but mention that you need version 12.04, not 14.04).
Ubuntu Terminal
Most of your interaction with Ubuntu will be done through the terminal, the number-one way of interacting with Ubuntu using your keyboard. A terminal can be started as follows: Application -> Accessories -> Terminal, or by pressing ctrl-alt-t. It might be a good idea to drag the terminal icon in the menu to the Ubuntu panel, as you will be using it a lot. Read more
ROS
In this project we will use the Robotic Operating System (ROS) which aids the testing and development of robot software. ROS provides a nice open-source framework for dealing with the communication between and management of different modules, and comes with a large amount of software that can be used out of the box, including device drivers, libraries, low- and high-level software, visualizers and more. More information about ROS and its goals can be found here.
We will be using ROS Groovy. Install ROS Groovy using the installation instructions on the ROS wiki. After the installation, you should do the ROS tutorials. The ROS tutorial can be found here. In some of the tutorials you can choose between catkin and rosbuild (for example in this tutorial. Make sure you select rosbuild (above the content text box).
Before you continue, make sure you understand the basic ROS concepts, such as:
- package
- node
- topic
- subscriber
- publisher
- message
- callback function
- ...
In addition it is important to know the concept of the ROS_PACKAGE_PATH. ROS_PACKAGE_PATH is a variable which informs ROS on the location of your packages. ROS will only be able to find packages which are located in a folder which is part of your package path! To print the value of the ROS_PACKAGE_PATH variable, you can simply type:
echo $ROS_PACKAGE_PATH
in a terminal.
SVN
In this project, an SVN will be used for sharing and versioning the software within your group. Every group has its own space on the SVN, and an account which has only permissions for that particular part. Make sure you read the following SVN instruction carefully! Not reading them might cost you a lot of time in the end!
Environment Set-up
So far we've installed ROS and created a local copy of the SVN. However, before you can start working, you need to do some additional set-ups to make sure Ubuntu knows where to find all ROS-related packages, scripts, etc. More specifically, every time you start up a terminal, the correct environment variables need to be set. The file .bashrc in your home directory is your friend: it's a script which runs every time a a new terminal is opened. We basically need to add some lines to this file, so open the file with a text editor:
gedit ~/.bashrc
Append the following text to the end of the file:
source /opt/ros/groovy/setup.bash
This will set-up all ROS-related scripts etc. every time you open a terminal. Furthermore, ROS needs to known where your software is located. Therefore, also add the following command to ~/.bashrc:
export ROS_PACKAGE_PATH=~/ros/emc:$ROS_PACKAGE_PATH
That's it. Next time you open a terminal, .bashrc is executed, which will in turn execute the script and set the path specified. This command tells ROS to look in the emc/ros folder whenever it is looking for your code. Since the script only runs when a new terminal is opened, the changes are not active in your current terminal. If you want to see it working directly without starting a new terminal, explicitly source .bashrc from the terminal:
source ~/.bashrc
This command forces the terminal to reload all variables without restarting the terminal. To see whether it worked, try one of commands that are now at your disposal. For example, change your directory to the roscpp package:
roscd roscpp
Integrated Development Environments
To keep the code in your packages clear and manageable, it is advised to use an Integrated Development Environment (IDE) to edit your C++ code. Two editors that are commonly used are Qt Creator and Eclipse. Both of these editors have the advantage of understanding you code up to some extend. This means they can be used to, e.g., autocomplete names of variables and functions or get compilation error message in a nice way. We recommand using Qt or Eclipse. Continue here.
Gazebo
We will use the robot simulator [Gazebo] to simulate the PICO robot and its environment. This includes simulation of the physics and sensors of the robot. To install Gazebo:
- Open a terminal (ctrl-alt-t)
- Setup your computer to accept software from packages.osrfoundation.org:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'
- Retrieve and install the keys for the Gazebo repositories:
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
- Update apt-get and install Gazebo.
sudo apt-get update
sudo apt-get install gazebo
- Initialize.
gzserver
Wait until you get a message like Publicized address: ....
You can try if your Gazebo installation was successfull by either executing a gazebo client on a seperate terminal:
gzclient
Or by running the program alone:
gazebo