|Note: This tutorial assumes that you have completed the previous tutorials: Rocon Launch, Launching a Hub.|
|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Launching a Gateway HubDescription: Launching and connecting to a Gateway Hub
Keywords: multimaster, gateway, hub
Tutorial Level: BEGINNER
Next Tutorial: Command Line Tools
To keep the workflow concise and clear, we are using rocon_launch to kickstart a multimaster environment using linux terminals running roscores on different ports.
The most minimalistic way to start a hub/gateway - preconfiguring via parameters.
You'll note that the hub has a parameter controlling which port the redis server should start on. The gateway also has a parameter configuring the uri where it can find the redis server.
> rocon_launch rocon_gateway_tutorials hub_by_param.concert --screen
You should see the client gateway registering on a hub named 'Bucanneer Hub'.
Sometimes the gateway uri is not known at startup. In which case the gateway can delay its connection to the hub until the hub uri (redis uri) is known. The following rocon launcher starts up hub, gateway and also a simple python script (connect_by_service.py) to call the ros service for connection.
> rocon_launch rocon_gateway_tutorials hub_by_service.concert --screen
Lastly, you can use zeroconf to auto-discover the hub's uri and automatically connect.
> rocon_launch rocon_gateway_tutorials hub_by_zeroconf.concert --screen
Gateways typically connect to the first auto-discovered hub or first configured hub (either by param or ros api). They can be configured to selectively filter or choose a particular hub via the hub's name parameter and the gateways' hub_whitelist and hub_blacklist arrays.
All of the previous buccaneer launchers specifically set the hub name to Bucanneer Hub and also insert the same name into each gateway's hub_whitelist array. For now, these parameters are semi-colon separated list. If/when rosparam supports use of $(arg ...) in its value element, then we'll move to proper lists.
# In the hub launcher <rosparam param="name">Buccaneer Hub</rosparam> # In the gateway launcher <rosparam param="hub_whitelist">Buccaneer Hub;Pirate Hub</rosparam>