ros-drivers / openni_camera

A ROS driver for OpenNI depth (+ RGB) cameras.
49 stars 60 forks source link

OpenNI Driver fails to set USB interface after update to 1.8.9 #18

Open robevans opened 11 years ago

robevans commented 11 years ago

When using an Asus or PrimeSense depth camera, ros_groovy_openni_camera 1.8.9 "fails to set USB interface" and crashes, before continually relaunching unsuccessfully.

The depth cameras work properly with NiViewer.

Reverting to 1.8.8 fixed the problem.

jonbinney commented 11 years ago

Looks like there have been a bunch of commits between 1.8.8 and 1.8.9; not sure which of them might have caused this. Might help if you could download openni_camera from source and try to narrow down which commit caused the error.

robevans commented 11 years ago

The commit on June 1st works, but the commit on June 20th does not.

Attached is the output when I use the June 20th code: http://pastebin.com/quhg534e

jonbinney commented 11 years ago

In that case the problem started after merging this pull request: https://github.com/ros-drivers/openni_camera/pull/16

It worked in my testing (with an asus xtion). @forouher, any ideas what might cause this?

forouher commented 11 years ago

I've found another place where strings from within openni are overwritten. It is a longshot, but you might want to give this a try (i can't test this myself at the moment; however it looks sufficiently simple that it should at least compile ;)

https://github.com/forouher/openni_camera/commits/asus-serial

Failing that, a backtrace from the nodelet manager might help.

robevans commented 11 years ago

@forouher I tried your new commit - afraid it still doesn't work for me (it does compile though!). Perhaps it's worth mentioning that I'm using Ubuntu 12.04. I'm not sure how to produce a backtrace from the nodelet manager...?

forouher commented 11 years ago

(this assumes you're starting the driver using "roslaunch openni_launch openni.launch")

Open openni_launch/launch/openni.launch

change

to

This should open a terminal with the gdb prompt waiting for your input (you may have to install the ubuntu package "xterm").

You have to enter

run

to actually start execution (see https://wiki.debian.org/HowToGetABacktrace for more detailed explanation).

If I've read your log messages correctly, it should crash at some point after that. Once it crashes, gdb will again show you a prompt.

Now you can ask gdb to provide you with an backtrace using the following command:

thread apply all bt

Please post everything gdb has printed out starting after you've entered "run".

cheers Dariush

On 07/08/13 11:37, robevans wrote:

@forouher https://github.com/forouher I tried your new commit - afraid it still doesn't work for me (it does compile though!). Perhaps it's worth mentioning that I'm using Ubuntu 12.04. I'm not sure how to produce a backtrace from the nodelet manager...?

— Reply to this email directly or view it on GitHub https://github.com/ros-drivers/openni_camera/issues/18#issuecomment-22239933.

robevans commented 11 years ago

Here it is, a backtrace from "roslaunch openni_launch openni.launch" with your latest commit:

(gdb) run
Starting program: /opt/ros/groovy/lib/nodelet/nodelet manager __name:=camera_nodelet_manager __log:=/home/robert/.ros/log/5625e050-0046-11e3-b85b-b8ca3a7c336a/camera_nodelet_manager-2.log
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffefa18700 (LWP 14910)]
[New Thread 0x7fffef217700 (LWP 14911)]
[New Thread 0x7fffe7fff700 (LWP 14912)]
[New Thread 0x7fffeea16700 (LWP 14917)]
[New Thread 0x7fffee215700 (LWP 14920)]
[New Thread 0x7fffeda14700 (LWP 14922)]
[New Thread 0x7fffed213700 (LWP 14924)]
[New Thread 0x7fffeca12700 (LWP 14926)]
[New Thread 0x7fffe77fe700 (LWP 14928)]
[New Thread 0x7fffe6ffd700 (LWP 14931)]
[New Thread 0x7fffe67fc700 (LWP 14934)]
[New Thread 0x7fffe5ffb700 (LWP 14938)]
[New Thread 0x7fffe57fa700 (LWP 14940)]
[ INFO] [1375978791.398741124]: Initializing nodelet with 8 worker threads.
[New Thread 0x7fffe4ff9700 (LWP 14947)]
[New Thread 0x7fffabfff700 (LWP 15009)]
Warning: USB events thread - failed to set priority. This might cause loss of data...
[Thread 0x7fffabfff700 (LWP 15009) exited]
[New Thread 0x7fffabfff700 (LWP 15015)]
[Thread 0x7fffabfff700 (LWP 15015) exited]
terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /home/robert/repos/PointOfPresence/mapping/src/openni_camera/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorV2/5.1.2.1: Failed to set USB interface!

Program received signal SIGABRT, Aborted.
0x00007ffff60c2425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) thread apply all bt

