Important First, follow the instructions for using stow for local installations.
Add the next line to your .bashrc file
export YARP_DATA_DIRS=${HOME}/local/share/yarp
Install dependencies via package manager (Los paquetes de libopencv son opcionales)
sudo apt install git libgraphviz-dev libace-dev libreadline6-dev libgtkmm-2.4-dev libopencv-highgui4.2 libopencv-core4.2 libopencv-dev cmake-curses-gui python-dev qt5-default qtmultimedia5-dev qtdeclarative5-dev qml-module-qtquick-dialogs qml-module-qt-labs-settings qml-module-qtmultimedia libopenmpi-dev qml-module-qt-labs-folderlistmodel libqcustomplot-dev ace libace-dev swig python python-dev
You will need CMake version 3.12 or above. Check your current version with the following command:
cmake --version
YCM is a new dependency for YARP developed by the same people. It is like a cmake extension for building complex projects.
cd ~/local/src
git clone https://github.com/robotology/ycm.git
cd ~/local/src/ycm
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/local/stow/ycm ../
make -j8
make install
cd ~/local/stow
stow ycm
These instructions are for a direct install. In case you want to use a Python Virtual Environment for YARP follow the respective instructions at the end of this page.
cd ~/local/src
git clone https://github.com/robotology/yarp.git
cd yarp
git checkout yarp-3.3 # In case you need python2.7
cd ~/local/src/yarp
mkdir build && cd build
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/local/stow/yarp -D YARP_COMPILE_BINDINGS=ON -D CREATE_PYTHON=ON -D YARP_USE_PYTHON_VERSION=$(echo $(python --version) | tr -d a-zA-Z[:blank:]) -D CREATE_YARPDATADUMPER=OFF -D CREATE_GUIS=ON -D ENABLE_yarpmod_opencv_grabber=ON YARP_COMPILE_yarpviz=ON ..
make -j10
make install
cd ~/local/stow
stow yarp
If you are a cool person who uses arch-linux, you can just use the AUR package:
yay -S yarp
As you can see, it is easier. So if youa re still in debian, consider passing to the dark side
yarpserver
yarpdev --verbose --device opencv_grabber
yarpview
yarp connect /grabber /yarpview/img:i
Using virtual environments is very useful for having your projects in isolated environments. To create a virtual environment go to the directory where you want to create it and then do (where venv_name
is the name that you want to use for the virtual environment) :
python3 -m venv <venv_name>
Now we are going to build the YARP python bindings inside the virtual environment, and then we are going to install them to the virtual environment. We will assume that you already installed the dependencies and YCM.
Lets export the virtual environment root directory, so that following the tutorial is easier:
export PYTHON_VENV_DIR=<python_venv_dir>
source ~/.bashrc
Now these are the instructions for cloning, compiling and isntalling the YARP python bindings inside the python virtual environment.
cd ${PYTHON_VENV_DIR}
source bin/activate
mkdir stow
mkdir src && cd src
git clone https://github.com/robotology/yarp.git
cd yarp
mkdir build && cd build
cmake -D CMAKE_INSTALL_PREFIX=${PYTHON_VENV_DIR}/stow/yarp -DYARP_COMPILE_BINDINGS=ON \
-DCREATE_PYTHON=ON -DYARP_COMPILE_yarpdatadumper=OFF -DYARP_COMPILE_GUIS=OFF ..
make -j10
make install
cd ${PYTHON_VENV_DIR}/stow
stow yarp
python -c "import yarp; buffer=yarp.BufferedPortBottle();"
We try to use the latest yarp version. So some programs may present issues if you stay with old versions. Here are the instructions to update with the same cmake options.
cd ~/local/stow && stow -D ycm && stow -D yarp
cd ~/local/src/ycm && git pull && cd build
make -j10 && make install
cd ~/local/stow && stow ycm
cd ~/local/src/yarp && git pull && cd build
make -j10 && make install
cd ~/local/stow && stow yarp
.