[Documentation] [TitleIndex] [WordIndex

Enforcing graph topology

SROS can optionally enforce the topology of the graph between runs, as demonstrated during a "training run." Again using the "hello, world" message talker/listener as a minimal example, we can pass arguments to sroscore to save the graph topology to disk, and then enforce it during subsequent runs.

Initial training run

Terminal 1

cd ~/sros
source install/setup.bash
sroscore sroscore --keyserver --graph=talker_listener --mode=train

Terminal 2

cd ~/sros
source install/setup.bash
srosrun rospy_tutorials talker

Terminal 3

cd ~/sros
source install/setup.bash
srosrun rospy_tutorials listener

Re-launching with graph enforcement

Once everything is up and streaming, Ctrl+C everything, and then relaunch with the following arguments to sroscore:

sroscore --keyserver --graph=talker_listener --mode=enforce

Then re-launch the other terminals for talker and listener as before. With those terminals up and streaming "hello, world" happily, let's start yet another terminal and try to listen to the data stream with another listener instance that we'll call listener2:

cd ~/sros
source install/setup.bash
srosrun rospy_tutorials listener __name:=listener2

You'll see this:

[FATAL] [WallTime: 1464674575.793542] unable to register subscription [/chatter] with master: request denied by security policy

Hooray! SROS was unwilling to talk to allow listener2 to subscribe, since it wasn't there during the training run.

Re-launching with graph enforcement and no keyserver

However, when running without the default keyserver, unauthorized nodes wouldn't even get that far, since they wouldn't have keys to talk to master! If we run sroscore with all security features enabled:

sroscore --graph=talker_listener --mode=enforce

we get this when trying to start a new node called listener3:

  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
socket.error: [Errno 111] Connection refused

since we didn't have keys to talk to sroscore

2024-06-08 14:21