Installing the Openni2_camera on the Raspberry Pi

Source: Internet
Author: User

In the previous article--Installing the ROS package on the Raspberry Pi, I joined openni2_camera and openni2_launch , if you follow my step by step, compile to a certain step, you will certainly encounter the compilation error, Haha, so I left a last article at the end of the sentence "How to predict the funeral , please listen to tell. "

The package that needs to be installed in the previous article needs to rely on OpenCV and OpenNi2, all of which involve images, and are definitely dependent on OpenCV openni2_camera OpenNi2 . rosdep The two dependencies are not resolved, so a compilation error occurs. It is therefore necessary to manually install libopencv andOpenNI2

Installing OPENCV

Because the package indigo-custom_ros.rosinstall containing the image processing is included, there is no OPENCV library and they cannot be compiled successfully. Compiling and installing on the Raspberry Pi OpenCV is said to take 10 hours, but we only need some library files, and the Raspbian repositories are:

sudo apt-get install libopencv-dev
Install OPENNI21. Compiling the installation

OpenNI2 Library Raspbian not in the software warehouse, installation will be a bit of trouble. First, install some dependencies:

sudo apt-get install git g++ make python libusb-1.0-0-dev libudev-dev pkg-config

Clone OpenNI2:

cd OpenNI2

To modify a ThirdParty/PSCommon/BuildSystem/Platform.Arm file:

$ vim ThirdParty/PSCommon/BuildSystem/Platform.Arm

Will

CFLAGS += -march=armv7-a -mtune=cortex-a#-mcpu=cortex-a8

Replace with:

CFLAGS += -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard

Then compile:

PLATFORM=Arm make

After the compilation is complete, install:

cd /Packaging/Linuxsudo ./install.sh

library include Copy to and from the system directory:

sudo cp -r Include /usr/include/openni2sudo cp -r Bin/Arm-Release/OpenNI2 /usr/lib/sudo cp Bin/Arm-Release/libOpenNI2.* /usr/lib/
2. Create a new .pcFile

Create a new package config file:

sudo vim /usr/lib/pkgconfig/libopenni2.pc

Fill in the following to configure the library settings that are required at compile time:

prefix=/usrexec_prefix=${prefix}libdir=${exec_prefix}/libincludedir=${prefix}for2.2.0.0Cflags: -I${includedir}Libs: -L${libdir}-lOpenNI2 -L${libdir}-l-l-lPS1080.so

With this file, pkg-config you can output the compiler, the parameters required by the linker, and the version information of the installed package. Check if it can be found correctly:

$ pkg-config --modversion libopenni2

If the version number is 2.2.0.0 , no problem.

3. Testing

Next, test whether the installation was successful. First, install CORE_SAMPLES , add in the Makefile last line:

core_samples: $(CORE_SAMPLES)

Compile:

PLATFORM=Arm make core_samples

Connect the xtion and run:

./Bin/Arm-Release/SimpleRead

If you can see the sensor data and the data is changing when the hand is swinging in front of the camera, the installation is successful.

Compile

Then go back to Workspace, compile and install:

sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo

Test the xtion in ROS:

$ roscore &$ roslaunch openni2_launch openni2.launch

See the /camera/rgb/image_raw topic, if you see a color image, the installation is successful!

Reference connection
    1. https://dobots.nl/2014/05/05/asus-xtion-using-openni2-and-ros-on-udoo/
    2. Installing ROS Indigo on Raspberry Pi
    3. Pkg-config

Installing the Openni2_camera on the Raspberry Pi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.