Ads by Google

Thursday, December 5, 2013

Kinect or AsusXtionPro does not (re)start under ROS: Solution

Have you noticed that Kinect or AsusXtionPro under ROS appears to have a stochastic behavior? In other words, do you have problem that sometimes you are able to launch the driver of the sensor but sometimes you cannot, although you have not changed anything in your system-environment? Then the following hint may come in very handy.

Solution

Here' s a quick thing you can try and see if you have any better chance after. The following command may cause NO new problems whatsoever, so try this in your terminal:

kill $(ps aux | grep Xn | awk '{print $2}')

This command will try to kill any processes with a name that includes "Xn", which in our case aims at killing XnSensorServer and XnVSceneServer that may run already and prevent ROS to take control of the sensor.

If you want to see whether you have already these two processes running you can try this:

ps aux | grep Xn

For example, in my terminal the output looked something like this:


If NONE of these two processes appear in your output while you are trying to use the sensor through ROS, then your problem is different and the solution proposed here will not apply to your case.

But if you DO see, one, or both of these processes already running, then if you kill these two processes with the first command that i gave in the beginning you can be sure that YOU WILL NOT GET the error message:

"....enumerating image nodes failed. Reason: One or more of the following nodes could not be enumerated:

Image: PrimeSense/SensorV2/(your_sensor_verison): Failed to set USB interface!..."

through ROS.

Now try to initiate the sensor through the ROS wrapper (roslaunch openni_launch openni_launch) and see if you are more lucky.


Note: i arrived to this solution by reading this post:

4 comments:

  1. Hi, i tried your method to solve the same problem. However, i noticed that the PID keep changing when i type ps aux | grep Xn. Following are the error message i got when i type in the command suggested:

    chao@chao-LIFEBOOK-AH532:~$ kill -9 $(ps aux | grep Xn | awk '{print $2}')
    bash: kill: (2881) - No such process
    chao@chao-LIFEBOOK-AH532:~$ ps aux | grep Xn
    chao 2884 0.0 0.0 13592 940 pts/0 S+ 14:20 0:00 grep --color=auto Xn
    chao@chao-LIFEBOOK-AH532:~$ kill -9 $(ps aux | grep Xn | awk '{print $2}')
    bash: kill: (2887) - No such process

    do you know what's wrong with it?

    ReplyDelete
    Replies
    1. Hello,

      I believe that there is nothing wrong from what you see. Once you run "ps aux | grep Xn", then it will always find the process "grep" that yourself run with arguments "Xn". So it is normal that you always see a process ... grep --color=auto Xn, with a different PID everytime, since you run a different "grep" every time.

      If you just run "ps aux | grep Xn", then it can list that process because its already running. But if you run after the "| awk '{print $2}' " then the "grep" process has finished, and so no more processes that are related to "Xn" are found.

      So, to conclude, in your case, it did not find any processes such as XnSensorServer or XnVScene_Server_1_5_2, and it did not kill anything neither.

      So, were you able eventually to start successfully the driver?


      Delete
    2. Hello,

      i have the same problem with Chao chien Liew, for my xtion pro live. I followed your instructions but nothing happened. I still get the message "Image: PrimeSense/SensorV2/5.1.0.41: Device is in safe mode. Cannot start any stream!".

      Any suggestions?

      Delete
    3. Hi,

      I have not encountered the error message that you quoted so i cannot give any advice in that case :-/. Are you trying to launch it from ROS, or independent of ROS through the binaries provided with the drivers?

      Delete

Spam messages will not be allowed publication.