Python MPA image example
-
Hi, I am working on the integration of a camera on the VOXL2. The camera acts as a USB CDC device and outputs an 8-bit greyscale image on ttyACM0. The manufacturer provides a python example to talk to the camera. I was able to deploy it on the voxl2 and read the images. Now I would like to push those to a pipeline for consumption by voxl-streamer and other processes. Do you have any sample code or guidance on how to do this on python? I would like to have a functional prototype of the whole thing before porting it to C++.
Thanks!
-
Hi, I am working on the integration of a camera on the VOXL2. The camera acts as a USB CDC device and outputs an 8-bit greyscale image on ttyACM0. The manufacturer provides a python example to talk to the camera. I was able to deploy it on the voxl2 and read the images. Now I would like to push those to a pipeline for consumption by voxl-streamer and other processes. Do you have any sample code or guidance on how to do this on python? I would like to have a functional prototype of the whole thing before porting it to C++.
Thanks!
@david-moro , here is a complete example that receives rtsp stream and publishes images via MPA:
tools/python/rtsp_rx_mpa_pub.py · pympa-experimental · voxl / VOXL SDK / Utilities / voxl-mpa-tools · GitLab
Tools and utilities specific to MPA.
GitLab (gitlab.com)
You need to build
voxl-mpa-toolspackage from this branch and install it on VOXL2. The python scripts will get installed to/usr/share/modalai/voxl-mpa-tools/, you will need at leastpympa.pywhich provides wrappers for python bindings for the mpa functions.libpympa.sowill be installed to/usr/libwhich contains the C side of the bindings.Since you don't need opencv, you can just extract the mpa publishing part from the example and add it to your python camera code.
Alex
-
Awesome! Will give it a try. Thanks @Alex-Kushleyev !
-
Awesome! Will give it a try. Thanks @Alex-Kushleyev !
@Alex-Kushleyev , it worked. Thanks!
-
@Alex-Kushleyev , it worked. Thanks!
@david-moro , awesome! thanks for confirming.
Alex
-
@david-moro , awesome! thanks for confirming.
Alex
@Alex-Kushleyev Hi!
My team and I are working with both voxl1 and voxl2 based platforms. We used your example and changed it to publish a ros topic (Image) to pipe on voxl2. It works great. Now we try to do the same on voxl1 (compiling the same code to ipk) and encounter the problem:
Traceback (most recent call last): File "ros_img_mpa_pub.py", line 19, in <module> from pympa import * File "/usr/share/modalai/voxl-mpa-tools/pympa.py", line 23, in <module> pympa = ct.CDLL("libpympa.so") File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__ self._handle = _dlopen(self._name, mode) OSError: libpympa.so: wrong ELF class: ELFCLASS64Is there any other branch that may be suitable for voxl1 to our purpose?
Thank you, Meytal
-
@Alex-Kushleyev Hi!
My team and I are working with both voxl1 and voxl2 based platforms. We used your example and changed it to publish a ros topic (Image) to pipe on voxl2. It works great. Now we try to do the same on voxl1 (compiling the same code to ipk) and encounter the problem:
Traceback (most recent call last): File "ros_img_mpa_pub.py", line 19, in <module> from pympa import * File "/usr/share/modalai/voxl-mpa-tools/pympa.py", line 23, in <module> pympa = ct.CDLL("libpympa.so") File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__ self._handle = _dlopen(self._name, mode) OSError: libpympa.so: wrong ELF class: ELFCLASS64Is there any other branch that may be suitable for voxl1 to our purpose?
Thank you, Meytal
Hi @Meytal-Lempel ,
There was an issue causing a 64 bit library to be installed into
/usr/libon VOXL1. 32 bit library was never built. I fixed the issue on the pympa branch : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/commit/4e9f35ee26217e490c28cf559f4c4b33e0bacd59Native python3 on VOXL1 is 32 bit.
After building and installing the ipk on voxl1, you can check the library for 32 bit:
readelf -a /usr/lib/libpympa.so | more ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endianThe 64-bit
libpympa.solibrary will now go to/usr/lib64, as it should on VOXL1I hope this helps!
Alex
-
Hi @Meytal-Lempel ,
There was an issue causing a 64 bit library to be installed into
/usr/libon VOXL1. 32 bit library was never built. I fixed the issue on the pympa branch : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/commit/4e9f35ee26217e490c28cf559f4c4b33e0bacd59Native python3 on VOXL1 is 32 bit.
After building and installing the ipk on voxl1, you can check the library for 32 bit:
readelf -a /usr/lib/libpympa.so | more ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endianThe 64-bit
libpympa.solibrary will now go to/usr/lib64, as it should on VOXL1I hope this helps!
Alex
@Alex-Kushleyev Thank you, it works!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login