ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One ROS runtime work around (at least it works in Openni2) is this in the next order (ideally in your Class constructor, or end of you :

void StreamingClass::~StreamingClass()
{
    ros::spinOnce();
    /// close streaming
    if (color_video_stream_.isValid() == true)
      color_video_stream_.stop();
    if (depth_video_stream_.isValid() == true)
       depth_video_stream_.stop();

     /// detroy video streaming objects as good practice,
     if (color_video_stream_.isValid() == true)
        color_video_stream_.destroy();
     if (depth_video_stream_.isValid() == true)
        depth_video_stream_.destroy();

     if (camera_device_.isValid() == true)
       camera_device_.close();
     nite::NiTE::shutdown();
     openni::OpenNI::shutdown();
}

Do it in that order, and that should take care of the problem, and will always shutdown the camera software. One thing though, if your camera nodelet had crashed right before trying this code, then unplug and plug the camera back in. Or better yet, restart your computer!!!!

One ROS runtime work around (at least it works in Openni2) is this in the next order (ideally in your Class constructor, destructor, or at the end of you your main function before the program ends :

void StreamingClass::~StreamingClass()
{
    ros::spinOnce();
    /// close streaming
    if (color_video_stream_.isValid() == true)
      color_video_stream_.stop();
    if (depth_video_stream_.isValid() == true)
       depth_video_stream_.stop();

     /// detroy video streaming objects as good practice,
     if (color_video_stream_.isValid() == true)
        color_video_stream_.destroy();
     if (depth_video_stream_.isValid() == true)
        depth_video_stream_.destroy();

     if (camera_device_.isValid() == true)
       camera_device_.close();
     nite::NiTE::shutdown();
     openni::OpenNI::shutdown();
}

Do it in that order, and that should take care of the problem, and will always shutdown the camera software. One thing though, if your camera nodelet had crashed right before trying this code, then unplug and plug the camera back in. Or better yet, restart your computer!!!!

One ROS runtime work around (at least it works in Openni2) is this in the next order (ideally in your Class destructor, or at the end of your main function before the program ends ends) :

void StreamingClass::~StreamingClass()
{
    ros::spinOnce();
    /// close streaming
    if (color_video_stream_.isValid() == true)
      color_video_stream_.stop();
    if (depth_video_stream_.isValid() == true)
       depth_video_stream_.stop();

     /// detroy video streaming objects as good practice,
     if (color_video_stream_.isValid() == true)
        color_video_stream_.destroy();
     if (depth_video_stream_.isValid() == true)
        depth_video_stream_.destroy();

     if (camera_device_.isValid() == true)
       camera_device_.close();
     nite::NiTE::shutdown();
     openni::OpenNI::shutdown();
}

Do it in that order, and that should take care of the problem, and will always shutdown the camera software. One thing though, if your camera nodelet had crashed right before trying this code, then unplug and plug the camera back in. Or better yet, restart your computer!!!!