-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D435i Low Framerate when using 2 or more USB-Cameras #12888
Comments
Hi @Starblazer75 The impression that I get from the code is that when there are two cameras attached the script cannot distinguish between them as separate RealSense and non-RealSense devices. The RealSense SDK is able to access RealSense and non-RealSense cameras simultaneously if the non-RealSense camera is designated as a Platform Camera. You can test this in the RealSense Viewer tool when both cameras are attached by clicking the Add Source button at the top of the Viewer's options side-panel and selecting the USB camera from a menu drop-down. If the USB camera is successfully recognized by Add Source then you can display the RGB streams from the RealSense camera and the non-RealSense camera side by side. There are not many examples of implementing Platform Camera recognition in Python though unfortunately, other than some code from a pyrealsense2 device handling script called realsense_device_manager.py that determines whether or not the camera is a Platform Camera by reading the identification name of the camera to see whether it contains the words 'platform camera'. |
When I try turning on any stream of the Platform Camera on realsense-viewer, it gives this error: 30/04 15:28:48,689 INFO [129723605150912] (synthetic-stream-gl.cpp:80) Initializing rendering, GLSL=0 A side note is that I am now using an x86 computer with Ubuntu 22.04, and when running realsense-viewer without sud o permissions, it gives an error that says it failed to set power state. This was a common problem for me, so I just gave the librealsense source file root permissions for it to keep working. Is this a potential problem? I will keep working on a solution and let you know if I find anything |
Turns out to be a USB bandwidth problem. Not sure why some of the other errors were happening, but the specific one that I am worried about works fine when lowering the quality of the frames. Sorry about that, because it was only happening with the realsense camera I didn't think to modify the working cameras. |
It's no problem at all. I'm pleased to hear that you diagnosed the problem. Thanks very much for the update! |
Realsense Code:
USB-Camera Code:
These are the two scripts that I am running to get camera feed. All of these work perfectly when going individually.
When I am running the Realsense code, it works until I run an instance of the USB-camera code. If I run 1 instance, the framerate is completely fine but when I run the second instance, the framerate is extremely inconsistent and never goes above 5Hz. If I start the pipeline to include config, then the code will hang until the 2nd instance of the USB-Camera code is interrupted. This causes it to throw the error of waiting 5000 milliseconds in wait_for_frames(), but if I change to poll_for_frames it will continue properly if the 2nd instance of USB-Camera code is stopped.
When putting the video address of the realsense camera in USB-Camera code, it also works perfectly fine until the 2nd instance of the other cameras stop. Then, the realsense code will hang.
An important note is that it doesn't matter which camera I stop for the realsense code to continue working. I have concluded that it is something going wrong with the realsense camera.
The USB-Camera code is limited to 30Hz, and the Realsense code is limited to whatever wait_for_frames() sets. 30Hz if working properly.
When trying to initialize it on the USB-Camera code after both the other cameras are working, it throws this error after doing a Keyboard Interrupt (It hangs until I interrupt or stop one of the processes):
Starting UDP Server
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
^C
(python3:26952): GStreamer-CRITICAL **: 19:00:17.083:
Trying to dispose element videoconvert0, but it is in PLAYING instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
(python3:26952): GStreamer-CRITICAL **: 19:00:17.083:
Trying to dispose element pipeline0, but it is in PAUSED instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (651) startPipeline OpenCV | GStreamer warning: unable to start pipeline
Traceback (most recent call last):
File "/home/billee/billee_ws/src/sensors/sensors/camera.py", line 98, in
main()
File "/home/billee/billee_ws/src/sensors/sensors/camera.py", line 89, in main
camera_publisher = CameraPublisher(video, port)
File "/home/billee/billee_ws/src/sensors/sensors/camera.py", line 31, in init
self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
KeyboardInterrupt
[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (616) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
(python3:26952): GStreamer-CRITICAL **: 19:00:17.136:
Trying to dispose element appsink0, but it is in READY instead of the NULL state.
You need to explicitly set elements to the NULL state before
dropping the final reference, to allow them to clean up.
This problem may also be caused by a refcounting bug in the
application or some element.
The first warning happens for all of them, doesnt seem to change anything. I can't find the solution for this, any help is appreciated.
The text was updated successfully, but these errors were encountered: