39 CapturingPointCloudProvider::startCapture(
const Ice::Current& ctx)
42 std::unique_lock lock(captureMutex);
44 onStartCapture(frameRate);
46 numFramesToCapture = -1;
47 captureEnabled =
true;
49 ARMARX_INFO <<
"Starting point cloud capture with framerate " << frameRate;
53 CapturingPointCloudProvider::startCaptureForNumFrames(
int numFrames,
const Ice::Current&
c)
56 std::unique_lock lock(captureMutex);
58 onStartCapture(frameRate);
60 numFramesToCapture = numFrames;
61 captureEnabled =
true;
63 ARMARX_INFO <<
"Starting point cloud capture with framerate " << frameRate <<
" (capture "
64 << numFramesToCapture <<
" frames)";
68 CapturingPointCloudProvider::stopCapture(
const Ice::Current& ctx)
71 std::unique_lock lock(captureMutex);
73 captureEnabled =
false;
79 CapturingPointCloudProvider::changeFrameRate(
float framesPerSecond,
const Ice::Current& ctx)
82 std::unique_lock lock(captureMutex);
84 frameRate = framesPerSecond;
88 CapturingPointCloudProvider::isCaptureEnabled(
const Ice::Current&
c)
90 return captureEnabled;
97 CapturingPointCloudProvider::onInitPointCloudProvider()
100 captureEnabled =
false;
101 frameRate = getProperty<float>(
"framerate").getValue();
105 setPointCloudSyncMode(eFpsSynchronization);
110 setPointCloudSyncMode(eCaptureSynchronization);
115 onInitCapturingPointCloudProvider();
119 this, &CapturingPointCloudProvider::capture);
123 CapturingPointCloudProvider::onConnectPointCloudProvider()
126 onStartCapturingPointCloudProvider();
128 captureTask->start();
130 bool isEnabled = getProperty<bool>(
"isEnabled").getValue();
139 CapturingPointCloudProvider::onExitPointCloudProvider()
150 onExitCapturingPointCloudProvider();
154 CapturingPointCloudProvider::capture()
160 std::chrono::milliseconds td(1);
162 while (!captureTask->isStopped() && !isExiting())
166 std::unique_lock lock(captureMutex);
170 if (numFramesToCapture > 0)
172 numFramesToCapture--;
174 if (numFramesToCapture == 0)
176 captureEnabled =
false;
180 if (pointCloudSyncMode == eFpsSynchronization)
182 fpsCounter.assureFPS(frameRate);
187 std::this_thread::sleep_for(td);
198 CapturingPointCloudProvider::setPointCloudSyncMode(ImageSyncMode pointCloudSyncMode)
200 std::unique_lock lock(captureMutex);
202 this->pointCloudSyncMode = pointCloudSyncMode;
206 CapturingPointCloudProvider::getPointCloudSyncMode()
208 std::unique_lock lock(captureMutex);
210 return pointCloudSyncMode;