voxl_mpa_to_ros doesn't work with custom pipe data



  • I am currently modifying the voxl-tflite-server to send custom metadata about the detection, confidence, and bounding box coordinates across a custom-made pipe called tflite_metadata. I have been using voxl_mpa_to_ros to view the data from certain sensors in ROS. I am able to customize what data I view from existing sensors by modifying the voxl_mpa_to_ros.launch script as follows:

    
    
    yocto:~$ cat custom_voxl_mpa_to_ros.launch 
    <?xml version="1.0"?>
    
    <!--
    /****************************************************************************
     * Copyright 2021 Modal AI
     * Complete MPA launch file exposes all node params as arguments
     ****************************************************************************/
    -->
    
    
    <launch>
    
        <!-- This parameter will remove tof points with lower confidence than the given value
             Confidence values range from 0-255 -->
        <arg name="tof_cutoff"     default="100"             />
    
        <!-- TOF point cloud data is published w.r.t the TOF ros tf frame -->
        <arg name="tof_frameid"    default="tof"             />
    
        <!-- sample interface variables, specify whether to publish, and the pipe to look for -->
        <arg name="image0_publish" default="false"                  />
        <arg name="image0_pipe"    default="tracking"              />
    
        <arg name="image1_publish" default="false"                  />
        <arg name="image1_pipe"    default="hires_preview"         />
    
        <arg name="image2_publish" default="true"                  />
        <arg name="image2_pipe"    default="qvio_overlay"          />
    
        <arg name="image3_publish" default="true"                  />
        <arg name="image3_pipe"    default="dfs_disparity"         />
    
        <arg name="image4_publish" default="true"                  />
        <arg name="image4_pipe"    default="tflite"                />
    
        <arg name="image5_publish" default="false"                 />
        <arg name="image5_pipe"    default=""                      />
    
        <arg name="image6_publish" default="false"                 />
        <arg name="image6_pipe"    default=""                      />
    
        <arg name="image7_publish" default="false"                 />
        <arg name="image7_pipe"    default=""                      />
    
        <arg name="stereo0_publish"   default="false"               />
        <arg name="stereo0_pipe"      default="stereo"             />
    
        <arg name="stereo1_publish"   default="false"              />
        <arg name="stereo1_pipe"      default=""                   />
    
        <arg name="tof0_publish"      default="true"               />
        <arg name="tof0_pipe"         default="tof"                />
    
        <arg name="tof1_publish"      default="false"              />
        <arg name="tof1_pipe"         default=""                   />
    
        <arg name="imu0_publish"      default="true"               />
        <arg name="imu0_pipe"         default="imu0"               />
    
        <arg name="imu1_publish"      default="true"               />
        <arg name="imu1_pipe"         default="imu1"               />
    
        <arg name="vio0_publish"      default="true"               />
        <arg name="vio0_pipe"         default="qvio"               />
    
        <arg name="vio1_publish"      default="false"              />
        <arg name="vio1_pipe"         default=""                   />
    
        <arg name="PC0_publish"       default="true"               />
        <arg name="PC0_pipe"          default="dfs_point_cloud"    />
    
        <arg name="PC1_publish"       default="true"              />
        <arg name="PC1_pipe"          default="tflite_metadata"                   />
    
        <arg name="PC2_publish"       default="false"              />
        <arg name="PC2_pipe"          default=""                   />
    
        <arg name="PC3_publish"       default="false"              />
        <arg name="PC3_pipe"          default=""                   />
    
        <arg name="namespace" default="mpa" />
        <!-- start mpa node with all arguments -->
        <group ns="$(arg namespace)">
            <node name="voxl_mpa_to_ros_node" type="voxl_mpa_to_ros_node" pkg="voxl_mpa_to_ros" output="screen">
    
                <param name="tof_cutoff" value="$(arg tof_cutoff)" />
                <param name="tof_frameid" value="$(arg tof_frameid)" />
    
                <param name="image0_publish"    value="$(arg image0_publish)"    />
                <param name="image0_pipe"       value="$(arg image0_pipe)"       />
    
                <param name="image1_publish"    value="$(arg image1_publish)"    />
                <param name="image1_pipe"       value="$(arg image1_pipe)"       />
    
                <param name="image2_publish"    value="$(arg image2_publish)"    />
                <param name="image2_pipe"       value="$(arg image2_pipe)"       />
    
                <param name="image3_publish"    value="$(arg image3_publish)"    />
                <param name="image3_pipe"       value="$(arg image3_pipe)"       />
    
                <param name="image4_publish"    value="$(arg image4_publish)"    />
                <param name="image4_pipe"       value="$(arg image4_pipe)"       />
    
                <param name="image5_publish"    value="$(arg image5_publish)"    />
                <param name="image5_pipe"       value="$(arg image5_pipe)"       />
    
                <param name="image6_publish"    value="$(arg image6_publish)"    />
                <param name="image6_pipe"       value="$(arg image6_pipe)"       />
    
                <param name="image7_publish"    value="$(arg image7_publish)"    />
                <param name="image7_pipe"       value="$(arg image7_pipe)"       />
    
                <param name="stereo0_publish"   value="$(arg stereo0_publish)"   />
                <param name="stereo0_pipe"      value="$(arg stereo0_pipe)"      />
    
                <param name="stereo1_publish"   value="$(arg stereo1_publish)"   />
                <param name="stereo1_pipe"      value="$(arg stereo1_pipe)"      />
    
                <param name="tof0_publish"       value="$(arg tof0_publish)"     />
                <param name="tof0_pipe"          value="$(arg tof0_pipe)"        />
    
                <param name="tof1_publish"       value="$(arg tof1_publish)"     />
                <param name="tof1_pipe"          value="$(arg tof1_pipe)"        />
    
                <param name="imu0_publish"      value="$(arg imu0_publish)"      />
                <param name="imu0_pipe"         value="$(arg imu0_pipe)"         />
    
                <param name="imu1_publish"      value="$(arg imu1_publish)"      />
                <param name="imu1_pipe"         value="$(arg imu1_pipe)"         />
    
                <param name="vio0_publish"      value="$(arg vio0_publish)"      />
                <param name="vio0_pipe"         value="$(arg vio0_pipe)"         />
    
                <param name="vio1_publish"      value="$(arg vio1_publish)"      />
                <param name="vio1_pipe"         value="$(arg vio1_pipe)"         />
    
                <param name="PC0_publish"      value="$(arg PC0_publish)"        />
                <param name="PC0_pipe"         value="$(arg PC0_pipe)"           />
    
                <param name="PC1_publish"      value="$(arg PC1_publish)"        />
                <param name="PC1_pipe"         value="$(arg PC1_pipe)"           />
    
                <param name="PC2_publish"      value="$(arg PC2_publish)"        />
                <param name="PC2_pipe"         value="$(arg PC2_pipe)"           />
    
                <param name="PC3_publish"      value="$(arg PC3_publish)"        />
                <param name="PC3_pipe"         value="$(arg PC3_pipe)"           />
    
            </node>
    
            <group ns="$(arg image0_pipe)/image_raw" >
              <rosparam param="disable_pub_plugins">
                - 'image_transport/compressedDepth'
                - 'image_transport/compressed'
              </rosparam>
            </group>
        </group>
    
    </launch>
    

    I realized after running the above script and running:

    rostopic info tflite_metadata
    

    that I had falsely assumed that the PC0_pipe name was an empty slot for custom pipes and that it was actually used for point cloud data.

    I would like to be able to simply send JSON strings across custom pipes that will convert to rostopics with the mpa_to_ros service which is currently not possible since only the interfaces found here are supported.

    Would it be possible for ModalAI to add a feature to the voxl_mpa_to_ros code to allow for a custom pipe with JSON string data to be sent? It would make sense that the voxl_mpa_to_ros would be able to support converting any JSON string data sent across pipes in the libmodal pipe architecture with functions like int pipe_server_write(int ch, const void* data, int bytes); to be viewed in ROS.



  • Hello,

    I just wanted to follow up on the above post.

    Thanks!


  • Dev Team

    Hi Cole,

    Having libmodal_pipe better support sending custom packets/JSON is on our todo list for the next release and we'll be sure to add an mpa_to_ros interface for this, but I'd say that this is at least a month out. In the meantime it wouldn't be too hard to add a string interface to mpa_to_ros yourself (note that the source has been recently restructured and doesn't need the launch file to list every pipe anymore).



  • Thanks for the update @Alex-Gardner! Can you clarify what you mean when you say the source doesn't need the launch file anymore? What would be the proper way to launch mpa_to_ros without the launch file?


  • Dev Team

    There's still a launch file, but the service will automatically check for any new pipes fitting the defined interface types, and dynamically add them, so you don't need the crazy long launch file listing every possible pipe that could be available. For example, if you had your own service doing image processing and had an overlay image being written out to a pipe, mpa_to_ros will now automatically find the pipe and advertise it, you wouldn't have to add it to the launch file.



  • Should I be building the ipk package for my custom version of mpa_to_ros in the voxl-cross container? It appears that voxl-cross doesn't contain /opt/ros/indigo/setup.bash which is sourced by the build script in voxl_mpa_to_ros


  • Dev Team

    MPA_to_ROS is built in the voxl-emulator docker.



  • Thanks, @Alex-Gardner, for all your help!

    We were able to build it in the voxl-emulator.

    We were also able to successfully create a custom-made pipe that sends string data. With the latest mpa_to_ros, it is automatically advertised in ROS. We can see the topic and echo the topic data. It all works very nicely. Thanks again!



  • Great to hear! Feel free to create a pull request if you would like to get the feature into the mainline so you don't need to maintain a fork.


Log in to reply