Behavior Metrics with ROS Noetic can be installed as usual in the machine or using Docker. Since ROS Noetic needs Ubuntu 20 and the dependencies are quite new, that workflow is also provided.
Table of Contents
- Ordinary Installation
- Installation using Docker
- Ubuntu 20.04
A detailed ROS Noetic installation guide can be found in the ROS Wiki
Setup your sources
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
sudo apt install curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
Installing ROS Noetic
sudo apt update sudo apt install ros-noetic-desktop-full
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
Installing Python 3.7 and creating a virtualenv
It is recommended to use virtual environment for Behavior Metrics.
sudo apt install software-properties-common python3-pip python3-virtualenv sudo add-apt-repository ppa:deadsnakes/ppa sudo apt install python3.7 # Create virtualenv virtualenv -p python3.7 .behavior-metrics source .behavior-metrics/bin/activate pip install empy sudo apt-get install python3.7-dev
git clone -b noetic-devel https://github.com/JdeRobot/CustomRobots cd CustomRobots/f1 && mkdir build && cd build /bin/bash -c "source /opt/ros/noetic/setup.bash; cmake .. && make && make install;" echo "source /opt/jderobot/share/jderobot/gazebo/assets-setup.sh" >> ~/.bashrc
ROS additional package
git clone https://github.com/strasdat/Sophus cd Sophus && mkdir build && cd build cmake ../ && make && make install
This application depends on some third party libraries, most of them are included in the requirements file. To install them just type the following:
git clone -b noetic-devel https://github.com/JdeRobot/BehaviorMetrics cd BehaviorMetrics pip3 install -r requirements.txt
If you are going to use the GUI you need to create the resources file for the application.
pyrcc5 -o behavior_metrics/ui/gui/resources/resources.py \ behavior_metrics/ui/gui/resources/resources.qrc
For installing CARLA and supporting this new simulator:
- Install CARLA 0.9.13
- Install CARLA ROS Bridge
- Install CARLA bird-eye-view
pip3 install carla_birdeye_view==1.1.1 # already in requirements.txt
- Add variables to PYTHONPATH following the simulator installation instructions and ROS bridge installation instructions.
source ~/carla-ros-bridge/catkin_ws/devel/setup.bash export CARLA_ROOT=<PATH-TO-CARLA>/carla_simulator_0_9_13/ export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla export PYTHONPATH=$PYTHONPATH:$CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.13-py3.7-linux-x86_64.egg
The docker installation guide is very clear and can be found in this link which is well documented.
Download Docker in Ubuntu
First remove older versions.
sudo apt-get remove docker docker-engine docker.io containerd runc
Then setup the stable repository
sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
Install the docker engine
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
Add your user to the docker’s group to avoid using
sudo for docker, you have to log out and log in and restart to for this change to take effect.
sudo usermod -aG docker your-user
Test your installation
docker run hello-world
Open up a terminal a paste the following command. Creating a volume is recommended so you can add models or datasets easily.
To create the volume update
local_directory to yur local directory where your datasets and models are located and
docker_directory to the
directory you want them to be stored inside the container.
For CPU only
docker run -dit --name behavior-metrics-noetic \ -p 5900:5900 \ -p 8888:8888 \ -v [local_directory]:[docker_directory] \ jderobot/behavior-metrics:noetic
For GPU support (CUDA 10.1 Cudnn 7)
Some extra packages are needed for Ubuntu 16.04/18.04/20.04, more about installation in nvidia-docker docs.
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker
--gpus is added along with the correct image that contains cuda drivers.
docker run --gpus all -dit --name behavior-metrics-noetic \ -p 5900:5900 \ -p 8888:8888 \ jderobot/behavior-metrics:noetic-10.1-cudnn7
For GPU support on WSL refer Getting started with CUDA on Ubuntu on WSL 2.
To connect to our container RealVNC can be installed to access the GUI through the port 5900.
Once vnc-viewer is open fill in
localhost:5900 in the address and then press connect.
You will need to authenticate, the current password is jderobot, although it can be changed in the script
The recommended way to work, is by writing down
docker logs container-name and you will get an URL, which will take you to notebook, double click on the last URL to open Jupyter.
docker logs behavior-metrics-noetic
Go to that URL in the browser (outside VNC) and once you are in the notebook you can open up a terminal by clicking in Terminal.
A terminal window will open. Type
and this window will behave as any other Ubuntu terminal, so you are ready to run Behavior Metrics, once the GUI is opened it will be displayed in the VNC window.
cd BehaviorMetrics/behavior_metrics/ python3 driver.py -c configs/default.yml -g
This command will open the Gazebo Simulation in the VNC window. You can also directly run the previous command inside VNC window in a terminal.
IF THE PREVIOUS COMMAND FAILS try the following and try again:
sudo apt-get update && sudo apt-get upgrade
behavior-metrics-noetic should be replaced with the name of your container.
docker stop behavior-metrics-noetic
behavior-metrics-noetic should be replace with the name of your container, this command is similar to
docker run so now you can run
docker logs container_name to get a new link for jupyter, and then connect as usual to your VNC viewer.
docker restart behavior-metrics-noetic
First go to the folder where the
Dockerfile is, then use docker use docker built command with the desired name tag.
cd BehaviorMetrics/.docker/noetic/ docker build -t any-tag-you-want .
From here you are to good to go to the Quick Start guide!