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

Exposing IR emitter properties through ROS? #29

Open mklingen opened 9 years ago

mklingen commented 9 years ago

I wonder if it might be possible to expose some of the openni2 emitter properties through ROS in some way? In particular, it would be nice to be able to turn the emitter on and off using a service call which wraps

Device.setProperty(XN_MODULE_PROPERTY_EMITTER_STATE,(XnUInt64)(TRUE/FALSE));

I was just wondering if it made much sense considering most of the other properties of this kind are set using the ini file -- but apparently since openni2, they have been made directly accessible.

mikeferguson commented 9 years ago

Probably possible, pull requests welcome.

NikolasE commented 6 years ago

I tried to implement the feature, but I get an exception if I try to set the state:

void OpenNI2Device::setEmitterState(bool enable) throw (OpenNI2Exception)
{
  const openni::Status rc = openni_device_->setProperty(XN_MODULE_PROPERTY_EMITTER_STATE, enable);
  if (rc != openni::STATUS_OK)
    THROW_OPENNI_EXCEPTION("Couldn't set emitter state to %i: \n%s\n", enable, openni::OpenNI::getExtendedError());
}
Failed to set property 1080e007: Device Protocol: Unsupported opcode!
Device.setProperty(1080e007) failed

Any ideas?

// device_->startDepthStream() / stopDepthStream toggle the emitter,