Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 15 additions & 24 deletions ComponentRealSenseV2Server/smartsoft/src/ImageTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,30 +78,6 @@ ImageTask::~ImageTask()
_ring_buffer.clear();
}

void ImageTask::startCapturing() {
SmartACE::SmartGuard(COMP->RealSenseMutex);
if (COMP->smart_rs_device != NULL) {
COMP->smart_rs_device->startVideo();

}
if (COMP->getGlobalState().getSettings().getDebug_info()) {
std::cout << "[Image Task] Start capturing\n";
}
}

void ImageTask::stopCapturing() {
SmartACE::SmartGuard guard(COMP->RealSenseMutex);
if (COMP->smart_rs_device != NULL) {
COMP->smart_rs_device->stopVideo();
}

if (COMP->getGlobalState().getSettings().getDebug_info()) {
std::cout << "[Image Task] Stop capturing\n";
}
}



int ImageTask::on_entry()
{
ParameterStateStruct global_state = COMP->getGlobalState();
Expand Down Expand Up @@ -146,6 +122,11 @@ int ImageTask::on_entry()
device_serial_number, base_line);

COMP->smart_rs_device->set_is_postprocess_enabled(global_state.getSettings().getPost_processing());
COMP->smart_rs_device->startVideo();

if (COMP->getGlobalState().getSettings().getDebug_info()) {
std::cout << "[Image Task] Start capturing\n";
}

return 0;
}
Expand Down Expand Up @@ -310,5 +291,15 @@ int ImageTask::on_execute()
int ImageTask::on_exit()
{
// use this method to clean-up resources which are initialized in on_entry() and needs to be freed before the on_execute() can be called again
SmartACE::SmartGuard guard(COMP->RealSenseMutex);
COMP->smart_rs_device->stopVideo();

if (COMP->getGlobalState().getSettings().getDebug_info()) {
std::cout << "[Image Task] Stop capturing\n";
}

delete COMP->smart_rs_device;
COMP->smart_rs_device = NULL;

return 0;
}
2 changes: 0 additions & 2 deletions ComponentRealSenseV2Server/smartsoft/src/ImageTask.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public:
virtual int on_execute();
virtual int on_exit();

void startCapturing();
void stopCapturing();
bool push_newest_rgbd;
bool push_newest_rgb;
bool push_newest_depth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,10 @@
void SmartStateChangeHandler::handleEnterState(const std::string & substate) throw()
{
std::cout<<"handleEnterState: "<<substate<<std::endl;
if (substate == "nonneutral") {
COMP->imageTask->startCapturing();
}
if (substate == "pushimage"){
//COMP->colorImagePushNewestServer->start();
//std::cout << "Push Newest started.\n";
}

}

// Called when a substate is left
void SmartStateChangeHandler::handleQuitState(const std::string & substate) throw()
{
std::cout<<"handleQuitState: "<<substate<<std::endl;
if (substate == "nonneutral") {
COMP->imageTask->stopCapturing();
}

if (substate == "pushimage"){
//COMP->colorImagePushNewestServer->stop();
//std::cout << "Push Timed stopped.\n";
}

}