ROS
LIPS OpenNI2 SDK is fully compatible with ROS. In this article, we demonstrate how to use ROS wrapper to access 3D cameras and display pointcloud in Rviz viewer.
Prerequisite
Install OpenNI2 SDK
ROS Installation
we use Ubuntu 20.04 and ROS Noetic in the following tutorial. You can also find official install documentation here
Install ROS via apt
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install ros-noetic-desktop-full
Install dependencies
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-rosdep
Install some useful ROS packages (e.g. rviz viewer)
sudo apt-get install ros-noetic-rgbd-launch ros-noetic-image-view rviz
Before using any ROS command, some environment variables need to be setup. You can do that by executing
setup.bash
which ROS provide
source /opt/ros/noetic/setup.bash
Initialize ROS and install all ROS dependencies
sudo rosdep init
rosdep update
Using OpenNI2 ROS Wrapper
Create the workspace
mkdir -p ~/LIPSToF_ws/src
cd ~/LIPSToF_ws/src
catkin_init_workspace
Download LIPS ROS wrapper
cd ~/LIPSToF_ws/src
git clone https://github.com/lips-hci/openni2_camera
Run launch script
chose launch script according to your camera.
run_DL.sh
for DL
run_M3.sh
for M3
run_SL.sh
for L210/L215
cd ~/LIPSToF_ws
ln -s src/openni2_camera/run_DL.sh .
./run_DL.sh
Rviz Viewer
After camera topic is launched, You can now use Rviz viewer to see video streams or pointcloud.
Launch Rviz viewer in terminal
rviz
Set Fixed Frame from the Displays panel on the left panel to camera_link

Click Add on the bottom of Displays panel. Switch to By Topic tab, select /depth_registered > /points > PointCloud2. Then click OK.

Now you can see the pointcloud

Last updated