virtual void endConfigure() { if(was_running_) { Status rc = stream_.start(); if(rc != STATUS_OK) { SensorType type = stream_.getSensorInfo().getSensorType(); ROS_WARN_STREAM("Failed to restart stream '" << name_ << "' after configuration!"); int max_trials = 1; for(int trials = 0; trials < max_trials && rc != STATUS_OK; ++trials) { ros::Duration(0.1).sleep(); stream_.removeNewFrameListener(this); stream_.destroy(); stream_.create(device_, type); stream_.addNewFrameListener(this); //stream_.setVideoMode(default_mode_); rc = stream_.start(); ROS_WARN_STREAM_COND(rc != STATUS_OK, "Recovery trial " << trials << " failed!"); } ROS_ERROR_STREAM_COND(rc != STATUS_OK, "Failed to recover stream '" << name_ << "'! Restart required!"); ROS_INFO_STREAM_COND(rc == STATUS_OK, "Recovered stream '" << name_ << "'."); } if(rc == STATUS_OK) { running_ = true; } } }