I have encountered a problem recently that can be described as : Root privilege is needed whenever a program needs kinect to run.
My tool chain setup is: ubuntu14 + ros indigo + opencv_2.4.11 + openni_1.5.7.10 + primesense_5.1.2.1 + kinect_v1
The phenomenons are as follows:
When I try to check out the kinect output through openni NiViewer, if I run NiViewer without 'sudo', I will get the following message
One or more of the following nodes could not be enumerated:
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
Press any key to continue . . .
But kinect functions normally once I add the 'sudo' to open NiViewer.
I try to run an opencv sample "openni_capture.cpp" in qt, during compiling, it shows error that permission denied when accessing libopenni.so, I check the properties of that file and it shows 'none' for users other than owner. So I give other users read-only access and compile went through. But when I run the built executable, it shows another error:
Can not open a capture object. CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate production trees: Can't create any node of the requested type!
until now I have the feeling that maybe everything related to kinect needs root privilege, so I navigate to the folder that contains the executable and manually run it with 'sudo', then kinect is working again.
I know I can avoid this problem by logging in as root(which is against by many people), but I really want to know what's going on. And I remember that before I install ROS, I didn't have to use 'sudo' to open NiViewer. Does ROS change the ubuntu system somehow and caused this, or is there other reason? THANKS!
This could be an access privileges problem and maybe to run in user mode, you need to add yourself to the UNIX ‘video’ group (see this explanation)
sudo adduser $USER video
Then log out and back in. Reboot is not necessary, just plug cycle the Kinect (if already connected, unplug and plug back in), and retry. Hope it helps !