ros-drivers / openni2_camera

ROS wrapper for openni 2.0
http://wiki.ros.org/openni2_camera
BSD 3-Clause "New" or "Revised" License
56 stars 96 forks source link

Openni2 does not handle oni files #69

Open 130s opened 6 years ago

130s commented 6 years ago

Issue by rastaxe Tuesday Feb 23, 2016 at 08:37 GMT _Originally opened as https://github.com/ros-drivers/openni2_launch/issues/26_


I am not able to load a oni file (OpenNI record file) with openni2 in Indigo. In Hydro I was able to load it simply with: roslaunch openni2_launch openni2.launch device_id:=/path/to/your/file.oni but in Indigo openni2 still tries to open the real device. Do you have the same problem?

130s commented 6 years ago

Comment by mikeferguson Sunday Mar 06, 2016 at 10:04 GMT


I'm guessing it is due to this commit: https://github.com/ros-drivers/openni2_camera/commit/17c10725a3df469d9663e6f6ffd0bea5dbf2bf6d -- in the past it would have probably fallen through and returned the string name, now it returns the empty string -- you could try adding an extra case before the matching attempt which checks if the file ends with .oni and if so, returns the device_id as-is. If that works, we can gladly accept a PR to fix this regression.

130s commented 6 years ago

Comment by rastaxe Tuesday Mar 08, 2016 at 19:47 GMT


It worked! Thanks. I simply added this to line 682:

// check if device_id is a oni file
  else if( device_id.size() - device_id.rfind(".oni") == 4 ) {
    return device_id;
  }
130s commented 6 years ago

Comment by lianera Friday Apr 08, 2016 at 06:08 GMT


Same issue here, does anyone has a fixed fork?

130s commented 6 years ago

Comment by rastaxe Friday Apr 08, 2016 at 06:36 GMT


If you add the above two lines to line 682, it fixes the problem. I did a pull request on openni2_camera.

130s commented 6 years ago

Comment by lianera Friday Apr 08, 2016 at 07:10 GMT


@rastaxe problem solved, thanks a lot :+1: