IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.52k stars 4.81k forks source link

Ubuntu 20.04 release #6436

Closed dheera closed 4 years ago

dheera commented 4 years ago

Hi, I was wondering what the timeline will be for a 20.04 release of this driver?

MartyG-RealSense commented 4 years ago

Hi @dheera Whilst I do not have the information that you are seeking, a check of the public 'Commits' addition list for the next SDK version (probably named 2.35.0) does not indicate a mention of Ubuntu 20.04, suggesting that it will be introduced at an unknown future date after the next version.

https://github.com/IntelRealSense/librealsense/compare/v2.34.0...development

Wallbraker commented 4 years ago

Any update on this?

Since Ubuntu 20.04 uses Python 3.8 #6296 will need to be fixed first.

MartyG-RealSense commented 4 years ago

@Wallbraker No further news yet about Python 3.8 supporting Pyrealsense2 installation with pip instead of having to build the wrapper manually. Sorry.

dheera commented 4 years ago

@Wallbraker @MartyG-RealSense Even if we could skip Python 3.8 and support only C++ (and ROS) for now that would be amazingly useful.

MartyG-RealSense commented 4 years ago

@dheera @Wallbraker I have filed an official feature request with Intel for a pyrealsense2 wheel file for Python 3.8 so that pip install for pyrealsense2 can be used with Python 3.8 instead of compiling the wrapper from source code.

https://github.com/IntelRealSense/librealsense/issues/6296#issuecomment-643743979

Only a small number of cases have been received so far about using librealsense on Ubuntu 20.04. At least one user has successfully installed it on 20.04 using the backend installation method, with minimal performance issues experienced. This may be the best method to use for 20.04 until official support arrives in the SDK.

https://github.com/IntelRealSense/librealsense/issues/6368#issuecomment-636316279

So as I do not yet have a date for official 20.04 support to be released, and the backend installation method seems to work with 20.04 in the meantime, I will close this case. Thanks for your inputs!

vkuehn commented 4 years ago

it's sad you have closed it. 20.04 is the latest longtime version it's like supporting window 8 but not 10...

MartyG-RealSense commented 4 years ago

@vkuehn I understand your concern, but there is no practical reason to keep it open. I have filed an official feature request with Intel for the creation of a Python 3.8 wheel file, and it is highly likely that the RealSense developer team will add official Ubuntu 20.04 LTS support at a future date.

caelinsutch commented 4 years ago

What are the full steps for backend installation? After running these commands, what else do we have to do?

Go to the Librealsense root directory and create a Build folder, and then change to that created folder using the command below (if you have not created the Build folder already): mkdir build && cd build

Whilst in the Build folder, run the CMake command below: cmake ../ -DFORCE_RSUSB_BACKEND=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true

A make install doesn't seem to work for me, I get the following error:

[  0%] Built target fw
[  0%] Performing update step for 'libusb'
[  0%] Performing configure step for 'libusb'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/caelin/librealsense/build/libusb-prefix/src/libusb-build
[  0%] Performing build step for 'libusb'
[  9%] Building C object CMakeFiles/usb.dir/libusb/core.c.o
/home/caelin/librealsense/build/third-party/libusb/libusb/core.c:23:10: fatal error: config.h: No such file or directory
   23 | #include "config.h"
      |          ^~~~~~~~~~
compilation terminated.
make[5]: *** [CMakeFiles/usb.dir/build.make:63: CMakeFiles/usb.dir/libusb/core.c.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:76: CMakeFiles/usb.dir/all] Error 2
make[3]: *** [Makefile:130: all] Error 2
make[2]: *** [CMakeFiles/libusb.dir/build.make:113: libusb-prefix/src/libusb-stamp/libusb-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:1110: CMakeFiles/libusb.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
MartyG-RealSense commented 4 years ago

@caelinsutch There are instructions for building from source with the backend method (which requires an internet connection and the downloading and extracting of a zip file of the SDK source code) in the link below.

https://github.com/IntelRealSense/librealsense/issues/6689#issuecomment-648758973

If you wish to build the Pyrealsense2 wrapper (the Python bindings) at the same time as installing the SDK (which may work better for you on Ubuntu 20.04 than building the wrapper from pip or source code) then please use the modified CMake instruction below:

cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true

caelinsutch commented 4 years ago

@MartyG-RealSense Only worked after running sudo make clean before running sudo make install, thank you!

MartyG-RealSense commented 4 years ago

Thanks very much for the update @caelinsutch !

caelinsutch commented 4 years ago

@MartyG-RealSense One question, even after building/installing succesffully, when trying to build the ROS2 Foxy wrapper, it doesn't find this package. Looking around the file system, there's no cmake files for librealsense2, kist realsense2Config.cmake. Is that expected? How would I go about getting a cmake file

MartyG-RealSense commented 4 years ago

@caelinsutch I do not have any knowledge of the Foxy wrapper, so it is difficult to advise. I would guess that the sudo apt-get install ros-foxy-librealsense2 instruction is a script to install Librealsense from the official master branch. Since you have already built Librealsense using CMake, you can probably skip this step.

The libssl-dev and libglfw3-dev files described in step 3 of the instructions are usually installed when compiling librealsense from source using the usual non-backend method.

Since you have already built librealsense through the backend method (which installs all the dependencies over the internet), you can probably skip this stage too.

I would therefore progress straight to installing ros2_intel_realsense from source.

https://github.com/intel/ros2_intel_realsense/tree/refactor#install-ros2_intel_realsense-from-source


I have never heard of the Foxy wrapper until now though, so the above advice - skipping straight to installing ros2_intel_realsense - is speculation on my part rather than certainty, so I apologise in advance if it does not work.

caelinsutch commented 4 years ago

@MartyG-RealSense I cannot believe I was that dense :/, I completely missed that part in the readme. Worked perfectly after installing ros2_intel_realsense from source via the instructions, I wasn't on the right branch when building from source before. Thank you so much for the help, I really appreciate it!

MartyG-RealSense commented 4 years ago

@caelinsutch I'm very pleased to hear that you succeeded. :)

benbongalon commented 4 years ago

I'm leaving a note for those who are stuck on the "config.h: No such file" compile error even after sudo make clean && sudo make install. As suggested in #5518, you need to install the USB programming library development files which contains the missing config.h file.

$ sudo apt-get install libusb-1.0-0-dev

Then rerun cmake and make install. Here is a complete recipe that worked for me:

$ sudo apt-get install libusb-1.0-0-dev

$ git clone https://github.com/IntelRealSense/librealsense.git $ cd librealsense/ $ mkdir build && cd build $ cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true $ sudo make uninstall && make clean && make && sudo make install

MartyG-RealSense commented 4 years ago

Thanks very much @benbongalon :)

unigent-software commented 4 years ago

Building it from source on 20.04 LTS worked for me no problem

MartyG-RealSense commented 4 years ago

Thanks very much for confirmation of what worked for you in your particular case @unigent-software

AndreV84 commented 4 years ago

rules do not seem to build/ install correctly on 20.04; the udev rules; which would be proper way to get not sudo user to use built binaries?

MartyG-RealSense commented 4 years ago

@AndreV84 The alternative to building from source is to build from packages using these instructions:

https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md

AndreV84 commented 4 years ago

@MartyG-RealSense Thank you for following up! shall for ubuntu 20.04 the xenial / bionic repo branch be used? else? e.g. sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u

MartyG-RealSense commented 4 years ago

@AndreV84 There was a RealSense user recently who was able to install the Bionic distribution of librealsense on 20.04 but had some problems when using RViz in ROS, as Bionic is meant for 18.04.

https://github.com/IntelRealSense/realsense-ros/issues/1345

You are less likely to encounter problems on 20.04 if you build librealsense from source over an internet connection using the RSUSB backend method.

https://github.com/IntelRealSense/librealsense/issues/6436#issuecomment-643754251

masynthetic commented 3 years ago

@MartyG-RealSense I am similarly trying to use pyrealsense2 with 20.04 and python 3.8 and I have seen a few of your comments reccomending the RSUSB backend method but can't find any examples or more documentation regarding this, could you point me in the right direction?

AndreV84 commented 3 years ago

@masynthetic it should be something passed to cmake as in the line below

RUN wget https://github.com/IntelRealSense/librealsense/archive/v2.38.0.tar.gz && tar -xvf v2.38.0.tar.gz && cd librealsense-2.38.0/ && mkdir build && cd build &&  cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true -DBUILD_GRAPHICAL_EXAMPLES=true && make -j8 && make install

source https://github.com/AndreV84/jetson-containers/blob/master/ros1_realsense/Dockerfile However, i tmight also look likew the below

