-
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
Python Wrapper for realsense-net #8564
Comments
Hi @xlDownxl You may find it easier to use the earlier EtherSense RealSense ethernet networking project in the link below, which is based around Python by default. https://dev.intelrealsense.com/docs/depth-camera-over-ethernet-whitepaper In regard to the open-source ethernet networking project, it states that "integration with Python, Android and other wrappers in librealsense ecosystem will be provided in future releases based on feedback from the community". There has been a case where it was successfully connected to from the C# wrapper, but I am not aware of a similar example for Python. |
Hi @xlDownxl Do you require further assistance with this case, please? Thanks! |
Thank you @MartyG-RealSense for your support! I used the proposed Ethersense code to a great success. Still, it would be great to see the Python wrappers for those functions in the SDK integrated in future releases. |
Thats very much @xlDownxl for the update! |
@xlDownxl how did you manage to make the ethersense work? |
I encountered the same issue, but I think to replace |
Thanks @xlDownxl
while On another ubuntu machine (amd64) I installed the libraries from the repos and the rs.pipeline() object exists. We assume that the way to build the libraries is somehow corrupted and it does not build everything. |
Maybe try to add the flag |
Thanks @xlDownxl ! |
@xlDownxl so, that flag didn't change... the problem is the python library that gets partially compiled and those are the only available methods
it looks like the cmakefile is broken and brings to an incomplete, yet succesfull, build. |
Hi @mirkocomparetti-synesis You mention above that you are using an amd64 computer with Python 3.8.5. If you have not tried this already, there is now the option since librealsense SDK version 2.43.0 to use pip install pyrealsense2 with Python 3.8 and 3.9 to install the Python wrapper on x86 / x64 computers (e.g desktop and laptop computers) instead of building the wrapper from source. |
Thank you @MartyG-RealSense |
If you are using the Raspbian OS with Pi 4, I would recommend using a librealsense installation guide that is designed specifically for Pi 4. A popular guide with RealSense users of Pi 4 is the Acrobotic one, which is similar in structure to Intel's official Raspbian guide for Pi 3. https://github.com/acrobotic/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435 It is worth mentioning that some RealSense Pi users have had build problems with using the protobuf versions suggested in these guides and have had success with using more modern versions such as protobuf 3.14 instead. |
@MartyG-RealSense I'll have a look at it. So I guess the library itself is somehow broken. More details here IntelRealSense/realsense-ros#1804 (comment) |
That comment says that the error that you are experiencing is Module pyrealsense2 has no attribute 'pipeline'. The most recent Pi case I handled with this Python error is in the link below. In that case, where the RealSense user had used the Acrobotic installation guide, they found that the error occurred if they used the Python IDE Thonny but did not occur when running in the terminal. |
At the moment I'm on ubuntu because the official build instructions were ubuntu centered, but I'm dowloading raspios as we speak and I'll try with your guide. Thanks! |
Using Ubuntu with RealSense on Pi has its advantages. For example, the only successful builds of the RealSense ROS wrapper on Pi 4 that I know of have been on Ubuntu Server instead of Raspbian OS. A downside is that package files (such as pip pyrealsense2 packages and librealsense Debian install packages) do not work on devices with Arm processors such as Raspberry Pi and Nvidia Jetson, though that applies to Raspbian OS too of course. In regard to the image of the terminal, I have never known import pyrealsense2.pyrealsense2 as rs to work. It is always written in programs as import pyrealsense2 as rs I look forward to hearing about how your Raspbian OS build went! |
The fact that there has been only one successful ubuntu install does not look encouraging. The problem here is that the build procedure of the library is corrupted and it does not build the python libraries in the right way. RaspiOs is compiling |
I researched past cases further that involve the Module pyrealsense2 has no attribute 'pipeline' and located one where a Pi user who built with the Acrobotic guide resolved the problem by copying the .so files to the same directory as their script. |
Hello @MartyG-RealSense
those are all the methods available. |
@MartyG-RealSense you are right. I typed the import row directly in github when I placed the comment and I mistyped it. It was fine in the editor, otherwise |
@mirkocomparetti-synesis I carefully reviewed your problem from the beginning on this case and also looked at your other case 1804 (which is handled by a different RealSense team member) in order to seek further insights. Other than completely reinstalling the system (Ubuntu, librealsense and Python wrapper) to see whether the error goes away - as has happened in some past cases - you might also try adding CMake build instructions to tell CMake about the Python version that you are using, with -DPYTHON_EXECUTABLE=$(which python3) Given that 1804 mainly discusses ethernet solutions such as rs-net and EtherSense, or using ROS, could you provide information please about why your Raspberry Pi project requires the RealSense Python wrapper. As far as I know, just having basic Python installed without the RealSense Python wrapper should be sufficient for EtherSense or ROS. |
Hello @MartyG-RealSense Do you have any idea on how to handle our use case that we didn't think of? What we tested is:
In the mean time we will try to do the process again from sketch (hopefully the 4th time's a charming). |
Regarding the issue with rs-server and the network camera not working: at the time of writing this, rs-server only supports a limited range of resolutions and FPS speeds described in the link below. Were you using a resolution / FPS supported in the list please? |
@MartyG-RealSense are you talking about the prebuit image? Anyway, since we need to use python, AFAIK there is no support for python net cameras. |
I was referring to the comment rs-server: works fine, but no python support for network camera ... the resolution and FPS limitations in the link should apply to an rs-server that was compiled from source on Linux as well as the one in the pre-built SD card image. When planning to use librealsense with support for networking, the CMake build flag -DBUILD_NETWORK_DEVICE=ON should be included in the CMake build instruction. Can you confirm please that you included this instruction? Also, the open-source ethernet networking white paper strongly recommends building librealsense for Raspberry Pi using -DFORCE_RSUSB_BACKEND=ON I have seen a small number of cases, such as your own, where rs-server has been used on Pi with Python. I have not personally seen a case where the setting up of a camera as a network camera on Pi using Python has been demonstrated though. |
Sure, with that comment I meant that rs-server works on the pi. The fact that python does not support network cameras is something I read here (in this very issue). In general, rs-server on the raspberrypi and the realsense-viewer on a client machine works fine (if you use 2.42 as there is a bug that come in with 2.43 that we already discussed in another issue). Anyway, those are the cmake flags we used on the raspberry pi
We selected this camera because there was a prebuilt image for raspberry pi, but we were not lucky enough, maybe. Thanks! |
My recollection is that the pre-built SD card image for Pi 4 provided in the ethernet white-paper was built around the old 2.34.0 SDK version from 2020. I have not heard that it has been updated since. If you are using a firmware that is 5.12.8.200 or newer then a minimum of SDK 2.39.0 is needed due to changes in the firmware from 5.12.8.200 onwards. I typically recommend firmware 5.12.7.100 for use with SDKs older than 2.39.0. If ypu typically use your camera with modern SDK versions then I wouldn't recommend downgrading the firmware just to test it with the old SD card build. |
Hi @xlDownxl and @mirkocomparetti-synesis Because of your interest in RealSense networking on Python, I thought that you may be interested to know that the new 2.49.0 librealsense version that is now available adds an lrs-net viewer for Python called net-viewer.py to the Examples section of the Python wrapper. |
Hello everyone,
I would like to use my RealSense camera D455 with a Raspberry Pi over an Ethernet connection as it is described on this page by Intel: https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras.
Instead of the C++ used in the Tutorial, I would like to use Python, which brings me to my problem: How do I run the commands
#include <librealsense2-net/rs_net.hpp>
andrs2::net_device dev("10.0.0.99");
in Python?I installed the librealsense library from source with the
-DBUILD_NETWORK_DEVICE=ON
and-DBUILD_PYTHON_BINDINGS
on my Ubuntu 16 host machine, but I simply do not know how to access the realsense-net module and its functions.I would be glad if someone could help me out!
The text was updated successfully, but these errors were encountered: