Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. VOXL Dev Drones
  3. VOXL m500 Reference Drone
  4. Minimal example of using camera_cb

Minimal example of using camera_cb

Scheduled Pinned Locked Moved VOXL m500 Reference Drone
17 Posts 6 Posters 3.7k 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.
  • PawelJP Offline
    PawelJP Offline
    PawelJ
    wrote on last edited by
    #8

    Thank you all for all of the information :). The snapshot feature sounds like what I'm looking for. I'm looking through the camera server git at the moment for the code. Is there any example for using this vs a regular stream? I see that in the camera server conf you can enable which type of stream you want. I've set preview and video to false for the hires camera and set snapshot to True. My tflite model is using the tracking camera for it's feed. Going off of the voxl-camera-server hal3-camera-mgr.cpp I see that the server handles the image saving. As for the expected behaviour, would an image be saved when data enters the pipe while the client is still connected?

    I currently have my client set with a simple camera_cb that closes the client when the cb is triggered to only save one image after the client is started. Is the snapshot client setup the same way as the streaming client? When I try to run this client with the pipe name pointing to /run/mpa/hires_preview I get the debug message showing that the client connected, but it appears that the capture buffer is being used instead of the snapshot.

    NOTE: I added the all caps printouts that show that pCaptureResultData is not null on line 1115 of the hal3_camera_mgr.cpp and that it is null on line 1240 when checkin the pSnapshotBufferInfo.

    ------ voxl-camera-server INFO: Client: modal-abr-capture-pipe0 connected to channel: 0
    
    
    2:CAPTURE BUFFER NOT NULL, BUT SHOULD BE FOR SNAPSHOT
    
    
    
    SNAPSHOT BUFFER NULL WHEN TRYING TO SAVE
    
    voxl-camera-server ERROR: Error sending request 0, ErrorCode: -22
    
    voxl-camera-server FATAL: Recieved Fatal error from camera: hires
                              Camera server will be stopped
    ------ voxl-camera-server WARNING: Thread: hires request thread recieved ESTOP
    ------ voxl-camera-server WARNING: Thread: tracking result thread recieved ESTOP
    ------ voxl-camera-server WARNING: Thread: stereo request thread recieved ESTOP
    ------ voxl-camera-server WARNING: Thread: stereo result thread recieved ESTOP
    ------ voxl-camera-server WARNING: Thread: hires result thread recieved ESTOP
    ------ voxl-camera-server WARNING: Thread: tracking request thread recieved ESTOP
    
    ------ voxl-camera-server INFO: Camera server is now stopping
    		There is a chance that it may segfault here, this is a mmqcamera bug, ignore it
    
    ------ voxl-camera-server INFO: Stopping tracking camera
    ------ voxl-camera-server INFO: tracking camera stopped successfully
    
    ------ voxl-camera-server INFO: Stopping hires camera
    ------ voxl-camera-server INFO: hires camera stopped successfully
    
    ------ voxl-camera-server INFO: Stopping stereo camera
    ------ voxl-camera-server INFO: stereo camera stopped successfully
    
    ------ voxl-camera-server INFO: Camera server exited gracefully
    
    

    I'm still sorting through where this error is being thrown.

    1 Reply Last reply
    0
    • Alex KushleyevA Offline
      Alex KushleyevA Offline
      Alex Kushleyev
      ModalAI Team
      wrote on last edited by
      #9

      I double checked with other devs on the team and the jpeg snapshot feature in voxl-camera-server is still in development. I don't have a good ETA for the feature.

      However, perhaps we can go back to evaluating voxl-rtsp for your application. If you disable hires camera in voxl-camera-server, you should be able to use voxl-rtsp with hires camera after voxl-camera-server has started for other cameras.

      voxl-rtsp supports outputting jpegs. You can first confirm that you can access hires camera jpegs with voxl-rtsp (I don't think it can do 4K30 jpegs, but lower resolution/frame rate should work). That should work and then you could add an input to trigger voxl-rtsp to actually save a jpeg upon request (instead of every frame). This can be done similarly how exposure/gain commands are accepted by voxl-rtsp via a named pipe.

      Hopefully this can work for you..

      1 Reply Last reply
      1
      • Alex KushleyevA Offline
        Alex KushleyevA Offline
        Alex Kushleyev
        ModalAI Team
        wrote on last edited by
        #10

        .. or if you wanted to continue using voxl-camera-server for 4K, just modify the server to save yuv frames on-demand and convert to jpeg later, as we discussed above..

        1 Reply Last reply
        1
        • PawelJP Offline
          PawelJP Offline
          PawelJ
          wrote on last edited by
          #11

          Thank you for all of the ideas. I was able to get the image capture to work by setting my thread to watch for a capture_image flag to start the client, then stop it after the image is saved, instead of threading the callback itself. This let me save an image at a time to text file, then I just scp it off the voxl to parse in python as an RGB image later.

          Cheers

          1 Reply Last reply
          0
          • Alex KushleyevA Offline
            Alex KushleyevA Offline
            Alex Kushleyev
            ModalAI Team
            wrote on last edited by
            #12

            Sounds good.. Just keep in mind that saving a 4K image to a text file will be much slower and will take more space than just saving the raw binary data to a file. Parsing a binary file should be as easy or easier than text.. It's up to you though 🙂

            PawelJP 1 Reply Last reply
            0
            • Alex KushleyevA Alex Kushleyev

              Sounds good.. Just keep in mind that saving a 4K image to a text file will be much slower and will take more space than just saving the raw binary data to a file. Parsing a binary file should be as easy or easier than text.. It's up to you though 🙂

              PawelJP Offline
              PawelJP Offline
              PawelJ
              wrote on last edited by
              #13

              @Alex-Kushleyev thanks for the heads up. You make a good point, I'll switch it over to a bin 👌 Thanks!

              1 Reply Last reply
              0
              • M Offline
                M Offline
                m1baldwin
                wrote on last edited by
                #14

                Just coming back to this; any update on the snapshot feature?

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

                  Hi,
                  voxl-camera-server >= 1.0.2 (live on voxl2/rb5, beta on voxl1) supports 4k snapshots from the hires camera, you can echo "snapshot" into the hires control pipe and it will write the snapshot out to /data/snapshots/, or echo "snapshot [path]" into the pipe and it will write the snapshot out to the given path.

                  M 1 Reply Last reply
                  0
                  • ? A Former User

                    Hi,
                    voxl-camera-server >= 1.0.2 (live on voxl2/rb5, beta on voxl1) supports 4k snapshots from the hires camera, you can echo "snapshot" into the hires control pipe and it will write the snapshot out to /data/snapshots/, or echo "snapshot [path]" into the pipe and it will write the snapshot out to the given path.

                    M Offline
                    M Offline
                    mkwan
                    wrote on last edited by
                    #16

                    @Alex-Gardner I get an error when trying snapshot on the Sentinel, voxl-suite 0.8.1.

                    Input:

                    voxl2:/run/mpa/hires$ echo "snapshot" > control
                    

                    Output:

                    Nov 04 16:20:41 m0054 bash[24392]: Camera: hires taking snapshot (destination: /data/snapshots/hires-0.jpg)
                    Nov 04 16:20:41 m0054 bash[24392]: free(): invalid pointer
                    Nov 04 16:20:41 m0054 systemd[1]: voxl-camera-server.service: Main process exited, code=killed, status=6/ABRT
                    Nov 04 16:20:41 m0054 systemd[1]: voxl-camera-server.service: Failed with result 'signal'.
                    

                    Any advice?

                    ? 1 Reply Last reply
                    0
                    • M mkwan

                      @Alex-Gardner I get an error when trying snapshot on the Sentinel, voxl-suite 0.8.1.

                      Input:

                      voxl2:/run/mpa/hires$ echo "snapshot" > control
                      

                      Output:

                      Nov 04 16:20:41 m0054 bash[24392]: Camera: hires taking snapshot (destination: /data/snapshots/hires-0.jpg)
                      Nov 04 16:20:41 m0054 bash[24392]: free(): invalid pointer
                      Nov 04 16:20:41 m0054 systemd[1]: voxl-camera-server.service: Main process exited, code=killed, status=6/ABRT
                      Nov 04 16:20:41 m0054 systemd[1]: voxl-camera-server.service: Failed with result 'signal'.
                      

                      Any advice?

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #17

                      @mkwan Can you make a new thread with this issue and include the output of voxl-inspect-services -v

                      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