37 void CapturingPointCloudProvider::startCapture(
const Ice::Current& ctx)
40 std::unique_lock lock(captureMutex);
42 onStartCapture(frameRate);
44 numFramesToCapture = -1;
45 captureEnabled =
true;
47 ARMARX_INFO <<
"Starting point cloud capture with framerate " << frameRate;
50 void CapturingPointCloudProvider::startCaptureForNumFrames(
int numFrames,
const Ice::Current&
c)
53 std::unique_lock lock(captureMutex);
55 onStartCapture(frameRate);
57 numFramesToCapture = numFrames;
58 captureEnabled =
true;
60 ARMARX_INFO <<
"Starting point cloud capture with framerate " << frameRate <<
" (capture " << numFramesToCapture <<
" frames)";
63 void CapturingPointCloudProvider::stopCapture(
const Ice::Current& ctx)
66 std::unique_lock lock(captureMutex);
68 captureEnabled =
false;
73 void CapturingPointCloudProvider::changeFrameRate(
float framesPerSecond,
const Ice::Current& ctx)
76 std::unique_lock lock(captureMutex);
78 frameRate = framesPerSecond;
81 bool CapturingPointCloudProvider::isCaptureEnabled(
const Ice::Current&
c)
83 return captureEnabled;
90 void CapturingPointCloudProvider::onInitPointCloudProvider()
93 captureEnabled =
false;
94 frameRate = getProperty<float>(
"framerate").getValue();
98 setPointCloudSyncMode(eFpsSynchronization);
103 setPointCloudSyncMode(eCaptureSynchronization);
108 onInitCapturingPointCloudProvider();
116 void CapturingPointCloudProvider::onConnectPointCloudProvider()
119 onStartCapturingPointCloudProvider();
121 captureTask->start();
123 bool isEnabled = getProperty<bool>(
"isEnabled").getValue();
132 void CapturingPointCloudProvider::onExitPointCloudProvider()
143 onExitCapturingPointCloudProvider();
147 void CapturingPointCloudProvider::capture()
153 std::chrono::milliseconds td(1);
155 while (!captureTask->isStopped() && !isExiting())
159 std::unique_lock lock(captureMutex);
163 if (numFramesToCapture > 0)
165 numFramesToCapture--;
167 if (numFramesToCapture == 0)
169 captureEnabled =
false;
173 if (pointCloudSyncMode == eFpsSynchronization)
175 fpsCounter.assureFPS(frameRate);
180 std::this_thread::sleep_for(td);
190 void CapturingPointCloudProvider::setPointCloudSyncMode(ImageSyncMode pointCloudSyncMode)
192 std::unique_lock lock(captureMutex);
194 this->pointCloudSyncMode = pointCloudSyncMode;
197 ImageSyncMode CapturingPointCloudProvider::getPointCloudSyncMode()
199 std::unique_lock lock(captureMutex);
201 return pointCloudSyncMode;