Items with no label
3335 Discussions

Enumerate/list all RealSense D4xx devices

SEber3
Beginner
1,348 Views

Hi!

I have a question about the query_devices function in the librealsense 2.0 SDK:

The following code

rs2::context oContext;

listDevices = oContext.query_devices();

will enumerate devices, which are not devices supported by the Librealsense 2.0 SDK. This is very unfortunate. In my case a Logitech 920C Webcam and a ZED stereo cam will also be listed.

My work around is the following:

rs2::context oContext;

listDevices.clear();

std::vector listDevicesTmp;

listDevicesTmp = oContext.query_devices(); // Get a snapshot of currently connected devices

if (listDevicesTmp.size() == 0)

return 0;

for (int nI = 0; nI < listDevicesTmp.size(); ++nI)

{

rs2::device oCurrentDevice = listDevicesTmp[nI];

if (oCurrentDevice.supports(RS2_CAMERA_INFO_NAME))

{

const char * szCameraName = oCurrentDevice.get_info(RS2_CAMERA_INFO_NAME);

std::string sName(szCameraName, strlen(szCameraName));

if (sName.find("RealSense") != std::string::npos && (sName.find("435") != std::string::npos || sName.find("415") != std::string::npos))

{

listDevices.push_back(oCurrentDevice);

}

}

}

is there something more elegant available? Now, I have to adjust the string.find part of the code whenever the librealsense SDK 2.0 supports more cameras.

0 Kudos
1 Reply
idata
Employee
485 Views

Hello Svebert,

 

 

Thanks for posting in the Intel RealSense community.

 

 

LibrealSense 2.0 was created for the D400 cameras and the SR300. Intel has not tested or validated any other camera from other manufacturers with the Librealsense software.

 

 

There is no solution or code available from Intel that would help you achieving the Librealsense detecting other cameras.

 

 

Thanks for your understanding.

 

 

Best Regards,

 

Juan N.
0 Kudos
Reply