Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to bridge between ROS_LOCALHOST=0 and ROS_LOCALHOST=1 #78

Open
wants to merge 1 commit into
base: humble
Choose a base branch
from

Conversation

cyrilleberger
Copy link

Nodes started with ROS_LOCALHOST=0 cannot communicate directly with nodes started with ROS_LOCALHOST=1 (at least with fastdds). With this change we can now specify the localhost mode for the "from" and "to". This allow to use ROS_LOCALHOST=0 to keep topic private, and selectively export the topic.

This was done by adding two new keys to yaml from_local_host_only/to_local_host_only, which can take "default", "enabled" and "disabled", mimicking the values in rmw_localhost_only_e.

The following configuration was used to forward the chatter topic from a localhost only talker to the general world:

# Name of the domain bridge, used for node naming and logging
name: my_bridge
from_domain: 42
from_local_host_only: "enabled"
to_domain: 42
to_local_host_only: "disabled"
topics:
  # Bridge "/chatter" topic from doman ID 42 (local host only) to domain ID 42 (everywhere)
  chatter:
    type: std_msgs/msg/String

Can be tested by starting:

ROS_DOMAIN_ID=42 ROS_LOCALHOST_ONLY=1 ros2 run demo_nodes_cpp talker
ROS_DOMAIN_ID=42 ROS_LOCALHOST_ONLY=0 ros2 run demo_nodes_cpp listener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant