Camera connection and disconnection / C#
Good morning,
Is it possible to retrieve the USB disconnection information from the camera D435/D415, so that it can be restarted in the application directly when the USB port is reconnected ?
-
It is possible to detect camera unplug (detach) and plug-in (attach) events. I only know of versions of the code for C++ and Python though.
C++
https://github.com/IntelRealSense/librealsense/issues/931
Python
https://github.com/IntelRealSense/librealsense/issues/4212
In both cases it involves a function called set_devices_changed_callback
-
Thx Marty! I tried to translate to C#, but I can't call the same function as in cpp or python in C#.
Cpp exemple :

C# exemple :

On this exemple you can show I can't found the fonction "Get_active_profile().get_device();" I only found "pp.Device", but I dont think it's the same.
And what is ctx on cpp code?? Before the set_devices_changed_callback
I can't find any examples of how to do that.
-
Apologies for the delay in responding further, as I was researching this case. I could not find any C# examples of use of set_devices_changed_callback either. Though I found C# scripts that check for whether a device can be found. It should be applicable to any camera supported by RealSense SDK 2.0, as it is just checking for whether the device list is empty.
-
No problem, for me it was the end of the day. I tried just now and actually I'm able to retrieve the device in question. But I can't get the information from this one. My goal would be to record it, to be able to reconnect it automatically when I plug it back in.
Here I just get the device, to access the sensor, that's how I change the values of my IR sensor for example in my application. But I can't find any info on the USB connection...
-
Hello Marty.
I need now to be able to connect several cameras on a single application. To do this I would need the connection information of the cameras I gess, so that I can then launch a thread per camera.
I think it's similar to the disconnection and reconnection of the camera while the program is running. But I hadn't succeeded, for lack of example in C#, which is the language I use.
I found this perfect C++ exemple at the last of this topic : https://forums.intel.com/s/question/0D70P0000069uDhSAI/d435-streams-work-once-then-crash
But I don't succed to translate it into C# and use the function that are used in the example. May be some one already do something like that in c# ?
Please let me know if you need any other information, and thanks in advance!
-
There is a C# script here for creating a pipeline for each camera:
https://github.com/IntelRealSense/librealsense/issues/3432#issuecomment-472570380
Please sign in to leave a comment.
Comments
9 comments