JetsonHacksNano / installLibrealsense

Build and install Intel's librealsense for the NVIDIA Jetson Nano Developer Kit
MIT License
153 stars 68 forks source link

Add python bindings #5

Closed romainrobotics closed 5 years ago

romainrobotics commented 5 years ago

It appears that python bindings work for RealSense 2.0 on Ubuntu.

https://www.robotexchange.io/t/solved-installing-the-librealsense2-python-wrapper/216/2

From what I can tell, lines 132 and 134 of installLibrealsense.sh can have an added field of

-DBUILD_PYTHON_BINDINGS=bool:true

After which the python path would need to be updated in the script as well

export PYTHONPATH=$PYTHONPATH:/usr/local/lib

I'm planning on trying this when I get my new larger SD card tomorrow.

dataplayer12 commented 5 years ago

Did you try it out? How was the result?

romainrobotics commented 5 years ago

Wow, I totally forgot to respond.

Yes, it does seem to have worked. I can import the library using python, but that's about as far as I got since I went back to working on my Raspberry Pi instead of the Jetson Nano for now.

dataplayer12 commented 5 years ago

Thank you for the confirmation. I will try it out as well.

romainrobotics commented 5 years ago

Make a backup of your SD image first. I remember it failed once or twice during the install for unknown reasons, but then I tried again on a fresh JetPack install and it worked.

Here are my notes from the time, which include some links that may be helpful.

Realsense on Jetson Nano https://www.jetsonhacks.com/2019/05/07/jetson-nano-realsense-tracking-camera/ https://devtalk.nvidia.com/default/topic/1051016/jetson-nano/use-intel-reg-realsense-trade-d435-series-depth-camera-on-nano/ https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

Need to figure out how to build with CUDA and python wrapper https://github.com/JetsonHacksNano/installSwapfile https://github.com/JetsonHacksNano/installLibrealsense Line 132 and 134 of installLibrealsense.sh can add -DBUILD_PYTHON_BINDINGS=true Make sure to use --build_with_cuda https://www.robotexchange.io/t/solved-installing-the-librealsense2-python-wrapper/216/5 Must update python path as well, step 4 from here https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

dataplayer12 commented 5 years ago

Thanks a lot! I have made some changes to the script as you suggested. Could you please have a look at lines 134, 136 and 139 of my fork?

Should this work?

romainrobotics commented 5 years ago

Yeah that's what I did, from what I remember. I don't have my Nano handy to check to be sure though.

dataplayer12 commented 5 years ago

Thanks. I will try it out.