
Setting up your workspace
Before installing, have a glance through this guide and take note of the details for your platform. We install and test RACE cognitive robotic framework on Ubuntu desktop (18.04 LTS) and ROS Melodic. For your convenience, we provide a bash script to install the RACE framework and all necessary packages and dependencies. We also set up everything in a virtual machine.
Prerequisites
There are certain steps that should be taken before installing the RACE framework to help make sure that you will have a successful installation.
1. Install operating system (Ubuntu 18.04 LTS)
Download and install Ubuntu desktop (18.04 LTS) (only Ubuntu 18.04 LTS is compatible with ROS Melodic at the moment)
2. Install NVIDIA driver, CUDA 10, TensorFlow, Keras (Ubuntu 18.04 LTS)
If you have already installed NVIDIA, CUDA and tensorFlow and Keras, skip this step!!!
##### Tensorflow-gpu installation
sudo apt update
sudo apt install python-pip
pip install tensorflow-gpu
##### add NVIDIA package repositories
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt-get update
##### Install NVIDIA driver
sudo apt-get install --no-install-recommends nvidia-driver-418
##### Reboot. Check that GPUs are visible using the command: nvidia-smi
##### Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
cuda-10-0 \
libcudnn7=7.6.0.64-1+cuda10.0 \
libcudnn7-dev=7.6.0.64-1+cuda10.0
##### Install TensorRT. Requires that libcudnn7 is installed above.
sudo apt-get update && \
&& sudo apt-get install -y --no-install-recommends libnvinfer-dev
##### Install Keras
pip install pytictoc
sudo pip install keras
3. Download ROS packages
Download system_setup.tar.xz file from Nestor and unzip it in your /home directory:
tar xf system_setup.tar.xz -C ~/
4. Setting up environment
Open a terminal and type:
gedit ~/.bashrc
afterwards, copy and paste the following lines at the end of your .bashrc file. This way, the ROS environment variables are added to your bash session every time a new shell is launched. It should be noted that cognitiverobotics should be replaced by your computer username (by opening a terminal, you can find your username e.g., username@ubuntu)
#Add ROS catkin_ws and rosbuild_ws workspaces
source /opt/ros/melodic/setup.bash
export LD_LIBRARY_PATH=/opt/ros/melodic/lib:/opt/ros/melodic/include/moveit:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export ROS_PACKAGE_PATH=/home/cognitiverobotics/catkin_ws:/home/cognitiverobotics/rosbuild_ws:/opt/ros/melodic/include:${ROS_PACKAGE_PATH}
export ROS_PACKAGE_PATH=/home/cognitiverobotics/student_ws:${ROS_PACKAGE_PATH}
export ROBOT=sim
export PATH=~/bin:$PATH
#The following line allows rosbuild packages to be depended to catkin packages
#https://answers.ros.org/question/105231/how-to-make-rosbuild-package-depend-on-catkin-package/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/cognitiverobotics/catkin_ws/devel/lib/pkgconfig:/home/cognitiverobotics/moveit_ws/devel/lib/pkgconfig
#export PATH="$PATH:$HOME/bin"
export PATH=/usr/lib/python2.7/:$PATH
#This line is necessary for MoveIt!, otherwise the robot seems broken
export LC_NUMERIC="en_US.UTF-8"
#This line forces the system to use python2 by default since the ROS works based on python2
alias python='/usr/bin/python2.7'
Then close all your terminal.
Install RACE framework
Installing the RACE framework is a very simple process and takes less than ten minutes to complete. We provide three methods to install the RACE framework. We strongly recommend you to use the bach script.
Method 1: Install using bash script (Recommended)
First, download setup_race_framework.txt script from Nestor and move it to your /home directory. Then, open a terminal, change the .txt format to .sh and give appropriate permissions to the script and finally run it:
mv setup_race_framework.txt setup_race_framework.sh
chmod 777 setup_race_framework.sh
./setup_race_framework.sh
That’s it! RACE should now be installed. If you are intersted to know what does “chmod 777” mean, read this article
Method 2: Step-by-step instructions [*] (not tested yet)
Following are step-by-step instructions for installing the RACE cognitive robtoic framewrok.
Step 1. Install ROS Melodic
This tutorial walks you through installing ROS Melodic and setting up the ROS environment on your computer.
Step 2. Install required packages
Step 3. Install LevelDB
mkdir -p /tmp/leveldb && cd /tmp/leveldb
wget https://github.com/google/leveldb/archive/v1.14.tar.gz
tar -xzf v1.14.tar.gz
cd leveldb-1.14/
make -j4
sudo cp -R include/leveldb /usr/local/include
sudo mv libleveldb.* /usr/local/lib
sudo ldconfig
Step 4. Building libfranka for Panda robot
cd ~/
sudo apt install build-essential libpoco-dev libeigen3-dev
git clone --recursive https://github.com/frankaemika/libfranka
cd libfranka && mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
Step 5. Make all catkin_ws packages
cd ~/catkin_ws
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro melodic -y --skip-keys libfranka
catkin_make -DCMAKE_BUILD_TYPE=Release -DFranka_DIR:PATH=/home/cognitiverobotics/libfranka/build
Step 6. Make all rosbuild_ws packages
cd ~/rosbuild_ws/arm_navigation_msgs/
rosmake --target=clean
cd ~/rosbuild_ws/
rosmake * --threads=1
cd imperial_3d_object_tracking
make clean && rm -r build && rm -r bin && rm -r lib
make -j4
Method 3: Download virtual machine
In general, virtual machines are much slower than the primary operating system and therefore should be considered as the last option in our course, or just use it to get familiar with the framework. The virtual machine is now available on Nestor. You can also catch me up during lab sessions to copy the virtual machine on your computer.
Troubleshooting
Here we provide a list of common errors and explain how to fix them. If the problem isn’t clear and you aren’t sure what to do next, contact TAs.
[ERROR] Could not get lock /var/lib/dpkg/lock’ : dpkg has been locked by other programs -- wait for a while and try it again