Subscribe to voxl_mpa_to_ros topics



  • I'm writing a C++ ros node to do 3D object detection using AiDetectionMsg and the pointcloud generated from the stereo camera. How would I subscribe to the AiDetection topic in my code? I couldn't find the topic name via rostopic list. I tried doing

    #include <voxl_mpa_to_ros/AiDetection.h>
    

    but running catkin build gives a not found error.


  • Dev Team

    @Isabella-Yu said in Subscribe to voxl_mpa_to_ros topics:

    #include <voxl_mpa_to_ros/AiDetection.h>

    The topic name for AiDetectionMsgs is tflite_data, and should be published by voxl_mpa_to_ros automatically if voxl-tflite-server is running and publishing to the pipe at /run/mpa/tflite_data.

    For a custom ROS node using the AiDetectionMsg, you will have to manually copy the AiDetection.msg file that lives here and use catkin to generate the associated header file. This tutorial http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber(c++) covers this fairly well, but the main two additions to your CMakeLists will be adding these lines:

    add_message_files(
        DIRECTORY 
        msg
        FILES
        AiDetection.msg
    )
    
    generate_messages()
    

    Then, when you need to include this message within your project, the syntax is simply:

    #include <project_name/AiDetection.h>
    // where project_name is as whatever you define in your CMakeLists, i.e. 
    // project(voxl_mpa_to_ros)


  • Thanks! I'll try this out



  • @Matt-Turi how would I manually start /run/mpa/tflite_data? I switched to a different m500 and started voxl-tflite-server, but there appears to be no /run/mpa/tflite_data pipe, only the /run/mpa/tflite pipe. The model I'm using is the default MobileNetV2 object detection model for VOXL, and I reset the drone to factory defaults using voxl-configure-tflite


  • Dev Team

    @Isabella-Yu,

    If there is no tflite_data pipe, you may be using a version of voxl-tflite-server that does not have the ai_detection_t added yet. This feature was added in v0.2.0, so make sure you are using the latest available version!


Log in to reply