Software Archive
Read-only legacy content
17061 Discussions

R200 SetDSMinMaxZ() fails with STATUS_DEVICE_FAILED

Henning_J_
New Contributor I
705 Views

Every time I try to use SetDSMinMaxZ(), it fails with PXC_STATUS_DEVICE_FAILED. Is that not implemented yet? Or is there some other problem?

I'm using C++, SDK version 6.0.21.6598, with the R200

  PXCSession *session = PXCSession::CreateInstance();
  PXCSenseManager *senseManager = session->CreateSenseManager();

  pxcStatus st = senseManager->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 480, 360, 30);
  if (st < PXC_STATUS_NO_ERROR)
    return -1;
  st = senseManager->Init();
  if (st < PXC_STATUS_NO_ERROR)
    return -1;

  PXCCaptureManager *cm = senseManager->QueryCaptureManager();
  PXCCapture::Device *device = cm->QueryDevice();

  PXCRangeF32 depthRange;
  depthRange.min = 600.f;
  depthRange.max = 700.f;
  st = device->SetDSMinMaxZ(depthRange); // fails with PXC_STATUS_DEVICE_FAILED(-201)
0 Kudos
4 Replies
John_M_9
Beginner
705 Views

I am having the same problem.  I have even tried querying the range, then setting it with the same values:

	// Read Range
	PXCRangeF32 range;
	range = dv->QueryDSMinMaxZ();

	// Set Range
	//range.min = 760;
	//range.max = rangemax;
	sts = dv->SetDSMinMaxZ(range);
	if (sts<PXC_STATUS_NO_ERROR)
	{
		sm->Release();
		data = 5;
		return 5;
	}

I find that it is failing when it is trying to set the minimum value:

        __inline pxcStatus SetDSMinMaxZ(PXCRangeF32 value) {
            pxcStatus sts = SetProperty(PROPERTY_DS_MIN_MAX_Z, (pxcF32)value.min);

When I QueryDSMinMaxZ I get range.min = 0.0 and range.max = 65535.0.  So, knowing that the minimum range is about 20", I tried setting it for 30" and still the same error...

Any help would be appreciated!  Thanks!

John

 

0 Kudos
Henning_J_
New Contributor I
705 Views

hmmm...when I turned on the logging in the sdk_info.exe and tried again, I found the following:

[...]

ERROR - CameraException: Internal exception: DSDevice::setMinMaxZ can only be used before capture started (-201)

So, that means to use the SetDSMinMaxZ method, I have to create the Device myself, use SetDSMinMaxZ() on it, then use the SenseManager to start stream images? Well, at least that works. But it seems awfully complicated:

  PXCSession *session = PXCSession::CreateInstance();

  PXCSession::ImplDesc desc1 = {};
  desc1.group = PXCSession::IMPL_GROUP_SENSOR;
  desc1.subgroup = PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;
  
  PXCCapture* c;
  session->CreateImpl<PXCCapture>(&desc1, &c);

  PXCCapture::Device* device = c->CreateDevice(0);

  PXCRangeF32 depthRange;
  depthRange.min = 0;
  depthRange.max = 2000.f;
  pxcStatus st = device->SetDSMinMaxZ(depthRange);

  PXCSenseManager *senseManager = session->CreateSenseManager();

  st = senseManager->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 480, 360, 30);
  if (st < PXC_STATUS_NO_ERROR)
    return -1;
  st = senseManager->Init();
  if (st < PXC_STATUS_NO_ERROR)
    return -1;

  //...

Once I got the device anyway, is there a way to comfortably start stream from it directly?

0 Kudos
John_M_9
Beginner
705 Views

Hi Henning,

Thanks for solving that.  It doesn't make much sense that we have to senseManager->Init() before we can get PXCCapture::Device *device, and then can't use *device->SetDSMinMaxZ(depthRange). 

Of course, now that I can limit the range, I'm not so sure what it is good for - I could just ignore the values over depthRange.max all by my self...  I guess I was hoping it would scale the whole 16 bits between the min and max...

As a side note:  Thanks for turning me on to that logging tool.  I hadn't really noticed it.  Not terribly user friendly, but a help...

John

0 Kudos
Henning_J_
New Contributor I
705 Views

It doesn't make much sense that we have to senseManager->Init() before we can get PXCCapture::Device *device, and then can't use *device->SetDSMinMaxZ(depthRange). 

Yeah, the whole design of the SDK around SenseManager and Device thing is weird.

Of course, now that I can limit the range, I'm not so sure what it is good for - I could just ignore the values over depthRange.max all by my self...  I guess I was hoping it would scale the whole 16 bits between the min and max...

That's exactly why I wanted it: so I can just copy the complete depth image into our internal data structures without needing to filter out the irrelevant values manually.

As a side note:  Thanks for turning me on to that logging tool.  I hadn't really noticed it.  Not terribly user friendly, but a help...

Yeah, it's well hidden, not really easy to use, but can be helpful, especially for some of the less obvious failures/error codes.

0 Kudos
Reply