Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Software Development
  3. Modal Pipe Architecture (MPA)
  4. Python MPA image example

Python MPA image example

Scheduled Pinned Locked Moved Modal Pipe Architecture (MPA)
8 Posts 3 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    david.moro
    Contributor
    wrote on last edited by
    #1

    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!

    Alex KushleyevA 1 Reply Last reply
    0
    • D david.moro

      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!

      Alex KushleyevA Offline
      Alex KushleyevA Offline
      Alex Kushleyev
      ModalAI Team
      wrote on last edited by Alex Kushleyev
      #2

      @david-moro , here is a complete example that receives rtsp stream and publishes images via MPA:

      Link Preview Image
      tools/python/rtsp_rx_mpa_pub.py · pympa-experimental · voxl / VOXL SDK / Utilities / voxl-mpa-tools · GitLab

      Tools and utilities specific to MPA.

      favicon

      GitLab (gitlab.com)

      You need to build voxl-mpa-tools package 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 least pympa.py which provides wrappers for python bindings for the mpa functions. libpympa.so will be installed to /usr/lib which 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

      1 Reply Last reply
      0
      • D Offline
        D Offline
        david.moro
        Contributor
        wrote on last edited by
        #3

        Awesome! Will give it a try. Thanks @Alex-Kushleyev !

        D 1 Reply Last reply
        0
        • D david.moro

          Awesome! Will give it a try. Thanks @Alex-Kushleyev !

          D Offline
          D Offline
          david.moro
          Contributor
          wrote on last edited by
          #4

          @Alex-Kushleyev , it worked. Thanks!

          Alex KushleyevA 1 Reply Last reply
          0
          • D david.moro

            @Alex-Kushleyev , it worked. Thanks!

            Alex KushleyevA Offline
            Alex KushleyevA Offline
            Alex Kushleyev
            ModalAI Team
            wrote on last edited by
            #5

            @david-moro , awesome! thanks for confirming.

            Alex

            Meytal LempelM 1 Reply Last reply
            0
            • Alex KushleyevA Alex Kushleyev

              @david-moro , awesome! thanks for confirming.

              Alex

              Meytal LempelM Offline
              Meytal LempelM Offline
              Meytal Lempel
              Contributor
              wrote on last edited by
              #6

              @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: ELFCLASS64
              

              Is there any other branch that may be suitable for voxl1 to our purpose?

              Thank you, Meytal

              Alex KushleyevA 1 Reply Last reply
              0
              • Meytal LempelM Meytal Lempel

                @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: ELFCLASS64
                

                Is there any other branch that may be suitable for voxl1 to our purpose?

                Thank you, Meytal

                Alex KushleyevA Offline
                Alex KushleyevA Offline
                Alex Kushleyev
                ModalAI Team
                wrote on last edited by Alex Kushleyev
                #7

                Hi @Meytal-Lempel ,

                There was an issue causing a 64 bit library to be installed into /usr/lib on 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/4e9f35ee26217e490c28cf559f4c4b33e0bacd59

                Native 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 endian
                

                The 64-bit libpympa.so library will now go to /usr/lib64, as it should on VOXL1

                I hope this helps!

                Alex

                Meytal LempelM 1 Reply Last reply
                0
                • Alex KushleyevA Alex Kushleyev

                  Hi @Meytal-Lempel ,

                  There was an issue causing a 64 bit library to be installed into /usr/lib on 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/4e9f35ee26217e490c28cf559f4c4b33e0bacd59

                  Native 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 endian
                  

                  The 64-bit libpympa.so library will now go to /usr/lib64, as it should on VOXL1

                  I hope this helps!

                  Alex

                  Meytal LempelM Offline
                  Meytal LempelM Offline
                  Meytal Lempel
                  Contributor
                  wrote on last edited by
                  #8

                  @Alex-Kushleyev Thank you, it works!

                  1 Reply Last reply
                  0

                  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
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  ModalAI
                  Categories Recent Tags ModalAI.com Docs
                  © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups