Segmentation fault when trying to run a python script on a D455 realsense camera on a raspberry pi 4
Hello,
I followed the next link to install the realsense SDK and pyrealsense2 library on my raspberry:
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md#add-swap
After following all the steps I was able to run the SDK with no problem but everytime I try to run a script I got a segmentation fault.
Thanks for your help.
-
Hi Damian Lagunes Spolo Does the script still segfault if you run a test script with only the first line in it?
import pyrealsense2 as rs
-
In last instruction of this script is where I get the segmentation fault:
import pyrealsense2 as rs
# Create a context object. This object owns the handles to all connected realsense devices
pipeline = rs.pipeline()# Configure streams
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)# Start streaming
pipeline.start(config) -
Your script looks fine. There should not be any problem with that stream configuration.
We can eliminate the stream configuration as a cause if 'config' is temporarily removed from the brackets of the pipe start instruction, as the program will then ignore the config line when launched. If a segfault still occurs then it is the pipe start that is causing it.
pipeline.start()
-
Have you got any other RealSense programs running already at the same time, such as the RealSense Viewer tool, when you run your Python script, please?
Which model of Raspberry Pi are you using? If it is one with a small memory capacity such as 1 GB then you could try increasing the size of the virtual-memory swapfile to 4096 instead of 2048.
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md#add-swap
Does the program still segfault if you use an amended pyrealsese2 import instruction?
import pyrealsense2.pyrealsense2 as rs
-
Does the same segfault occur with the Python wrapper's test script at the link below?
-
Hi, I am experiencing this exact same issue as described.
I am running a fresh installed, 64 bit debian (Bullseye) on a raspberry pi 4 Module. I have the Pi connected to a D455 camera. I have followed the instructions instructions from this link: https://github.com/datasith/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435. These instructions have worked previously on Debian(Buster) version of the OS back in 2021 with no issue.
Installations appears to have worked fine for the SDK install, however whenever I run the demo python scrypt, from within the compiler or through command line, I get a segmentation fault. This appears to always occur when python reaches the "pipeline.start(config)" command. It also occurs if I do not change any config settings and simply try pipeline.start().
During installation, the only part of the code that failed to run was the during the "enable OpenGL" instructions:$ sudo apt-get install python-opengl and "7.Advanced Options" - "A7 GL Driver" - "G2 GL (Fake KMS)"
Python-openg1 was unable to be found on the Bullseye OS, but i could still install pyopengl/pyopengel_accelerate via pip. Also advanced option "A7 GL Driver" is not visable on the raspi-config menu. Looking into this, it appeares the debian (Bullseye) version might natively run with Full KMS (OpenGL) without the need to install: https://forums.raspberrypi.com/viewtopic.php?t=336262.
Any suggestions on how this could be solved would be appreciated. -
Hi Stefan Hickox The only known fix for Bullseye is to compile Buster and then copy some unnamed 'binaries' across from Buster to Bullseye.
https://github.com/IntelRealSense/librealsense/issues/9943#issuecomment-966048785
-
I have previously researched this solution but there aren't any further details available other than the '2 binaries' mentioned by the solution's provider, unfortunately. So if the names of the binaries are not known then using Buster instead of Bullseye is likely to be the best course of action.
Please sign in to leave a comment.
Comments
16 comments