-
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
Streaming RealSense frame data to allow processing on a remote computer #11353
Comments
Hi @marcingold22 As you are using Raspberry Pi, the ethernet networking system described in the Intel white-paper document at the link below for transmitting data in real-time from a remote camera on a Pi to a host computer may be worth exploring if you have not done so already. #8423 provides a good demonstration of accessing a camera remotely as a network camera using C++ scripting. Please note though that this open-source ethernet networking system described in the above link is being removed from the next RealSense SDK version as described at #11318 as it was an experimental proof of concept rather than an official Intel-validated feature. So you will be limited to a maximum SDK version of 2.53.1 (the current one at the time of writing this) if you use this networking tool. |
Thank you very much @MartyG-RealSense ! I did not know there was such a feature, I'm still learning about the SDK. I'm editing my code to work with this. Unfortunately after re-building the SDK I get some errors in the realsense-viewer app like "Device unavailable error -9" I'm trying to solve this to see if it works. |
Hi @marcingold22 If you are using firmware 5.14.0.0 (the latest at the time of writing this) and kernel 5.15 then I recommend using SDK version 2.53.1 instead of 2.51.1. Firmware 5.14.0.0 is the recommended firmware for use with 2.53.1, and official support for kernel 5.15 was only introduced in 2.53.1. |
That was it thank you again @MartyG-RealSense for your help! I modified the code and started rs-server on the Raspberry Pi. Unfortunately the main program on my PC gives me this error:
Is it something related to firmware/SDK or did I mess up with something? This is a snipped of my code which is almost a carbon copy of the ones you find on the Intel website and on the community:
|
The resolution / FPS combinations supported for a networked camera by rs-server is more limited than with a non-networked camera. At 1280x720 resolution, only 6 FPS instead of 30 is supported for depth and color according to the Software Limitations section of the networking guide. |
Mh... But my resX and resY variables are set such as my frames are 640x480 in resolution 🤔 |
Can you confirm which RealSense camera model you are using please (D435, D455, etc) |
1280x720 resolution is limited to 6 FPS but you can use 15 or 30 if you configure your config.enable_stream instructions to use 640x480 resolution. |
Oh, but I did. My global variables are:
That's why I don't know why it gives me this error, I'm re-building the SDK again to see if something changes. |
Just saying for people who will take a look at this in the future: putting the numbers directly as arguments and removing the framerate (30 in my case) does not solve the problem (unfortunately) |
Thank you for the clarification about resX and resY. I see now how you are using them in your config lines to set the resolution. You are correct, setting Which method are you using to build the SDK on your Pi, please? Did you build from source code with CMake and include -DBUILD_NETWORK_DEVICE=ON in the CMake build instruction to install the SDK with networking support included? -DBUILD_NETWORK_DEVICE=ON must be used on the remote Pi to install rs-server on it. rs-server should not be built on the main computer that has realsense-viewer on it. |
First of all thank you again for taking time answering to me ❤️ I have built the SDK from source on the Raspberry Pi with CMake using the following command:
I used I think I have built it on the main PC using |
When using a Pi as the remote computer and using a main computer with realsense-viewer on it to remotely access the Pi via ssh, -DBUILD_NETWORK_DEVICE=ON should be used on the Pi to build rs-server only on the Pi. rs-server is then accessed from the main PC with the ssh connection. Once rs-server is running on the Pi, you should be able to access the camera that is attached to the Pi from realsense-viewer on the main machine by adding it as a network camera in realsense-viewer's Add Source option. Edit: I recall that you are using your own script to access the camera as a network device instead of using realsense-viewer. So your script is launched from the main computer? |
Yes, exactly! The camera gets recognised, but no frame arrives, even if I increase the timeout |
What happens if you comment out this line:
and then make the following change:
|
Unfortunately the same error happens 😞 |
I'm building the SDK again on the main PC, with realsense-viewer enabled this time |
Forgot to mention... Might the problem be caused by Docker? I'm on a Docker container on my main PC, do I need to enable any port? On the whitepaper I see no mention of this but I just remembered about this 🤔 |
As far as I am aware, there have been no previous reports of RealSense users attempting to access rs-server from within a Docker container on the main PC. My knowledge of Docker is limited so I cannot advise on this, unfortunately. |
Oh, unfortunately I'm forced because I have a Mac with M1 and can't compile with rs_net on it 😞 |
This networking system should be usable on a Mac without using Docker, as indicated in the documentation, as the networking components are not installed on the Mac (they only need to be installed on the Pi's SDK build by using -DBUILD_NETWORK_DEVICE=ON). Though the guide was written before the M1 models were introduced. |
Unfortunately I was unable to install the rs_net.hpp library (even by copy/pasting it in the lib directory it was not recognised) so I used this appoach... |
As far as I am aware you should only need to use -DBUILD_NETWORK_DEVICE=ON CMake flag when installing the SDK from source code on the Raspberry Pi and do not need to build the SDK with networking support on MacOS. Instead, an ssh network connection is opened from the Mac to the network components installed on the Pi. |
I can't show it right now but I tried using the librealsense formulae to install the SDK, but the realsense-viewer kept showing the error "No network, please build with network device" when I tried using the realsense-viewer to connect to a remote camera. The real problem is that I need the realsense2-net library to compile my C++ code on the main PC and in no way I managed to install it on macOS M1. I don't know if there's a way to get it without using the -DBUILD_NETWORK_DEVICE=ON |
Maybe we should step back to a simpler approach for the moment and see whether the camera on the Pi can be accessed from the Mac using realsense-viewerin order to establish whether the network connection can work at all. If the SDK has been installed on the Mac with brew then instructions at #2811 (comment) describe how to launch realsense-viewer. |
Luckly the realsense-viewer works on the Mac and the main SDK is installed (with brew). Anyway I'd really take a moment to thank you for helping me this whole week, if it weren't for you I was almost desperate, since I had tried my best to make it work on the Raspberry with little to no success, at least now I'm touching the sky with a finger, if it works on the Mac I have finally finished 😅 By the way until I'm able to use the Mac again I'd like to wish you a happy week-end 🙂 |
You are very welcome. I'm pleased that I have been able to be of help and look forward to continuing this case with you. Good luck! |
I experienced the same message when attempting to add a camera as a Network Device fro the Viewer on a computer without a network link. I sincerely apologize. I do not have networking equipment at my location and so have not attempted this project myself, and the guide document does not make clear that network components are also required on the main computer. A Mac installation guide for librealsense at the link below that is M1-compatible demonstrates a method for compiling librealsense from source code with CMake to create an XCode project. This may provide a way to define the network build flag whilst still building librealsense for XCode. |
No need to apologize, I'm already glad for your kind help. Before creating the Docker container, I had already tried doing this but had no success since I'm used to the (in my opinion) simpler and beautiful Make of Linux... After the whole process I get a dylib but still no rs-net library, which I need in order to compile the program... I'm going to try again and will let you know if I manage to get it, macOS is just a hassle to me... |
Hi Marty, using a virtual machine with Ubuntu I finally got to use the realsense-viewer app. Unfortunately I found out that no frame arrives. Here's a screenshot of the situation. I triend executing the commands in the warning but the error keeps happening. I tried also executing the script in the scripts folder for udev but nothing changed. |
It's great to hear that you made progress! The brown debug log at the bottom of the realsense-viewer window indicates that there are missing or outdated udev rules. The udev rules handle devices in Ubuntu, such as RealSense cameras. If the error message is Missing/outdated UDEV-Rules will cause 'Permissions Denied' errors then #4951 may be helpful. |
Mh I installed it the manual way but this still happens 😞 I'll take a look at the guide again and see if I forgot anything |
By the way by looking at it again, this appears before I even add the network camera, so maybe that's not on the Raspberry Pi 🤔 |
The udev message in the realsense-viewer log would be related to the main PC, yes, as realsense-viewer is launched on the main PC. The error message suggests the following instruction to input into the Ubuntu terminal. To manually install UDEV-Rules in terminal run:
|
Hi @MartyG-RealSense I'm very happy to say that it was just a macOS issue, since I think it limits the network access for apps (for security reasons I suppose). I've tried running a docker container on my personal PC (with Linux) and it works! Again thank you very much for your support, you're great! |
You are very welcome, @marcingold22 - it's great news that you achieved a solution. Thanks very much for the update! |
Case closed due to solution achieved and no further comments received. |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
Hello! I'm playing a bit with the RealSense D400 camera on a Raspberry Pi with Raspberry Pi OS. I need to extract the depth data corresponding to various points of the RGB image.
The image below shows a demo of what i need to get:
I've tried getting both the frames but by looking at the examples I've noticed that the two frames are not aligned by default and that a call to the
process(rs2::frame frame)
function is needed to get an aligned frameset.Unfortunately my Raspberry Pi is not powerful enough to compute the alignment for each frame in a reasonable amount of time and despite all the performance boost I could attempt with my limited knowledge, I could not get it.
Now I'm trying to send the frameset to my main computer which can compute it in few milliseconds. I've tried with classical TCP but I was unable to send data which the process function could compute, getting mainly segmentation faults.
After many attempts I decided to ask for help since I don't know how I could do it and found nothing on the various resources (community, here on GitHub etc...)
My question is: is there a way to process frame data real-time on a remote machine with the SDK? Thank you for your attention.
The text was updated successfully, but these errors were encountered: