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

Jetson 6.0DP and "No Device Detected" in Python only #12807

Closed
lesreaper opened this issue Mar 29, 2024 · 15 comments
Closed

Jetson 6.0DP and "No Device Detected" in Python only #12807

lesreaper opened this issue Mar 29, 2024 · 15 comments

Comments

@lesreaper
Copy link

Required Info
Camera Model { d455 }
Firmware Version (2.54.2)
Operating System & Version Linux
Kernel Version (Linux Only) (5.15.122-tegra)
Platform NVIDIA Jetson
SDK Version {2.54.2 }
Language {python }
Segment {n/A}

Issue Description

I'm trying to run the through Python the D455 camera.

Runs fine in Realsense Viewer. I check this related issue, and already rebuilt from scratch using this script:

echo "[INFO] pyrealsense2 bindings build has been started!"
sleep 2
# Give the CUDA path to CMake
sed -i '3iset(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)\' ../librealsense/CMakeLists.txt
# Set the flags so that librealsense is compatible with python
cmake ../librealsense -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 -DFORCE_LIBUVC=true

sudo make uninstall && sudo make clean
echo "[INFO] Building is starting, it will take a long time like half an hour or more!"
sleep 2
sudo make -j$(($(nproc)-1)) && sudo make install

echo 'export PYTHONPATH="$PYTHONPATH:/home/nvidia/Repos/librealsense/build/release"
' >> ~/.bashrc

sudo cp ~/Repos/librealsense/config/99-realsense-libusb.rules /etc/udev/rules.d/ 
sudo cp ~/Repos/librealsense/config/99-realsense-d4xx-mipi-dfu.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

I can load import pyrealsense2 as rs no problem. When I run this basic script:

import pyrealsense2 as rs

pipeline = rs.pipeline()
config = rs.config()

config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 30)
config.enable_stream(rs.stream.infrared, 1280, 720, rs.format.y8, 30)
# depth_sensor = profile.get_device().first_depth_sensor()

# Start streaming
# profile = config.resolve(pipeline)
profile = pipeline.start(config)

I get this error:

 -- profile = pipeline.start(config)
RuntimeError: No device connected
@MartyG-RealSense
Copy link
Collaborator

Hi @lesreaper Is the camera detected if you alter your code to use the method shown below, please?

import pyrealsense2 as rs

pipeline = rs.pipeline()
config = rs.config()

# Get device product line for setting a supporting resolution
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
pipeline_profile = config.resolve(pipeline_wrapper)
device = pipeline_profile.get_device()

config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 30)
config.enable_stream(rs.stream.infrared, 1280, 720, rs.format.y8, 30)

# Start streaming
profile = pipeline.start(config)

@lesreaper
Copy link
Author

No, it does not.

Which leads me to believe it's something with the Python wrapper. However, not sure how to change that config to work.

I'd really like to avoid the RSUSB install since this is destined for more than a prototype, but I don't know how to get Python wrappers otherwise on a Jetson.

@MartyG-RealSense
Copy link
Collaborator

Using the CMake flag DFORCE_LIBUVC=true should be essentially the same as using RSUSB, since the LIBUVC flag was deprecated in favor of using -DFORCE_RSUSB_BACKEND=TRUE instead, though the deprecated flag is still valid. Both of these flags build the SDK in a mode that bypasses the Linux kernel and so avoids the need to apply a kernel patch.

The two approaches for installing successfully from source code on a Jetson are typically to either (1) use the LIBUVC / RSUSB flag, or (2) not use the RSUSB / LIBUVC flag but do not apply a kernel patch script.

I note in the title of this issue that you refer to Jetson 6.0DP, which is JetPack 6.0 Developer Preview (DP), the first release of JetPack 6. As the librealsense SDK only supports up to JetPack 5.0.2 in the /patch-realsense-ubuntu-L4T.sh Jetson patch script at the time of writing this, this makes it important to not apply the patch script.

What happens if you remove config from the brackets of the pipeline start line so that the script ignores the stream config lines and applies the camera's default stream profile instead?

profile = pipeline.start()

@lesreaper
Copy link
Author

lesreaper commented Mar 29, 2024

If I pull the config out, it still gives me the No Device Connected error.

No, I didn't apply any patches.

I've tried compiling both with and without the RSUSB / LIBUVC flag. Same challenge.

Ideas?

I really don't want to have to, as I get downgraded Python 3.8 and CUDA 11, but I can downgrade the system to Jetpack 5.1.3 and try again.

I need to put these into production for a residential pilot program, so I need to have stable streams coming in. What's the best way of making that happen with the various installation procedures for Jetson, and having a need for Python?

@MartyG-RealSense
Copy link
Collaborator

Have you seen the librealsense / Python source code installation guide for Jetson at #6964 (comment)

@lesreaper
Copy link
Author

Yes, I did that exact process, I was just wondering if there was a better way to do it so it was more stable. Looks like I'm going to have to downgrade for now and test.

Thank you!!

@dmipx
Copy link
Contributor

dmipx commented Mar 31, 2024

Hi. JP6 kernel has no hidraw support, we enable it with our mipi integration.
https://github.com/IntelRealSense/realsense_mipi_platform_driver/tree/dev

@lesreaper
Copy link
Author

Hey @dmipx , those are interesting for sure, but adding $800 to our Cost of Goods for a camera is going to price us out of the market.

I'm going to downgrade and be back to update shortly.

@dmipx
Copy link
Contributor

dmipx commented Apr 2, 2024

Hi. I'm not asking you to use gmsl camera, I suggested to use jp6.0 kernel we built for and use with USB camera.

@lesreaper
Copy link
Author

Ah, I see @dmipx , thank you for the clarification. I will try that again when I have some extra time hopefully.

For now, I downgraded to 5.1.3, and was able to get it running with a night's worth of work. Hopefully it will continue to operate ok.

Thank you all!!

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, @lesreaper - I'm pleased to hear that you achieved a solution with a downgrade. Thanks very much for the update!

@shankar-anantak
Copy link

Hello, I am facing a similar issue, building from source completes without error, i am able to import pyrealsense2 into python scripts, however, in python, "No Device Detected" error is thrown in every script ive tried

Realsense binaries are working (rs-sensor-control, multicam, etc)

JP6, Nvidia Orin dev kit, librealsense 2.55.1

@dmipx
Copy link
Contributor

dmipx commented May 19, 2024

Hi. I suggest you run ./scripts/setup_udev_rules.sh to properly configure rules.
Report your output of rs-enum.sh script and rs-enumerate-devices.

@jeezrick
Copy link

jeezrick commented Jul 3, 2024

Hi. I'm not asking you to use gmsl camera, I suggested to use jp6.0 kernel we built for and use with USB camera.

Hi, I am not quiet sure what I should to do to 'use jp6.0 kernel' as you said according to the github repo https://github.com/IntelRealSense/realsense_mipi_platform_driver/tree/dev, can you shed some light?

@MartyG-RealSense
Copy link
Collaborator

@jeezrick Using the MIPI driver on a USB connection with JetPack 6 provides support for the IMU.

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

No branches or pull requests

5 participants