Tips & FAQs

Cannot compile jsk_recognition because of “memory allocation error”

jsk_pcl_ros and jsk_perception requires much memory to be compiled because of PCL. On average, each cpp file requires 2.5GB memory to compile.

If your machine does not have enough memory, please use smaller number of CPUs to compile

catkin build -p1 -j1

How to install PCL from source?

Refer to script used on Travis:

#!/usr/bin/env bash

######################################################
# Install PCL 1.8
######################################################

if [ ! -e /usr/local/include/pcl-1.8/pcl/pcl_base.h ]; then
  cd /tmp

  version="1.8.0rc2"
  url="https://github.com/PointCloudLibrary/pcl/archive/pcl-${version}.tar.gz"
  fname=pcl-${version}.tar.gz

  wget $url -O $fname
  tar zxf $fname

  cd pcl-pcl-${version}
  mkdir build
  cd build
 
  # pcl::CropBox does not work properly in kinetic
  # with PCL_ENABLE_SSE:BOOL=TRUE flag
  # https://github.com/PointCloudLibrary/pcl/pull/1917 
  if [ $(lsb_release -c -s) = "xenial" ]; then
    cmake -DCMAKE_BUILD_TYPE=Release -DPCL_ENABLE_SSE:BOOL=FALSE ..
  else
    cmake -DCMAKE_BUILD_TYPE=Release ..
  fi
  make -j2
  sudo make -j2 install
fi


######################################################
# Setup dependencies to rebuild from source
######################################################
sudo -H pip install -q rosinstall_generator

rosinstall_generator --tar --rosdistro $ROS_DISTRO \
  pcl_conversions \
  pcl_ros \
  octomap_server \
>> /tmp/$$.rosinstall

cd ~/ros/ws_$REPOSITORY_NAME/src
wstool merge /tmp/$$.rosinstall
wstool up -j4

How to install OpenCV from source?

Refer to script used on Travis:

#!/usr/bin/env bash

######################################################
# Install OpenCV 3
######################################################
sudo -H apt-get install -y -q -qq ros-$ROS_DISTRO-opencv3


######################################################
# Setup dependencies to rebuild from source
######################################################
sudo -H pip install -q rosinstall_generator

rosinstall_generator --tar --rosdistro $ROS_DISTRO \
  cv_bridge \
  image_geometry \
  image_transport \
  image_view2 \
  jsk_data \
  jsk_topic_tools \
  opencv_apps \
>> /tmp/$$.rosinstall

cd ~/ros/ws_$REPOSITORY_NAME/src
wstool merge /tmp/$$.rosinstall
wstool up -j4

How to install OpenNI2?

By Apt

sudo apt-get install libopenni2-dev

From Source

sudo apt-get install g++
sudo apt-get install python
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libudev-dev
sudo apt-get install openjdk-6-jdk
sudo apt-get install freeglut3-dev
sudo apt-get install graphviz

git clone https://github.com/occipital/openni2
cd openni2
make
export PATH=$(pwd)/Bin/x64-Release:$PATH
export LD_LIBRARY_PATH=$(pwd)/Bin/x64-Release:$LD_LIBRARY_PATH

# need to build openni2_camera from source
cd ~/catkin_ws/src
git clone https://github.com/ros-drivers/openni2_camera.git
catkin build -iv

How to generate doc on local machine

roscd jsk_recognition
cd ../doc
source setup.sh
make html

Then you can see doc with _build/html/index.html