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. no data being piped thru /run/mpa/tflite_data

no data being piped thru /run/mpa/tflite_data

Scheduled Pinned Locked Moved Ask your questions right here!
2 Posts 2 Posters 386 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.
  • S Offline
    S Offline
    ssansoy
    wrote on last edited by ssansoy
    #1

    i wrote a small c program to extract object detection data from /run/mpa/tflite_data

    when I list the contents of tflite_data i get two files: info & request.

    when i "cat /run/mpa/tflite_data/info" i get the the correct data type of ai_detection_t

    when i "cat /run/mpa/tflite_data/request" the system just hangs as if waiting for data

    I know data is being sent as the tflite camera is showing object detections in the web interface

    here is my simple c program

    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <string.h>
    #include <stdint.h>
    #include <sys/types.h>
    #include <sys/stat.h>

    #define BUF_LEN 32
    #define MAX_DETECTIONS 100
    #define PIPE_PATH "/run/mpa/tflite_data/request"

    typedef struct ai_detection_t {
    uint32_t magic_number;
    int64_t timestamp_ns;
    uint32_t class_id;
    int32_t frame_id;
    char class_name[BUF_LEN];
    char cam[BUF_LEN];
    float class_confidence;
    float detection_confidence;
    float x_min;
    float y_min;
    float x_max;
    float y_max;
    } attribute((packed)) ai_detection_t;

    int open_pipe(const char* path) {
    int fd = open(path, O_RDONLY);
    if (fd < 0) {
    perror("Failed to open pipe");
    exit(EXIT_FAILURE);
    }
    return fd;
    }

    ssize_t read_pipe(int fd, void* buffer, size_t size) {
    return read(fd, buffer, size);
    }

    int main() {
    int pipe_fd = open_pipe(PIPE_PATH);

    ai_detection_t detections[MAX_DETECTIONS];
    ssize_t bytes_read;
    
    while (1) {
        bytes_read = read_pipe(pipe_fd, detections, sizeof(detections));
        if (bytes_read <= 0) {
            usleep(10000);
            continue;
        }
    
        int num_detections = bytes_read / sizeof(ai_detection_t);
    
        printf("\nReceived %d detections:\n", num_detections);
    
        for (int i = 0; i < num_detections; ++i) {
            ai_detection_t *det = &detections[i];
            printf("Detection %d:\n", i + 1);
            printf("  Magic Number:        0x%X\n", det->magic_number);
            printf("  Timestamp (ns):       %ld\n", det->timestamp_ns);
            printf("  Frame ID:             %d\n", det->frame_id);
            printf("  Class ID:             %u\n", det->class_id);
            printf("  Class Name:           %s\n", det->class_name);
            printf("  Camera Name:          %s\n", det->cam);
            printf("  Class Confidence:     %.2f\n", det->class_confidence);
            printf("  Detection Confidence: %.2f\n", det->detection_confidence);
            printf("  Bounding Box (x_min,y_min,x_max,y_max): (%.2f, %.2f, %.2f, %.2f)\n",
                   det->x_min, det->y_min, det->x_max, det->y_max);
        }
    
        usleep(10000);
    }
    
    close(pipe_fd);
    return 0;
    

    }

    The code just hangs waiting for data to come in from the pipe /run/mpa/tflite_data/request

    what am i doing wrong?

    Alex KushleyevA 1 Reply Last reply
    0
    • S ssansoy

      i wrote a small c program to extract object detection data from /run/mpa/tflite_data

      when I list the contents of tflite_data i get two files: info & request.

      when i "cat /run/mpa/tflite_data/info" i get the the correct data type of ai_detection_t

      when i "cat /run/mpa/tflite_data/request" the system just hangs as if waiting for data

      I know data is being sent as the tflite camera is showing object detections in the web interface

      here is my simple c program

      #include <stdio.h>
      #include <stdlib.h>
      #include <unistd.h>
      #include <fcntl.h>
      #include <string.h>
      #include <stdint.h>
      #include <sys/types.h>
      #include <sys/stat.h>

      #define BUF_LEN 32
      #define MAX_DETECTIONS 100
      #define PIPE_PATH "/run/mpa/tflite_data/request"

      typedef struct ai_detection_t {
      uint32_t magic_number;
      int64_t timestamp_ns;
      uint32_t class_id;
      int32_t frame_id;
      char class_name[BUF_LEN];
      char cam[BUF_LEN];
      float class_confidence;
      float detection_confidence;
      float x_min;
      float y_min;
      float x_max;
      float y_max;
      } attribute((packed)) ai_detection_t;

      int open_pipe(const char* path) {
      int fd = open(path, O_RDONLY);
      if (fd < 0) {
      perror("Failed to open pipe");
      exit(EXIT_FAILURE);
      }
      return fd;
      }

      ssize_t read_pipe(int fd, void* buffer, size_t size) {
      return read(fd, buffer, size);
      }

      int main() {
      int pipe_fd = open_pipe(PIPE_PATH);

      ai_detection_t detections[MAX_DETECTIONS];
      ssize_t bytes_read;
      
      while (1) {
          bytes_read = read_pipe(pipe_fd, detections, sizeof(detections));
          if (bytes_read <= 0) {
              usleep(10000);
              continue;
          }
      
          int num_detections = bytes_read / sizeof(ai_detection_t);
      
          printf("\nReceived %d detections:\n", num_detections);
      
          for (int i = 0; i < num_detections; ++i) {
              ai_detection_t *det = &detections[i];
              printf("Detection %d:\n", i + 1);
              printf("  Magic Number:        0x%X\n", det->magic_number);
              printf("  Timestamp (ns):       %ld\n", det->timestamp_ns);
              printf("  Frame ID:             %d\n", det->frame_id);
              printf("  Class ID:             %u\n", det->class_id);
              printf("  Class Name:           %s\n", det->class_name);
              printf("  Camera Name:          %s\n", det->cam);
              printf("  Class Confidence:     %.2f\n", det->class_confidence);
              printf("  Detection Confidence: %.2f\n", det->detection_confidence);
              printf("  Bounding Box (x_min,y_min,x_max,y_max): (%.2f, %.2f, %.2f, %.2f)\n",
                     det->x_min, det->y_min, det->x_max, det->y_max);
          }
      
          usleep(10000);
      }
      
      close(pipe_fd);
      return 0;
      

      }

      The code just hangs waiting for data to come in from the pipe /run/mpa/tflite_data/request

      what am i doing wrong?

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

      @ssansoy , you cannot access the data from these pipes directly, you have to use the MPA mechanisms to do that. There is an example of doing that for tflite detections right here : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-inspect-detections.c and the compiled app should also be present in the SDK, so you can run it on your VOXL2 (voxl-inspect-detections).

      Alex

      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