topic_tools/mux outputs the wrong type

asked 2019-12-05 21:21:39 -0500

raygun_charles gravatar image

I'm wondering if there's a way to force mux to output a specific topic type. Right now I've got it taking in two Twist topics as input, as configured by the attached launch file, but it insists on publishing a std_msgs::String. I looked into twist_mux as well, but it seems far too complicated for what I need to do, which is just to manually select between 2 Twist inputs. Is there any way to force my mux_cmdvel to output a Twist, or do I have to write my own mux class to do this?

Here is my launch file:

<launch>
    <!-- uncomment for graph output -->
    <param name="enable_statistics" value="true"/>
    <node pkg="rqt_graph" name="debug_graph" type="rqt_graph"/>

    <!-- start up RVIZ -->
    <arg name="rviz_config_file" default="$(dirname)/bergbot_demo.rviz"/>
    <node pkg="rviz" name="rviz" type="rviz" args="-d $(arg rviz_config_file)"/>

    <!-- start up gmapping map node -->
    <node pkg="gmapping" name="world" type="slam_gmapping">
        <remap from="scan" to="/vrep/scan"/>
        <param name="map_update_interval" value="0.1"/>
        <param name="delta" value="0.1"/>
        <param name="linearUpdate" value="0.0"/>
        <param name="angularUpdate" value="0.0"/>
        <param name="odom_frame" value="base_link"/>
    </node>

    <node pkg="turtlesim" name="keyboard" type="turtle_teleop_key"/>

    <node pkg="bergbot" name="recognizer" type="bergbot_recognizer_node"/>

    <node pkg="topic_tools" name="mux_cmdvel" type="mux" args="vrep/cmd_vel recognizer/cmd_vel turtle1/cmd_vel">
        <remap from="mux" to="mux_cmdvel"/>
        <remap from="mux_cmdvel/selected" to="vrep/cmd_vel"/>
    </node>

</launch>

And here is the output of rosnode info mux_cmdvel, where you can see that the output vrep/cmd_vel does not match the input types:

--------------------------------------------------------------------------------
Node [/mux_cmdvel]
Publications: 
 * /rosout [rosgraph_msgs/Log]
 * /vrep/cmd_vel [std_msgs/String]

Subscriptions: 
 * /recognizer/cmd_vel [geometry_msgs/Twist]
 * /turtle1/cmd_vel [geometry_msgs/Twist]

Services: 
 * /mux_cmdvel/add
 * /mux_cmdvel/delete
 * /mux_cmdvel/get_loggers
 * /mux_cmdvel/list
 * /mux_cmdvel/select
 * /mux_cmdvel/set_logger_level
 * /vrep/cmd_vel_select


contacting node http://robot-VirtualBox:37449/ ...
Pid: 23459
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS
 * topic: /recognizer/cmd_vel
    * to: /recognizer (http://robot-VirtualBox:32813/)
    * direction: inbound
    * transport: TCPROS
 * topic: /turtle1/cmd_vel
    * to: /keyboard (http://robot-VirtualBox:43461/)
    * direction: inbound
    * transport: TCPROS
 * topic: /turtle1/cmd_vel
    * to: /teleop_turtle (http://robot-VirtualBox:42141/)
    * direction: inbound
    * transport: TCPROS

Any advice will be much appreciated.

edit retag flag offensive close merge delete

Comments

If the mux publishes a String my first assumption would be that something is giving it a String.

Can you rostopic info the topics that you are inputing into the mux to check?

gvdhoorn gravatar image gvdhoorn  ( 2019-12-06 03:04:41 -0500 )edit