1. VISP installation
0. Preparations Basic installation
Before building and installing ViSP from source, you need to install GNU g++ compiler, CMake, git and subversion.
sudo apt-get install build-essential cmake-curses-gui git subversion wget
1. Create a workspace
First create a workspace that will contain all ViSP source code, datasets and optional 3rd parties. This workspace is set here to the $HOME/visp-ws folder, but can be set to any other location.
In a terminal, run:
echo "export VISP_WS=$HOME/visp-ws" >> ~/.bashrc
source ~/.bashrc
mkdir -p $VISP_WS
For systems below Ubuntu 18.04, execute the command:
sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev libzbar-dev libpthread-stubs0-dev libdc1394-22-dev
Ubuntu 20.04 or above or Debian 11, execute
sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev libzbar-dev libpthread-stubs0-dev libdc1394-dev
2. Get ViSP source code
cd $VISP_WS
git clone https://github.com/lagadic/visp.git
3. Create build folder and build ViSP
mkdir -p $VISP_WS/visp-build
cd $VISP_WS/visp-build
cmake ../visp
make -j4
4. Set the VISP_DIR environment variable
echo "export VISP_DIR=$VISP_WS/visp-build" >> ~/.bashrc
source ~/.bashrc
VISP installation has been completed
5. If you need to install VISP under the ubuntu system,
execute
cd $VISP_WS/visp-build
sudo make install
Second, install the third party
1. Install ur_rtde 3rd party
The ubuntu 18.04 system needs to upgrade the Cmake version, otherwise there will be compilation problems.
The ubuntu 20.4 system does not have this problem
1.1 ur_rtde build from source code
cd $VISP_WS && mkdir 3rdparty
cd $VISP_WS/3rdparty
git clone https://gitlab.com/sdurobotics/ur_rtde.git
mkdir ur_rtde/bulid
cd ur_rtde/build
cmake .. -DCMAKE_BUILD_TYPE=Release
make-j4
sudo make install
2. After ur_rtde is installed, rebuild ViSP to enable support for ur_rtde.
cd $VISP_WS/visp-build
cmake ../visp
3. Check if ur_rtde is detected by ViSP
cd $VISP_WS/visp-build
grep ur_rtde ViSP-third-party.txt
Use ur_rtde: yes (ver 1.5.4)
If Use ur_rtde: no it means no 3rd party detected. Need to set ur_rtde_DIR,
By setting an environment variable
export ur_rtde_DIR=$VISP_WS/3rdparty/ur_rtde/build/ur_rtde
cmake ../visp
or set a cmake var
cmake ../visp -Dur_rtde_DIR=$VISP_WS/3rdparty/ur_rtde/build/ur_rtde
2. Realsense SDK installation
Get librealsense from the network disk:
realsense SDK 2.5.0 file 1
The reason why I choose to download the custom SDK here is because I need to use ROS to call realsense for subsequent development. The currently downloaded SDK by default is version 2.5.1 and there is no corresponding ROS package support for the time being.
Unzip the downloaded SDK file and rename it to librealsense, and move the file to the folder shown in the figure below
cd $VISP_WS/librealsense
If the above problems are not considered, you can execute
1.librealsense to get from github
cd $VISP_WS
git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
2. Unplug the realsense camera
3. Install the udev rules located in the librealsense source directory:
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
4. Install the packages required for the librealsense build:
sudo apt-get install libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
5. Install distribution-specific packages:
sudo apt-get install libglfw3-dev (Ubuntu 16.04)
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev (Ubuntu 18.04)
6. Build and install librealsense
mkdir build
cd build
cmake .. -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
make -j4
sudo make install
7. Connect a Realsense SR300 or D400 series camera and check if images can be acquired Run:
./examples/capture/rs-capture
or execute
realsense-viewer
If you are able to visualize the image, it means librealsense is installed successfully.
3. Compile the third-party library into VISP
After the above third-party installation is complete, it needs to be recompiled
cd $VISP_WS/visp-build
cmake ../visp
make -j4