-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
Ubuntu is the Linux distribution adopted by the UnBall Soccer Team because it's simple to install and use for new users, specially the ones that haven't had any previous contact with Unix/Linux.
Installing Ubuntu is straightforward and should not represent any difficulty. The steps below are guidelines for a basic installation.
- A distribution of Ubuntu Desktop can be downloaded directly from the official website. It is recommended to get Ubuntu 14.04 (Trusty Tahr version), since ROS Hydro can be easily installed through
apt-get. - Burn the
.isoimage either in a CD-ROM, DVD-ROM or flash drive. If you decide to use the flash drive approach, take a look in this tutorial on how to create a bootable USB stick on Windows. - Put the media in your computer and check whether the device comes first in the BIOS boot order. Take a look in this tutorial to learn how to change the boot order.
- The Ubuntu installation script must have initialized. Choose the preferred language, mark to download updates while installing and install third-party software and to erase the current disk. You may also manually create partitions and allocate space in disk according to your preferences.
- The installation will also require you geographic location and keyboard layout. The keyboard layout need not be the same as the selected language. For instance, if you bought your laptop in the United States, the preferred language may be Brazilian Portuguese and the keyboard layout English (US, alternative international) to allow typing accents.
- Afterwards, the installation will ask your name, the computer's name (for network identification), an username and password. Do not forget this password, since it will also be the superuser password (unless changed).
- Finally, Ubuntu will be installed. This step requires to reboot the machine when finished.
- Update all packages to its last version. You can either use the Update Manager or the commands
sudo apt-get updateandsudo apt-get upgrade.
Add the ROS Debian packages source for Ubuntu 14.04 (Trusty Tahr).
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'
Setup keys
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
Update apt-get
sudo apt-get update
Install ROS Indigo full
sudo apt-get install ros-indigo-desktop-full
Initialize rosdep
sudo rosdep init
rosdep update
In order to setup environment variables, append the following to ~/.bashrc
# Sourcing ROS environment variables
source /opt/ros/indigo/setup.bash
ROS recommends the usage of catkin for building it's packages. In order to achieve this, we'll create a new directory catkin_ws, with an inner directory src and a CMakeLists.txt indicating it is a catkin workspace.
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
Also, in order to setup environment variables, append the following to ~/.bashrc. Make sure to adapt to your usage if you don't create the workspace in the ~/catkin_ws directory.
# Sourcing catkin environment variables
source ~/catkin_ws/devel/setup.sh
Whenever you clone a new ROS package to your machine, just symbolic link its directory to catkin_ws/src and run catkin_make to build. This facilitates the management of multiple ROS packages.
That computers without a NVidia GPU must first install ocl-icd-libopencl1 so as OpenCV does not install NVidia packages. Simply run:
sudo apt-get install ocl-icd-libopencl1
Then, copy the following code to a file named opencv.sh and save it.
version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9]+)+' | cut -c2-)"
echo "Installing OpenCV" $version
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg
echo "Downloading OpenCV" $version
wget -O OpenCV-$version.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/opencv-"$version".zip/download
echo "Installing OpenCV" $version
unzip OpenCV-$version.zip
cd opencv-$version
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j2
sudo checkinstall
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV" $version "ready to be used"
Finally, execute the script, which will completelly configure and install OpenCV.
chmod +x opencv.sh
./opencv.sh
Although Freenect is available in precompiled packages, these versions are out-of-date hence we'll manually install it. First, let's install the dependencies.
sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev
Now, clone the current version from Freenect's Git repository, make and install it.
git clone git://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig
It's also necessary to configure Freenect to be used by non-root users. Do it by adding the current user to video user group.
sudo adduser $USER video
Create the file /etc/udev/rules.d/51-kinect.rules with the following contents:
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666"
# ATTR{product}=="Xbox NUI Audio"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666"
# ATTR{product}=="Xbox NUI Camera"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02c2", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02be", MODE="0666"
# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02bf", MODE="0666"
By this time, Freenect should be up and running. In order to test, log out and back again, connect the Kinect to the computer and run one of the test programs:
cd libfreenect/build/bin
./freenect-glview
This program shows camera and depth sensor images, also allowing to control the Kinect motor via keyboard inputs. If this program runs successfully, Freenect is installed in your computer.
Finally, we install Freenect ROS packages to provide helper classes, methods and functions for Kinect control and communication to a ROS environment. Two packages are necessary in our project: freenect_launch and freenect_camera.
sudo apt-get install ros-indigo-freenect-camera ros-indigo-freenect-launch
If your Kinect is not recognized, run lsusb and check whether all Microsoft Crop. Xbox NUI Camera, Microsoft Crop. Xbox NUI Motor and Microsoft Crop. Xbox NUI Audio are present in the list. If only the motor is recognized, probably the Kinect doesn't have enough power to feed all of its sensors, indicating some problem with the power supply. You can also try connecting first the Kinect USB to the computer and, then, to the power supply.
OpenKinect Project - Getting Started
First of all, it's necessary to install git for it doesn't come packaged with Ubuntu.
sudo apt-get install git
Then, clone the repository to the unball folder.
git clone https://github.com/unball/ieee-very-small.git ~/unball
Finally, let's create a symbolic link to the configured catkin workspace in order to make it properly build our package. Make sure the paths are correctly configured.
ln -s ~/unball/software/ ~/catkin_ws/src/unball
By this time, you should be able to compile the UnBall source code. This is easy done in your catkin workspace.
cd ~/catkin_ws
catkin_make
After compilation, simply use roslaunch to run UnBall package. For instance:
roslaunch unball unball_simulation.launch
When launching unball_simulation.launch, if the following problem occurs:
Warning [ModelDatabase.cc:334] Getting models from[http://gazebosim.org/models/]. This may take a few seconds.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Warning [gazebo.cc:215] Waited 1seconds for namespaces.
Error [gazebo.cc:220] Waited 11 seconds for namespaces. Giving up.
Error [Node.cc:90] No namespace found
try replacing http://gazebosim.org/models by http://old.gazebosim.org/models in both /usr/share/gazebo-2.2/setup.sh and /usr/share/gazebo/setup.sh. This problem occurs due to incompatibility issues across Gazebo versions.