Thread 15 (Thread 0x7fffe4ff9700 (LWP 14947)):
#0  0x00007ffff710f0fc in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff6e65b4b in bool boost::condition_variable::timed_wait<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> >(boost::unique_lockboost::mutex&, boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> const&) () from /opt/ros/groovy/lib/libroscpp.so
#2  0x00007ffff6e634f9 in ros::CallbackQueue::callAvailable(ros::WallDuration)
    () from /opt/ros/groovy/lib/libroscpp.so
#3  0x00007ffff6eb21d6 in ros::AsyncSpinnerImpl::threadFunc() ()
   from /opt/ros/groovy/lib/libroscpp.so
#4  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#5  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 14 (Thread 0x7fffe57fa700 (LWP 14940)):
#0  0x00007ffff710ed82 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(no---Type <return> to continue, or q <return> to quit---
delet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 13 (Thread 0x7fffe5ffb700 (LWP 14938)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 12 (Thread 0x7fffe67fc700 (LWP 14934)):
---Type <return> to continue, or q <return> to quit---
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 11 (Thread 0x7fffe6ffd700 (LWP 14931)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
---Type <return> to continue, or q <return> to quit---
#5  0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7fffe77fe700 (LWP 14928)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x7fffeca12700 (LWP 14926)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
---Type <return> to continue, or q <return> to quit---
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7fffed213700 (LWP 14924)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7fffeda14700 (LWP 14922)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc1592 in nodelet::detail::CallbackQueueManager::workerThread(nodelet::detail::CallbackQueueManager::ThreadInfo*) ()
---Type <return> to continue, or q <return> to quit---
   from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7fffee215700 (LWP 14920)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff7bc22c2 in nodelet::detail::CallbackQueueManager::managerThread() () from /opt/ros/groovy/lib/libnodeletlib.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7fffeea16700 (LWP 14917)):
#0  0x00007ffff710f0fe in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
---Type <return> to continue, or q <return> to quit---
#1  0x00007ffff6e65b4b in bool boost::condition_variable::timed_wait<boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> >(boost::unique_lockboost::mutex&, boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000l> const&) () from /opt/ros/groovy/lib/libroscpp.so
#2  0x00007ffff6e634f9 in ros::CallbackQueue::callAvailable(ros::WallDuration)
    () from /opt/ros/groovy/lib/libroscpp.so
#3  0x00007ffff6e9769e in ros::internalCallbackQueueThreadFunc() ()
   from /opt/ros/groovy/lib/libroscpp.so
#4  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#5  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fffe7fff700 (LWP 14912)):
#0  0x00007ffff710ed84 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007ffff6e92852 in ros::ROSOutAppender::logThread() ()
   from /opt/ros/groovy/lib/libroscpp.so
#2  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#3  0x00007ffff710ae9a in start_thread ()
---Type <return> to continue, or q <return> to quit---
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fffef217700 (LWP 14911)):
#0  0x00007ffff6179033 in select () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff696c2b6 in XmlRpc::XmlRpcDispatch::work(double) ()
   from /opt/ros/groovy/lib/libxmlrpcpp.so
#2  0x00007ffff6e3bd37 in ros::XMLRPCManager::serverThreadFunc() ()
   from /opt/ros/groovy/lib/libroscpp.so
#3  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#4  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fffefa18700 (LWP 14910)):
#0  0x00007ffff6174313 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6e47876 in ros::poll_sockets(pollfd*, unsigned long, int) ()
   from /opt/ros/groovy/lib/libroscpp.so
#2  0x00007ffff6eb8bca in ros::PollSet::update(int) ()
   from /opt/ros/groovy/lib/libroscpp.so
---Type <return> to continue, or q <return> to quit---
#3  0x00007ffff6e56004 in ros::PollManager::threadFunc() ()
   from /opt/ros/groovy/lib/libroscpp.so
#4  0x00007ffff5c7bce9 in thread_proxy ()
   from /usr/lib/libboost_thread.so.1.46.1
#5  0x00007ffff710ae9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007ffff617fccd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fc4780 (LWP 14640)):
#0  0x00007ffff60c2425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff60c5b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff671869d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff6716846 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff6716873 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff6716886 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff67164c0 in __cxa_call_unexpected ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007fffb252a581 in openni_wrapper::OpenNIDriver::updateDeviceList() ()
   from /home/robert/repos/PointOfPresence/mapping/devel/lib/libopenni_driver.so
---Type <return> to continue, or q <return> to quit---
#8  0x00007fffb281ee2e in openni_camera::DriverNodelet::setupDevice() ()
   from /home/robert/repos/PointOfPresence/mapping/devel/lib//libopenni_nodelet.so
#9  0x00007fffb281ca34 in openni_camera::DriverNodelet::onInit() ()
   from /home/robert/repos/PointOfPresence/mapping/devel/lib//libopenni_nodelet.so
#10 0x00007ffff7ba8ac1 in nodelet::Nodelet::init(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::vector<std::string, std::allocator<std::string> > const&, ros::CallbackQueueInterface_, ros::CallbackQueueInterface_)
    () from /opt/ros/groovy/lib/libnodeletlib.so
#11 0x00007ffff7baa1f6 in nodelet::Loader::load(std::string const&, std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::vector<std::string, std::allocator<std::string> > const&) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
#12 0x00007ffff7bb42fc in nodelet::LoaderROS::serviceLoad(nodelet::NodeletLoadRequest_std::allocator<void >&, nodelet::NodeletLoadResponse_std::allocator<void >&) () from /opt/ros/groovy/lib/libnodeletlib.so
#13 0x00007ffff7bbf636 in ros::ServiceCallbackHelperTros::ServiceSpec<nodelet::NodeletLoadRequest_<std::allocator<void >, nodelet::NodeletLoadResponse_std::allocator<void > > >::call(ros::ServiceCallbackHelperCallParams&) ()
   from /opt/ros/groovy/lib/libnodeletlib.so
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff6e23c28 in ros::ServiceCallback::call() ()
   from /opt/ros/groovy/lib/libroscpp.so
#15 0x00007ffff6e618f9 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS_) () from /opt/ros/groovy/lib/libroscpp.so
#16 0x00007ffff6e633bb in ros::CallbackQueue::callAvailable(ros::WallDuration)
    () from /opt/ros/groovy/lib/libroscpp.so
#17 0x00007ffff6eb2958 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue_)
    () from /opt/ros/groovy/lib/libroscpp.so
#18 0x00007ffff6e9792b in ros::spin() () from /opt/ros/groovy/lib/libroscpp.so
#19 0x0000000000404ad8 in main ()
(gdb) 
forouher commented 11 years ago

Hi,

sorry, but I still cannot identify the problem. I just tried to reproduce the problem with 1.8.9 upstream, but (un)fortunately it works on my machine. And neither backtrace nor the debug infos are giving away any clues.

My best guess is that querying the serial number at that time/place is violating some interface semantics of libopenni. Alas, I don't have time at the moment to search the openni docs and figure out exactly what I did wrong.

As stability is probably more important than serial numbers, I can only suggest to revert the patches until someone with more in-depth knowledge of libopenni finds some time to look into it.

Apologies, Dariush

andrew-ang commented 11 years ago

Hi,

I'm facing this problem too. I currently have 1.8.9 at the moment, installed using "sudo apt-get install ros-groovy-openni-camera". How can I go about reverting to the older version 1.8.8, so that I won't encounter this problem?

jonbinney commented 11 years ago

If you want to use 1.8.8 I think you'll need to compile from source right now. I plan to roll back to 1.8.8 and do a release in a couple of days.

andrew-ang commented 11 years ago

I tried to compile the code for 1.8.8, but I'm getting a fatal error saying that XnCppWrapper.h is not found, at line 46 of openni_camera/include/openni_camera/openni_device.h. I have the file XnCppWrapper.h located in /usr/local/include/ni, which is the default location. Do you know how I can go about fixing this?

jonbinney commented 11 years ago

I just tried compiling and it worked for me (on ros Groovy, ubuntu 12.04, on a 64 bit machine). I see XnCppWrapper.h in /usr/include/ni (not /usr/local). That file comes from the deb libopenni-dev. How did you install the openni libs?

You should be able to get all the dependencies by doing

 rosdep install --from-path <path to openni_camera source>
jonbinney commented 11 years ago

@andrew-ang when you get it to compile, can you try using the rollback_usb branch and verify that it works for you? I've reverted the commits that were causing the segfault (I think). I've also created a a branch of hydro-devel with those commits fixed called rollback_usb_hydro. As soon as I get confirmation that it fixes the crash people are seeing, I'll merge these branches into groovy-devel and hydro-devel, respectively, and do a release.

andrew-ang commented 11 years ago

@jonbinney I installed openni from here: http://www.openni.org/openni-sdk/openni-sdk-history-2/. I downloaded the SDK v1.5.4 and the driver v5.1.2.1, untarred them, and then ran their install scripts. I just tried using the rosdep command you suggested, but it doesn't help; I'm still getting the error saying that XnCppWrapper.h can't be found. I just checked the OpenNI v1.5.4 install script: in line 76, the include files are copied to/usr/local/include/ni. I'm running ROS Groovy on Ubuntu 12.10, on a 32-bit machine. I got the v1.8.8 openni_camera source from here: https://github.com/ros-drivers/openni_camera/tree/ee00cb1cac2a60d4023eeda0ecb6c5e59f36a6af

jonbinney commented 11 years ago

@andrew-ang the version of the openni library in the ROS repostories is not the same as the one from openni.org. It's been modified. I suspect that you need to remove the one you have from source (the stuff in /usr/local/ni), and install openni debs using:

sudo apt-get install libopenni-dev libopenni-sensor-primesense-dev

If that doesn't work, please post the output of the following commands:

dpkg -l|grep openni
rosdep install --from-path <openni_camera path> -s --reinstall
env|grep ros
andrew-ang commented 11 years ago

@jonbinney It compiles now! But, how do I install openni_launch to test if the problem is solved? When I try to do sudo apt-get install ros-groovy-openni-launch, it tells me that extra packages will be installed: ros-groovy-openni-camera. Won't the two openni_camera packages conflict? EDIT: should I install openni_launch from source? If so, should I install the latest version?

andrew-ang commented 11 years ago

@jonbinney I installed openni_launch from source and tried to run roslaunch openni_launch openni.launch and got the following output:

$ roslaunch openni_launch openni.launch
... logging to /home/andrew/.ros/log/c8583f10-1397-11e3-b470-002170092c68/roslaunch-Andrew-Ubuntu-31987.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://Andrew-Ubuntu:41943/

SUMMARY
========

PARAMETERS
 * /camera/depth/rectify_depth/interpolation
 * /camera/depth_registered/rectify_depth/interpolation
 * /camera/disparity_depth/max_range
 * /camera/disparity_depth/min_range
 * /camera/disparity_depth_registered/max_range
 * /camera/disparity_depth_registered/min_range
 * /camera/driver/depth_camera_info_url
 * /camera/driver/depth_frame_id
 * /camera/driver/depth_registration
 * /camera/driver/device_id
 * /camera/driver/rgb_camera_info_url
 * /camera/driver/rgb_frame_id
 * /rosdistro
 * /rosversion

NODES
  /camera/depth/
    metric (nodelet/nodelet)
    metric_rect (nodelet/nodelet)
    points (nodelet/nodelet)
    rectify_depth (nodelet/nodelet)
  /camera/rgb/
    debayer (nodelet/nodelet)
    rectify_color (nodelet/nodelet)
    rectify_mono (nodelet/nodelet)
  /
    camera_base_link (tf/static_transform_publisher)
    camera_base_link1 (tf/static_transform_publisher)
    camera_base_link2 (tf/static_transform_publisher)
    camera_base_link3 (tf/static_transform_publisher)
    camera_nodelet_manager (nodelet/nodelet)
  /camera/
    disparity_depth (nodelet/nodelet)
    disparity_depth_registered (nodelet/nodelet)
    driver (nodelet/nodelet)
    points_xyzrgb_depth_rgb (nodelet/nodelet)
    register_depth_rgb (nodelet/nodelet)
  /camera/ir/
    rectify_ir (nodelet/nodelet)
  /camera/depth_registered/
    metric (nodelet/nodelet)
    metric_rect (nodelet/nodelet)
    rectify_depth (nodelet/nodelet)

auto-starting new master
process[master]: started with pid [32001]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to c8583f10-1397-11e3-b470-002170092c68
process[rosout-1]: started with pid [32014]
started core service [/rosout]
process[camera_nodelet_manager-2]: started with pid [32026]
process[camera/driver-3]: started with pid [32027]
[ INFO] [1378102838.141970432]: Initializing nodelet with 2 worker threads.
process[camera/rgb/debayer-4]: started with pid [32068]
process[camera/rgb/rectify_mono-5]: started with pid [32085]
process[camera/rgb/rectify_color-6]: started with pid [32107]
process[camera/ir/rectify_ir-7]: started with pid [32129]
process[camera/depth/rectify_depth-8]: started with pid [32143]
process[camera/depth/metric_rect-9]: started with pid [32165]
process[camera/depth/metric-10]: started with pid [32187]
process[camera/depth/points-11]: started with pid [32213]
process[camera/register_depth_rgb-12]: started with pid [32229]
process[camera/depth_registered/rectify_depth-13]: started with pid [32265]
process[camera/depth_registered/metric_rect-14]: started with pid [32283]
Warning: USB events thread - failed to set priority. This might cause loss of data...
process[camera/depth_registered/metric-15]: started with pid [32314]
process[camera/points_xyzrgb_depth_rgb-16]: started with pid [32331]
Warning: USB events thread - failed to set priority. This might cause loss of data...
process[camera/disparity_depth-17]: started with pid [32357]
process[camera/disparity_depth_registered-18]: started with pid [32420]
process[camera_base_link-19]: started with pid [32438]
[ INFO] [1378102839.231819531]: Number devices connected: 1
[ INFO] [1378102839.232027327]: 1. device on bus 001:24 is a PrimeSense Device (601) from PrimeSense (1d27) with serial id ''
[ INFO] [1378102839.242844439]: Searching for device with index = 1
[ INFO] [1378102839.259559885]: No matching device found.... waiting for devices. Reason: openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @ /home/andrew/catkin_ws/src/openni_camera-ee00cb1cac2a60d4023eeda0ecb6c5e59f36a6af/src/openni_device.cpp @ 61 : creating depth generator failed. Reason: Xiron OS failed to wait on event!
process[camera_base_link1-20]: started with pid [32462]
process[camera_base_link2-21]: started with pid [32488]
process[camera_base_link3-22]: started with pid [32505]
[ERROR] [1378102841.621315136]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressedDepth/set_parameters]
[ERROR] [1378102841.674425340]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/compressed/set_parameters]
[ERROR] [1378102841.777464065]: Tried to advertise a service that is already advertised in this node [/camera/depth_registered/image_rect_raw/theora/set_parameters]
terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /home/andrew/catkin_ws/src/openni_camera-ee00cb1cac2a60d4023eeda0ecb6c5e59f36a6af/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorV2/5.1.2.1: Failed to set USB interface!

[camera_nodelet_manager-2] process has died [pid 32026, exit code -6, cmd /opt/ros/groovy/lib/nodelet/nodelet manager __name:=camera_nodelet_manager __log:=/home/andrew/.ros/log/c8583f10-1397-11e3-b470-002170092c68/camera_nodelet_manager-2.log].
log file: /home/andrew/.ros/log/c8583f10-1397-11e3-b470-002170092c68/camera_nodelet_manager-2*.log

Seems like the error about setting USB interface still persists, and there's another issue about the depth generator

jonbinney commented 11 years ago

It shouldn't matter whether you use openni_launch from source or from debs; this looks like a problem with openni_camera itself. And it also should matter if you install the openni_camera debs - as long as you source devel/setup.bash, rosrun will first look for things in your local catkin workspace (the stuff you compiled from source).

You switched to the rollback_usb branch before compiling, right? It shouldn't matter, but can you try running openni_camera directly by doing ./devel/lib/openni_camera/openni_node?

@robevans could you also try the rollback_usb branch from source and see if it fixes the problem on your hardware?

georgebrindeiro commented 11 years ago

I think I am having the same problem as everyone else. I am quite convinced the issue is with 32-bit machines, since everything works fine on my 64-bit desktop but not on my 32-bit robots! Using Fuerte (whose openni_camera version is < 1.8.9) works for me, but not Groovy or Hydro. I'm going to try to compile from source and see what happens!

EDIT: Using Fuerte used to work. I should note that I uninstalled all OpenNI packages and reinstalled through apt-get, so I probably had a working Fuerte distro because it wasn't updated. Now I keep getting this message in all ROS distros (which I believe is completely unrelated to the issue at hand, but I'm pasting here just in case):

terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /tmp/buildd/ros-fuerte-openni-camera-1.8.6/debian/ros-fuerte-openni-camera/opt/ros/fuerte/stacks/openni_camera/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:
Image: PrimeSense/SensorV2/5.1.0.41: Got a timeout while waiting for a network command to complete!
andrew-ang commented 11 years ago

@jonbinney Apologies, the output I previously produced was NOT the rollback_usb branch; it was the code I checked out labelled 1.8.8: https://github.com/ros-drivers/openni_camera/tree/ee00cb1cac2a60d4023eeda0ecb6c5e59f36a6af. But in any case, I checked out rollback_usb, and it seems like the output is the same. I'll paste it here just in case:

$ roslaunch openni_launch openni.launch 
... logging to /home/andrew/.ros/log/2906e502-1436-11e3-912a-002170092c68/roslaunch-Andrew-Ubuntu-13450.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://Andrew-Ubuntu:50090/

SUMMARY
========

PARAMETERS
 * /camera/depth/rectify_depth/interpolation
 * /camera/depth_registered/rectify_depth/interpolation
 * /camera/disparity_depth/max_range
 * /camera/disparity_depth/min_range
 * /camera/disparity_depth_registered/max_range
 * /camera/disparity_depth_registered/min_range
 * /camera/driver/depth_camera_info_url
 * /camera/driver/depth_frame_id
 * /camera/driver/depth_registration
 * /camera/driver/device_id
 * /camera/driver/rgb_camera_info_url
 * /camera/driver/rgb_frame_id
 * /rosdistro
 * /rosversion