cmake ../ -DFORCE_RSUSB_BACKEND=true -DBUILD_PYTHON_BINDINGS=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_WITH_CUDA=true -DPYTHON_EXECUTABLE=/usr/bin/python3 -DBUILD_GRAPHICAL_EXAMPLES=true -DCMAKE_CUDA_ARCHITECTURES=72  -DCMAKE_PREFIX_PATH=~/apriltag
masynthetic commented 3 years ago

Thank you mine almost worked but I am getting this error

Scanning dependencies of target usb
[  9%] Building C object CMakeFiles/usb.dir/libusb/core.c.o
/home/mason/librealsense-2.38.0/build/third-party/libusb/libusb/core.c:23:10: fatal error: config.h: No such file or directory
   23 | #include "config.h"
      |          ^~~~~~~~~~
compilation terminated.

and I cant seem to find the librealsense2.so and pyrealsense2.so files so it doesn't seem to have worked enough

Do you have any suggestions for this, and did you have to use the method of copying those two files into the folder of your script?

AndreV84 commented 3 years ago

obviously libusb apt packages are missed specifically their -dev version It worked both in my tests with manual copying & with system wide install it will probably depend on if the python3 argument is passed to cmake as in the latter example above

masynthetic commented 3 years ago

obviously libusb apt packages are missed

You're right that was easy. Installed libusb1 dev and it made it past that.

thanks for your help!

Unfortunately now seems like my little laptop just doesn't have enough memory to compile this.

killed signal terminated program cc1plus
AndreV84 commented 3 years ago

try without make -j6 flags, just make

AndreV84 commented 3 years ago

librealsense2.so and pyrealsense2.so these two are created via renaming of corresponding output .so files unless they are presented after the building as is

masynthetic commented 3 years ago

Thanks again. I've made it through the install, was able to satisfy the path issue with this

Now getting

WARNING [default] Could not open device failed to set power state

when I try to run the camera :( same hardware setup works with windows

AndreV84 commented 3 years ago

try running with sudo; for the power state resolution

masynthetic commented 3 years ago

Running realsense-viewer with sudo gets me depth frames (YAY!) but no RGB, however the viewer did give me an error I didn't find anywhere else. My apologies if this is becoming a separate issue, it seems similar to https://github.com/IntelRealSense/librealsense/issues/5828 but not exactly.

Description: RealSense UDEV-Rules are missing!
UDEV-Rules permissions configuration 
 for RealSense devices.

(forgot to copy this part of the message but it said that you can run with sudo (not recommended for some reason) or install the UDEV rules through apt but I wasn't able to find or install through apt so I went with the 3rd option command below ) 
$ sudo cp ~/.99-realsense-libusb.rules /etc/udev/rules.d/99-realsense-libusb.rules && sudo udevadm control --reload-rules && udevadm trigger

this got rid of the error but still no RGB frames. I noticed that both in windows and Ubuntu the camera (in rs viewer) shows as a USB2.1 device despite using USB 3 capable ports and the cable, in windows it is still able to get both frames at reasonable resolution and rate but in Ubuntu no combination of rate, resolution, or order of enable gets me an RGB frame

MartyG-RealSense commented 3 years ago

I just wanted to let commenters on this discussion know that support for Kernel 5.4 and Ubuntu 20 have been added in the new SDK 2.40.0 release.

AndreV84 commented 3 years ago

does its https://github.com/IntelRealSense/librealsense/releases/download/v2.40.0/Intel.RealSense.unitypackage supportunity 2019 also l515 / d455?

MartyG-RealSense commented 3 years ago

@AndreV84 The 2.40.0 release notes do not mention D455 and L515 but do contain the Unity updates below:

https://github.com/IntelRealSense/librealsense/pull/7625 - [Unity] Adapting wrapper to Unity 2018-2020 Deleted GUI Layer from some scenes Added AR Background Resitrictions for prevent using old classes in Unity 2020)

AndreV84 commented 3 years ago

udev rules still won't work on 20.04? so won't run without sudo? else?

MartyG-RealSense commented 3 years ago

@AndreV84 Does it help if you reload the udev rules and then reboot the computer?

https://github.com/IntelRealSense/librealsense/issues/3244#issuecomment-467883911

AndreV84 commented 3 years ago

@MartyG-RealSense thanks; it worked after we re-downloaded, re- make the binaaaries also substituted old binaries with new resulting binaries; thus resolved

MartyG-RealSense commented 3 years ago

@AndreV84 Thanks, that's great to hear!

AndreV84 commented 3 years ago

@MartyG-RealSense could you suggest a way to confirm if GPU/CUDA support works after building the realsense sdk with the parameters below, please?


cmake -DFORCE_RSUSB_BACKEND=ON -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true -DBUILD_WITH_CUDA:bool=true -DBUILD_WITH_CUDA:bool=true -DCMAKE_CUDA_ARCHITECTURES=72 -DCMAKE_CUDA_COMPILER_ENV_VAR=/usr/local/cuda-10.2/bin/nvcc -DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.2/bin/nvcc -DOpenGL_GL_PREFERENCE=GLVND  ..
AndreV84 commented 3 years ago

as we have only remote shell access to the device 20.04 ubuntu with d435 I could see that executing ros2 realsense consumes 1-4% CPU also 1-4%GPU are there any other headless methods to monitor the CUDA/ GPU use? Thanks https://github.com/IntelRealSense/librealsense/issues/6302#issuecomment-619516818

AndreV84 commented 3 years ago

-However, I've noticed that running headless rs-depth causes 0%GPU use

MartyG-RealSense commented 3 years ago

Hi @AndreV84 I have not seen before any of the CUDA related flags that you are using, except for -DBUILD_WITH_CUDA, so I cannot comment on the use of those.

If you are building librealsense for a headless system then I recommend setting -DBUILD_GRAPHICAL_EXAMPLES to False instead of true.

The CMake Build Configuration documentation states about this flag: "Controls the-subset of examples and tools dependent on OpenGL. Disabling this option will reduce the set of tools and examples to rs-save-to-file, rs-terminal, rs-enumerate-devices and rs-fw-logger. Recommended for headless systems without the graphic subsystem".

https://dev.intelrealsense.com/docs/build-configuration

In regard to performance profiling, the SDK's C++ rs-data-collect tool may suit your needs.

https://github.com/IntelRealSense/librealsense/tree/master/tools/data-collect

AndreV84 commented 3 years ago

@MartyG-RealSense Thank you for following up. Howver, using the rs-data collet with the config below

DEPTH,640,480,30,Z16,0
INFRARED,640,480,30,Y8,1
INFRARED,640,480,30,Y8,2
COLOR,640,480,30,RGB8,0

results in only one core of 8 [CPU] to be loaded 2-11% also GPU use is indicated like 0-3%

MartyG-RealSense commented 3 years ago

@AndreV84 I cannot think of another way to profile CUDA's use of the GPU with a librealsense tool. Conceivably if you are using a Jetson as the headless device that is being accessed then you could read the CUDA statistics with the NVidia System Profiler tool if you are not doing so already.

https://developer.nvidia.com/embedded/nvidia-system-profiler

AndreV84 commented 3 years ago

@MartyG-RealSense Could you extend on how we could implement realsense camera on jetson - but realsense viewer playing the rgb stream on other network device, please? Does realsense-server needs to be installed in the jetson with camera or on the playing network computer? does realsense-net go to the unit with camera or to the playing device? reference: https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras#section-2-7-testing-the-camera

MartyG-RealSense commented 3 years ago

The ethernet open-source networking white paper states that whilst they are using Raspberry Pi, the guide can be adapted woth minor modifications for other compute boards.

At the time of writing this, rs-server supports RGB at 640x480 (6, 15 or 30 FPS) or 424x240 (6, 15, 30 or 60 FPS).

https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras#section-3-6-software-limitations

In regard to your questions about where rs-server and realsense2-net should be placed: I should emphasize that I have not built this project myself, but I believe that they go on the compute board (the device with the camera attached) rather than the host because Intel provide a pre-made Raspberry Pi 4 SD card image in the paper with the files pre-installed.

https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras#section-2-3-preparing-the-sd-card

The paper also provides confirmation that rs-server runs on the compute device.

image

AndreV84 commented 2 years ago

@MartyG-RealSense How to add the metaframe thing on x86_64?

Unsupported kernel version 5.11.0-36-generic . The Focal patches are maintained for Ubuntu LTS with kernel 5.4 only

that is the output of the patch

MartyG-RealSense commented 2 years ago

@AndreV84 A response has been posted to your question at https://github.com/IntelRealSense/realsense-ros/issues/1604#issuecomment-927139643