Skip to content
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

Segmentation fault when running python 3 with import pyrealsense2 #8341

Closed
juliahambright opened this issue Feb 9, 2021 · 8 comments
Closed

Comments

@juliahambright
Copy link

Required Info
Camera Model T265
Operating System & Version Ubuntu 18.04
Kernel Version (Linux Only) 5.3
Platform Raspberry Pi 3b+
SDK Version librealsense
Language python3.6

Issue Description

Good afternoon! I have installed librealsense on my Raspberry Pi, and I just ran the cmake and other commands described here: #3062 (comment)
to get pyrealsense2 for python.

I am using this simple pose code: https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/t265_example.py
and when I run it with python, it works perfectly fine, but when I run it with python3, I get

Segmentation Fault

after a few seconds. I have checked out other posts with similar issues but there does not seem to be a clear solution.

Thanks!

@chapa17
Copy link

chapa17 commented Aug 24, 2021

Hello, I am also getting a similar error on the code line pipeline.start(config). Did you find any solution to this?

@BenSpex
Copy link

BenSpex commented Sep 21, 2021

I'm having the same problem on Ubuntu 20.04.
Has anyone found a solution for this?

@henryburon
Copy link

henryburon commented Feb 18, 2024

I got the same error: [ros2run]: Segmentation fault

To fix it, I looked at my video devices with ls -l /dev/video*

The issue was that there were extra /dev/video* files, and that was confusing librealsense. Remove the files that show up when you have no cameras plugged in. Then, try again and see if your segmentation fault issue goes away. It worked for my raspberry pi, at least.

Unfortunately, however, I'm not experiencing another error:

raceback (most recent call last):
File "/home/terra/ws/winter_project/install/terraflight_control/lib/terraflight_control/fetch_camera", line 33, in
sys.exit(load_entry_point('terraflight-control==0.0.0', 'console_scripts', 'fetch_camera')())
File "/home/terra/ws/winter_project/install/terraflight_control/lib/python3.10/site-packages/terraflight_control/fetch_camera.py", line 70, in fetch_camera_entry
node = Fetch_Camera()
File "/home/terra/ws/winter_project/install/terraflight_control/lib/python3.10/site-packages/terraflight_control/fetch_camera.py", line 36, in init
self.pipeline.start(self.config)
RuntimeError: xioctl(VIDIOC_S_FMT) failed, errno=5 Last Error: Input/output error
[ros2run]: Process exited with failure 1

I think it has something to do with a driver issue, but I'm not sure. If anyone has any fixes for this, please let me know. I'll keep this updated if I figure out the issue, too.

@MartyG-RealSense
Copy link
Collaborator

Hi @henryburon When you run your fetch_camera.py script, is the camera already in use by another program. As described at #12377 (comment) the Multi-Streaming Model rules of the librealsense SDK dictate that once a program has claimed access to a stream, another program that is launched afterwards cannot access that stream until the first program has released its claim on the stream.

@henryburon
Copy link

Hi @MartyG-RealSense, no, when I ros2 run the fetch_camera node, the camera is not in use by another program--it's simply plugged into my Raspberry Pi. To fix the issue at the bottom of my previous reply, I have to unplug/re-plug the camera a few times, and then it works. Rebooting also helps.

I am now able to launch the node without errors, and I see initial camera data being published. However, messages soon start being dropped, and I am not able to actually view the images from my laptop on the same network. I think this has something to do with the frequency that I am publishing at and the QoS settings. I'll have to investigate.

@MartyG-RealSense
Copy link
Collaborator

Hi @henryburon Was the node that you created at IntelRealSense/realsense-ros#3011 (comment) a solution to the problem described above, please?

@henryburon
Copy link

Yes, it was.

@MartyG-RealSense
Copy link
Collaborator

Okay, thanks very much for the confirmation @henryburon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants