Skip to content

Topics Crosslinked When 2 Similar Robots Viewing Each Other's /tf #178

Description

@KKSTB

I have made 2 similar robots connected to each other using multimaster. I used topic_tools relay to copy the required topics (e.g. /tf, /tf_static) to another topics (e.g. /robot1/tf, /robot2/tf). To sync these topics, I used master_sync's sync_nodes to sync the relay nodes.

Also to display the robot model, I created a service to let other robot getting the robot description so that it can set it to rosparam.

A sample launch file of the robot:

<?xml version="1.0"?>
<launch>
    <arg name="net_name" default="robot"/>
    <arg name="net_id" default="1"/>
    <node name="$(arg net_name)$(arg net_id)_tf" pkg="topic_tools" type="relay" output="screen" args="/tf /$(arg net_name)$(arg net_id)/tf"/>
    <node name="$(arg net_name)$(arg net_id)_tf_static" pkg="topic_tools" type="relay" output="screen" args="/tf_static /$(arg net_name)$(arg net_id)/tf_static"/>
    <node name="$(arg net_name)$(arg net_id)_robot_description" pkg="my_pkg" type="get_robot_description.py" output="screen" args="-ns=$(arg net_name)$(arg net_id)"/>

    <node name="master_discovery" pkg="fkie_master_discovery" type="master_discovery" output="screen"/>
    <node name="master_sync" pkg="fkie_master_sync" type="master_sync" output="screen">
        <rosparam param="sync_nodes" subst_value="True">['/$(arg net_name)*']</rosparam>
    </node>
</launch>

Then I use RViz to view the robot:
rviz /tf:=/robot2/tf /tf_static:=/robot2/tf_static /robot_description:=/robot2/robot_description

Scenario 1 (work):

  1. Robot2 running with the above launch file launched
  2. Robot1 not running but with the above launch file launched and used my get_robot_description.py to obtain robot2's robot description. Then use the above RViz command to view robot2's state (correct and I can see robot2's movement)

Scenario 2 (not work):

  1. Robot2 running with the above launch file launched
  2. Robot1 running with the above launch file launched, and used my get_robot_description.py to obtain both robot's robot description. Then use the above RViz command to view robot2's state (I see robot1's /tf is used instead, and robot2's robot_description is used, so that the visual model is wrong and robot1's movement is shown instead). Use another terminal and RViz command to view robot1's state (I see robot2's /tf is used instead, and robot1's robot_description is used, so that the visual model is wrong and robot2's movement is shown instead)

So it seems the sync topics are kind of crosslinked, while services are ok.

I also tried master_sync's ignore_nodes to ignore all the robot core's nodes but no difference. Is there something that I have missed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions