Kinect / Primesense (Xtion) ROS Ubuntu through Vir

2020-04-11 06:48发布

问题:

Since it took me quite some time to figure out how to get Xtion (Primesense) to work on VMware I thought to share it here with you. (with Kinect I have a problem to let ROS see the device even though VMware has successfully connected it).

roslaunch openni2_launch openni2.launch 

Running the above command gave me the error:

Warning: USB events thread - failed to set priority. This might cause loss of data...

I either got a single frame or no frame when running "rviz" and Add --> Image --> Image topic --> /camera/rgb/image_raw

So how do I get video frames in Ubuntu from a Primesense device while using a Virtual Machine (VMware)?

My specs

  • Windows 7 running VMware 10.0.4 build-2249910
  • Ubuntu 12.04.5 Precise in VMware
  • ROS Hydro

回答1:

The following question pointed me in the right direction: http://answers.ros.org/question/77651/asus-xtion-on-usb-30-ros-hydro-ubuntu-1210/?answer=143206#post-id-143206

In the answer of blizzardroi (not selected answer) he/she mentions that USBInterface should be 0. I reasoned that since my main Machine is Windows, I should set UsbInterface to 1, which indeed solved it.

Solution

Go to /etc/openni2/ (from system folder, not Home) and open PS1080.ini with administrator rights (e.g. sudo gedit PS1080.ini). Search for UsbInterface, remove the ; and change the value to 1. It should look like below:

; USB interface to be used. 0 - FW Default, 1 - ISO endpoints (default on Windows), 2 - BULK endpoints (default on Linux/Mac/Android machines)
UsbInterface=1

Additional

From previous experience it may also be related that your Windows system may need the kinect drivers as well. If the above not works, try to install the following:

  • (Kinect SDK) https://www.microsoft.com/en-us/download/details.aspx?id=34808
  • (OpenNI2 Windows) http://structure.io/openni

p.s. Don't forget your drivers for Ubuntu (replace hydro with your ROS version)

sudo apt-get install ros-hydro-openni*

Important

It doesn't solve the error below, but rviz returns video, which means that we can read the data the Primesense device publishes!

Warning: USB events thread - failed to set priority. This might cause loss of data...


回答2:

Got the same warning from opennni (issued at start by a binary located at Tools/PSLinkConsole) with another sensor.

Solved by starting process as sudo - my guess: to set priority to USB event threads you need root access. :)