Software Archive
Read-only legacy content
17061 Discussions

PXC_STATUS_DEVICE_LOST error

Stepan_M_
Beginner
312 Views

Hi,

I have brand new Intel RealSense 3D Camera (F200) and I have a problem with my Intel RealSense SDK. I have noticed that some samples in the SDK doesn't work. I have investigated that this usually happens when there is more that one stream from camera involved. For example Emotion viewer works but 3Dscan does not.

Here is a minimal sample code:

#include <iostream>
#include "pxcsensemanager.h"
#include "pxcmetadata.h"
#include "util_render.h"

int main(int argc, char* argv[]) {
	pxcStatus sts;
	PXCSenseManager *senseManager = PXCSenseManager::CreateInstance();
	if (!senseManager) {
		std::cout << "Unable to create the SenseManager" << std::endl;
		return 3;
	}

	UtilRender renderc(L"Color");
	UtilRender renderd(L"Depth");

	PXCVideoModule::DataDesc ddesc = {};
	ddesc.streams.depth.sizeMin.width = ddesc.streams.depth.sizeMax.width = 640;
	ddesc.streams.depth.sizeMin.height = ddesc.streams.depth.sizeMax.height = 480;
	ddesc.streams.depth.frameRate.min = 30;
	ddesc.streams.depth.frameRate.max = 30;

	ddesc.streams.color.sizeMin.width = ddesc.streams.color.sizeMax.width = 640;
	ddesc.streams.color.sizeMin.height = ddesc.streams.color.sizeMax.height = 480;
	ddesc.streams.color.frameRate.min = 30;
	ddesc.streams.color.frameRate.max = 30;
	
	senseManager->EnableStreams(&ddesc);

	sts = senseManager->Init();

	if (sts < PXC_STATUS_NO_ERROR) {
		std::cout << "Failed to locate any video stream(s)" << std::endl;
		exit(sts);
	}
	senseManager->QueryCaptureManager()->QueryDevice()->SetMirrorMode(PXCCapture::Device::MirrorMode::MIRROR_MODE_HORIZONTAL);

	for (int nframes = 0; nframes < 200; nframes++) {
		std::cout << "frame " << nframes << std::endl;

		sts = senseManager->AcquireFrame(true);

		if (sts < PXC_STATUS_NO_ERROR) {
			if (sts == PXC_STATUS_STREAM_CONFIG_CHANGED) {
				std::cout << "Stream configuration was changed, re-initilizing" << std::endl;
				senseManager->Close();
			}
			else if (sts == PXC_STATUS_DEVICE_LOST)
			{
				std::cout << "Device lost: " << sts << std::endl;
			}
			else
			{
				std::cout << "Acquire frame error: " << sts << std::endl;
			}
			break;
		}

		const PXCCapture::Sample *sample = senseManager->QuerySample();
		if (sample) {
			if (sample->depth)
				renderd.RenderFrame(sample->depth);
			else
				std::cout << "No depth" << std::endl;

			if (sample->color)
				renderc.RenderFrame(sample->color);
			else
				std::cout << "No color" << std::endl;
		}

		senseManager->ReleaseFrame();
	}

	std::cout << "Exiting" << std::endl;
	senseManager->Release();
	return 0;
}

If I enable just depth or color streams everything works fine. However, when I turn on both of them, senseManager->AcquireFrame(true) returns PXC_STATUS_DEVICE_LOST.

I checked that my computer fulfills minimal system requirements and everything seems ok. I have HP EliteBook 8540w, core i5, 4GB RAM, USB3 and Windows 8.1 64.

Thanks for any advice,
best regards,
Stepan
 

0 Kudos
0 Replies
Reply