# Subscribe to voxl_mpa_to_ros topics

Source: https://forum.modalai.com/topic/1097/subscribe-to-voxl_mpa_to_ros-topics
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Tags: ros
Posted: 2022-07-08 00:17:23 UTC by Isabella Yu
Replies: 4 · Views: 2234

## Isabella Yu · 2022-07-08 00:17:23 UTC

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.

## Reply by Guest · 2022-07-12 16:43:15 UTC

@Isabella-Yu said in [Subscribe to voxl\_mpa\_to\_ros topics](/post/5082):
> #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](https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-to-ros/-/tree/master/catkin_ws/src/msg) 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)

## Reply by Isabella Yu · 2022-07-12 20:43:00 UTC

Thanks! I'll try this out

## Reply by Isabella Yu · 2022-07-19 21:05:59 UTC (in reply to Guest)

@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`

## Reply by Guest · 2022-07-20 16:18:57 UTC

@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!