NODES
  /camera/depth/
    metric (nodelet/nodelet)
    metric_rect (nodelet/nodelet)
    points (nodelet/nodelet)
    rectify_depth (nodelet/nodelet)
  /camera/rgb/
    debayer (nodelet/nodelet)
    rectify_color (nodelet/nodelet)
    rectify_mono (nodelet/nodelet)
  /
    camera_base_link (tf/static_transform_publisher)
    camera_base_link1 (tf/static_transform_publisher)
    camera_base_link2 (tf/static_transform_publisher)
    camera_base_link3 (tf/static_transform_publisher)
    camera_nodelet_manager (nodelet/nodelet)
  /camera/
    disparity_depth (nodelet/nodelet)
    disparity_depth_registered (nodelet/nodelet)
    driver (nodelet/nodelet)
    points_xyzrgb_depth_rgb (nodelet/nodelet)
    register_depth_rgb (nodelet/nodelet)
  /camera/ir/
    rectify_ir (nodelet/nodelet)
  /camera/depth_registered/
    metric (nodelet/nodelet)
    metric_rect (nodelet/nodelet)
    rectify_depth (nodelet/nodelet)

auto-starting new master
process[master]: started with pid [13464]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 2906e502-1436-11e3-912a-002170092c68
process[rosout-1]: started with pid [13477]
started core service [/rosout]
process[camera_nodelet_manager-2]: started with pid [13489]
process[camera/driver-3]: started with pid [13497]
[ INFO] [1378170860.781973780]: Initializing nodelet with 2 worker threads.
process[camera/rgb/debayer-4]: started with pid [13530]
Warning: USB events thread - failed to set priority. This might cause loss of data...
process[camera/rgb/rectify_mono-5]: started with pid [13544]
process[camera/rgb/rectify_color-6]: started with pid [13560]
process[camera/ir/rectify_ir-7]: started with pid [13574]
process[camera/depth/rectify_depth-8]: started with pid [13588]
process[camera/depth/metric_rect-9]: started with pid [13602]
process[camera/depth/metric-10]: started with pid [13616]
process[camera/depth/points-11]: started with pid [13630]
process[camera/register_depth_rgb-12]: started with pid [13644]
process[camera/depth_registered/rectify_depth-13]: started with pid [13658]
process[camera/depth_registered/metric_rect-14]: started with pid [13672]
process[camera/depth_registered/metric-15]: started with pid [13686]
process[camera/points_xyzrgb_depth_rgb-16]: started with pid [13700]
process[camera/disparity_depth-17]: started with pid [13714]
process[camera/disparity_depth_registered-18]: started with pid [13728]
process[camera_base_link-19]: started with pid [13742]
process[camera_base_link1-20]: started with pid [13754]
process[camera_base_link2-21]: started with pid [13766]
process[camera_base_link3-22]: started with pid [13778]
Warning: USB events thread - failed to set priority. This might cause loss of data...
[ INFO] [1378170862.149517344]: Number devices connected: 1
[ INFO] [1378170862.150040784]: 1. device on bus 001:26 is a PrimeSense Device (601) from PrimeSense (1d27) with serial id ''
[ INFO] [1378170862.151476872]: Searching for device with index = 1
[ INFO] [1378170862.154351892]: No matching device found.... waiting for devices. Reason: openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @ /home/andrew/catkin_ws/src/openni_camera-rollback_usb/src/openni_device.cpp @ 61 : creating depth generator failed. Reason: Xiron OS failed to wait on event!
terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /home/andrew/catkin_ws/src/openni_camera-rollback_usb/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorV2/5.1.2.1: Failed to set USB interface!

[camera_nodelet_manager-2] process has died [pid 13489, exit code -6, cmd /opt/ros/groovy/lib/nodelet/nodelet manager __name:=camera_nodelet_manager __log:=/home/andrew/.ros/log/2906e502-1436-11e3-912a-002170092c68/camera_nodelet_manager-2.log].
log file: /home/andrew/.ros/log/2906e502-1436-11e3-912a-002170092c68/camera_nodelet_manager-2*.log

And, when using ./devel/lib/openni_camera/openni_node, the output is as follows:

$ ./devel/lib/openni_camera/openni_node
[ INFO] [1378170945.820775602]: Initializing nodelet with 2 worker threads.
Warning: USB events thread - failed to set priority. This might cause loss of data...
Warning: USB events thread - failed to set priority. This might cause loss of data...
[ INFO] [1378170946.156520514]: Number devices connected: 1
[ INFO] [1378170946.156780614]: 1. device on bus 001:26 is a PrimeSense Device (601) from PrimeSense (1d27) with serial id ''
[ WARN] [1378170946.157630358]: ~device_id is not set! Using first device.
[ INFO] [1378170946.162223908]: No matching device found.... waiting for devices. Reason: openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @ /home/andrew/catkin_ws/src/openni_camera-rollback_usb/src/openni_device.cpp @ 61 : creating depth generator failed. Reason: Xiron OS failed to wait on event!
Warning: USB events thread - failed to set priority. This might cause loss of data...

This error repeats for about 5 - 10 seconds until

terminate called after throwing an instance of 'openni_wrapper::OpenNIException'
  what():  unsigned int openni_wrapper::OpenNIDriver::updateDeviceList() @ /home/andrew/catkin_ws/src/openni_camera-ee00cb1cac2a60d4023eeda0ecb6c5e59f36a6af/src/openni_driver.cpp @ 125 : enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorV2/5.1.2.1: Failed to set USB interface!

Aborted (core dumped)
robevans commented 11 years ago

@jonbinney the rollback_usb branch works for me.

andrew-ang commented 11 years ago

@robevans are you running on a 32-bit or a 64-bit machine? Can you describe your development environment and installation process please?

robevans commented 11 years ago

@andrew-ang I'm running 64-bit Ubuntu 12.04, and I originally installed ros-groovy-desktop-full from this tutorial: http://wiki.ros.org/groovy/Installation/Ubuntu

I have a catkin workspace (this tutorial covers how to make one: http://wiki.ros.org/catkin/Tutorials/create_a_workspace). In my ~/.bashrc file I added the workspace to my ROS_PACKAGE_PATH (by appending export ROS_PACKAGE_PATH=~/catkin_ws:$ROS_PACKAGE_PATH to my .bashc) and sourced the workspace (source ~/catkin_ws/devel/setup.bash in my .bashrc). I source it after I source /opt/ros/groovy/setup.bash in my .bashrc.

The workspace has a src folder in which I have cloned the repo (git clone https://github.com/ros-drivers/openni_camera.git). I have version 1.8.8 checked out which works for me (git checkout 1.8.8). I then run catkin_make from the root of the workspace.

Finally I launch a new terminal and run (for example) roslaunch openni_launch openni.launch.

andrew-ang commented 10 years ago

I had a new install of Ubuntu 12.10 on a new machine, and 1.8.8/rollback_usb worked. I don't know whats wrong with my first machine though, it just didn't work.

kai-chen-ustc commented 10 years ago

I have the same issue, here is the detailed description of the problem: http://answers.ros.org/question/105296/primesense-carmine-not-working-under-groovy-but-works-in-fuerte/

130s commented 7 years ago

@jonbinney Looks like multiple persons confirmed at that time that rollback_usb branch solves the issue. If you remember, was there any reason why that branch didn't get merged into the devel branches?

I just pulled the changed in that branch into indigo-devel and opened a PR #52.

jonbinney commented 7 years ago

@130s I don't remember any specific reason for not merging this (it was a while ago). Most likely I just didn't have any time back then, judging from when it was.