1
$\begingroup$

Is there a way to enforce that clients can only send/receive messages to each other if they have the same discovery server URI?

I am trying to setup a classroom environment where on a single WLAN multiple Turtlebot 4s can be communicated with from student PCs without each student affecting another's robot.

I set up the following test:

  • Set up discovery server with a TB4 with the instructions here. I can teleop it with my laptop. Everything works fine.
  • Set up discovery server on a Raspberry Pi 4 whose micro SD card has the latest TB4 image (to avoid buying a 2nd Turtlebot just to do this test). Note that this is connected to the same network as the Turtlebot and my laptop.
  • Change the ROS_DISCOVERY_SERVER environment variable on my laptop to the URI of the standalone RPi.
  • Publish commands to /cmd_vel from my laptop. I expected this to NOT move the robot since the discovery server is matched with the standalone RPi. But the Turtlebot 4 gets the msgs and drives.

I want to be able to easily "switch" Turtlebots, but it seems like changing ROS_DISCOVERY_SERVER is not enough.

I think what I'm setting up are discovery partitions based on the documentation, but I'm not 100% sure. At the end of the partitions section, the docs state "Once two endpoints know each other, they do not need the server network between them to listen to each other messages." Is that what is messing this up, and if so can I disable that?

Any help understanding what's going wrong is appreciated.

$\endgroup$

2 Answers 2

1
$\begingroup$

The missing piece was my ip route table. I needed to change the route to the Create in order to "switch" Turtlebots.

sudo ip route del 192.168.186.0/24

sudo ip route add 192.168.186.0/24 via <RPi IP>

export ROS_DISCOVERY_SERVER=<RPi IP>:11811

That seems to work.

$\endgroup$
0
$\begingroup$

You need to assign a shared ROS_DOMAIN_ID only to those ros2 nodes which you want to communicate with each other. By default, all nodes are in DOMAIN 0.

$\endgroup$
1
  • $\begingroup$ I did need to do that, but that alone wasn't enough. I needed to update the route to the Create too. $\endgroup$ Feb 15 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.