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

ModalAI Forum

  1. ModalAI Support Forum
  2. Ask your questions right here!
  3. Building ROS node with OpenCV

Building ROS node with OpenCV

Scheduled Pinned Locked Moved Ask your questions right here!
31 Posts 6 Posters 9.5k Views 4 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.
  • modaltbM Offline
    modaltbM Offline
    modaltb
    ModalAI Team
    wrote on last edited by
    #15

    Hi @Voxlady ,

    I'm scratching my head on this one, I don't have anything helpful yet but will keep an eye out!

    1 Reply Last reply
    0
    • modaltbM modaltb

      @sarahl ,

      I've been messing with another project in a similar area, this link helped:

      Link Preview Image
      GitHub - multiarch/qemu-user-static: :earth_africa: `/usr/bin/qemu-*-static`

      :earth_africa: `/usr/bin/qemu-*-static`. Contribute to multiarch/qemu-user-static development by creating an account on GitHub.

      favicon

      GitHub (github.com)

      Namely, needing to run this 'magic command' before running my arm64 docker on x86 host (to be honest I'm not fully sure what it's doing)

      docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
      

      Another thing that's helped is adding this to my docker file:

      # required for ARM emulation
      COPY ./bin/qemu-arm-static /usr/bin/qemu-arm-static
      

      Where in my project, I've copied qemu-arm-static into a bin dir in my repo.

      Hope this helps!

      S Offline
      S Offline
      sarahl
      wrote on last edited by
      #16

      @modaltb thanks so much! I was actually wondering if I needed something like buildx for the multi-arch building, but I couldn't get it to work with the Ubuntu version of docker. But this seemed to fix my previous issue, so I'll see how this goes. Just trying the first command for now without the COPY line.

      @Voxlady I'll let you know if this fixes my issue. Haven't gotten to the OpenCV portion yet. I don't know what your disk storage constraints are on the raspberry pi, but I'm running on an amd64 Ubuntu 18.04 machine which hopefully will not run into storage issues. I noticed on the Voxl that what was taking up a lot of space was the docker overlays. I wonder if condensing all the dockerfiles into a single one would help (if you don't need all the intermediate images)?

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #17

        Hi @modaltb and @sarahl ,

        Thank you for your messages. It took me some trial-and-error time but I finally solved the problem by reducing the number of Docker Files as well as images. Now, everything seems working again.

        BR,
        Ayberk

        1 Reply Last reply
        0
        • modaltbM Offline
          modaltbM Offline
          modaltb
          ModalAI Team
          wrote on last edited by
          #18

          Thanks for the update. We really appreciate the feedback and community response!

          S 2 Replies Last reply
          0
          • modaltbM modaltb

            Thanks for the update. We really appreciate the feedback and community response!

            S Offline
            S Offline
            sarahl
            wrote on last edited by
            #19

            @modaltb okay it finally built, but when I tried to load it onto the Voxl, it ran out of space. So now I'm trying to build a new version with fewer intermediate images and with opencl removed. Are there any other ways to make more space for docker?

            @Voxlady were you able to load your roskinetic+opencv image to the Voxl? Did you use 4.2.0 or 3.4.6 or another opencv version?

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by A Former User
              #20

              @sarahl,

              Yes, I was able to load the image and even download additional packages in the container.

              1. I merged two base files from Opencv/cl and kinetic. Moreover, I put everything that's in Dockerfile.opencv into Dockerfile.xenial-packages. So, in the end I didn't have any extra Opencv-cl file. I also disabled Opencl.

              2. Most importantly, after I built roskinetic-xenial:v1.0, I deleted other two images base and minimal. I think that's okay to delete since no error or failure has occurred so far.

              3. Last, I used some best practices suggested by Docker. Especially, for Dockerfile.xenial-base. See sorting multi-line arguments .

              4. I think 3.4.6 version doesn't have a corresponding release in GitHub. So, ARG opencv_version=4.2.0 in Dockerfile.opencv assigns automatically. Therefore, I went with 4.2.0.

              Hopefully it helps.
              All the best

              1 Reply Last reply
              0
              • modaltbM modaltb

                Thanks for the update. We really appreciate the feedback and community response!

                S Offline
                S Offline
                sarahl
                wrote on last edited by
                #21

                @modaltb So I finally got the docker loaded, and also built cv_bridge and the camera ros driver. However, it doesn't seem to be reading in the camera (a FLIR). When I'm outside the docker, plugging in the device adds /dev/ttyACM0 and /dev/video2, the latter of which is used by the ros node. Is there something I need to do when running the docker to have access to the usb devices?

                1 Reply Last reply
                0
                • modaltbM Offline
                  modaltbM Offline
                  modaltb
                  ModalAI Team
                  wrote on last edited by
                  #22

                  @sarahl , here's an example of how we map and HDMI adapter into docker, not exactly the same but shows the usage:

                  Link Preview Image
                  Page not found

                  ModalAI technical documentation for VOXL and VOXL 2 Companion Computers for PX4 and ArduPilot Obstacle Avoidance and GPS-denied navigation, assembled in the USA

                  favicon

                  ModalAI Technical Docs (docs.modalai.com)

                  S 2 Replies Last reply
                  0
                  • modaltbM modaltb

                    @sarahl , here's an example of how we map and HDMI adapter into docker, not exactly the same but shows the usage:

                    Link Preview Image
                    Page not found

                    ModalAI technical documentation for VOXL and VOXL 2 Companion Computers for PX4 and ArduPilot Obstacle Avoidance and GPS-denied navigation, assembled in the USA

                    favicon

                    ModalAI Technical Docs (docs.modalai.com)

                    S Offline
                    S Offline
                    sarahl
                    wrote on last edited by
                    #23

                    @modaltb thanks, I actually tried something similar by mapping /dev to /dev, and also passing it in with the --device parameter, but I'll try this out! is there a reason it's mapped as /dev to /opt in here? Should the /dev directory not be used in the docker contained? I did notice when I plugged and unplugged the device and ran ls /dev, that the device list did not update.

                    1 Reply Last reply
                    0
                    • modaltbM modaltb

                      @sarahl , here's an example of how we map and HDMI adapter into docker, not exactly the same but shows the usage:

                      Link Preview Image
                      Page not found

                      ModalAI technical documentation for VOXL and VOXL 2 Companion Computers for PX4 and ArduPilot Obstacle Avoidance and GPS-denied navigation, assembled in the USA

                      favicon

                      ModalAI Technical Docs (docs.modalai.com)

                      S Offline
                      S Offline
                      sarahl
                      wrote on last edited by
                      #24

                      @modaltb actually I think it's working now, and I somehow didn't actually have to map the /dev port. Turns out I just had a typo in my launch file. 🤦 Thanks again for all the help!

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sarahl
                        wrote on last edited by
                        #25

                        @modaltb I wanted to send an update, I was able to build and run an Ubuntu 18.04 + ROS Melodic docker + OpenCV 4.2.0 (because some of my nodes weren't working on the ROS Kinetic docker), but did require using multi-line arguments as @Voxlady suggested to reduce the size enough to fit. It seems like the size constraints are somewhere around 2.7 GB virtual docker size, and stem from too many docker overlays. Is there anyway around that in case there is a need for larger docker images?

                        1 Reply Last reply
                        0
                        • modaltbM Offline
                          modaltbM Offline
                          modaltb
                          ModalAI Team
                          wrote on last edited by
                          #26

                          Hi @sarahl , unfortunately I don't have a quick answer for this 😿

                          1 Reply Last reply
                          0
                          • Eric KatzfeyE Offline
                            Eric KatzfeyE Offline
                            Eric Katzfey
                            ModalAI Team
                            wrote on last edited by
                            #27

                            @sarahl You could try using an SD card to build. This would give you a lot more space. You would have to change the Docker start service to tell it to use the SD card instead of /data for the build.

                            ryan_meagherR 1 Reply Last reply
                            0
                            • Eric KatzfeyE Eric Katzfey

                              @sarahl You could try using an SD card to build. This would give you a lot more space. You would have to change the Docker start service to tell it to use the SD card instead of /data for the build.

                              ryan_meagherR Offline
                              ryan_meagherR Offline
                              ryan_meagher
                              Contributor
                              wrote on last edited by ryan_meagher
                              #28

                              @Eric-Katzfey Thanks for the suggestion.

                              For anyone else interested in doing this, these are the steps I took to accomplish this.

                              • In order to change where the root of the docker runtime points to in the docker service go to
                                /etc/systemd/system/docker-start.service and change the following line so that it uses the sd card(ext4 format) in the voxl ExecStart=/usr/bin/docker daemon -g /mnt/sdcard

                              • restart the service for the changes to take effect: systemctl restart docker-start.service

                              • Delete the directories that docker uses in the data partition:cd /data; rm -rf containers linkgraph.db overlay tmp volumes graph network repositories-overlay trust

                              • [NOTE] The previous commands will delete any images that were previously available.

                              • You can now run voxl-configure-docker-support.sh and a hello world image will be created
                                and the directories that were deleted from the /data partition will be in the /mnt/sdcard
                                directory.

                              • You can verify that you have freed up the /data partition via df -h

                              1 Reply Last reply
                              1
                              • Chad SweetC Offline
                                Chad SweetC Offline
                                Chad Sweet
                                ModalAI Team
                                wrote on last edited by
                                #29

                                Thank you for following up! Added to the docs here: https://docs.modalai.com/docker-on-voxl/

                                ryan_meagherR 2 Replies Last reply
                                0
                                • Chad SweetC Chad Sweet

                                  Thank you for following up! Added to the docs here: https://docs.modalai.com/docker-on-voxl/

                                  ryan_meagherR Offline
                                  ryan_meagherR Offline
                                  ryan_meagher
                                  Contributor
                                  wrote on last edited by
                                  #30

                                  @Chad-Sweet cool, happy to contribute!

                                  1 Reply Last reply
                                  0
                                  • Chad SweetC Chad Sweet

                                    Thank you for following up! Added to the docs here: https://docs.modalai.com/docker-on-voxl/

                                    ryan_meagherR Offline
                                    ryan_meagherR Offline
                                    ryan_meagher
                                    Contributor
                                    wrote on last edited by ryan_meagher
                                    #31

                                    @Chad-Sweet Hey, I updated my voxl to the newest system image and after doing so my docker is using docker-start.service while before it was using docker-daemon.service.

                                    Not sure why this has changed, but I have updated the above instructions and wanted to let you know so you could change this in the documentation.

                                    Is there a reason why this would have changed after flashing a new system image onto the device? Both times I configured my docker by using voxl-configure-docker-support.sh

                                    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