|Note: This tutorial assumes that you have completed the previous tutorials: Redis Debugging.|
|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
The relevant launchers are all nicknamed buccaneer_xxx.launch in this package. Take particular note of the parameters configured in each.
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.
# 1st Shell > roslaunch --port=11311 rocon_gateway_tutorials buccaneer_hub.launch # 2nd Shell > roslaunch --port=11312 rocon_gateway_tutorials buccaneer_gateway_param.launch
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.
# 1st Shell > roslaunch --port=11311 rocon_gateway_tutorials buccaneer_hub.launch # 2nd Shell > roslaunch --port=11312 rocon_gateway_tutorials buccaneer_gateway_ros_api.launch # 3rd Shell > export ROS_MASTER_URI=http://localhost:11312 > rosrun rocon_gateway_tutorials connect_localhost.py
The script connect_localhost.py simply calls the connect_hub service with the required parameters.
Lastly, you can use zeroconf to auto-discover the hub's uri and automatically connect.
# 1st Shell > roslaunch --port=11311 rocon_gateway_tutorials buccaneer_hub.launch # 2nd Shell > roslaunch --port=11312 rocon_gateway_tutorials buccaneer_gateway_zeroconf.launch
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.
# In the hub launcher <rosparam param="name">Buccaneer Hub</rosparam> # In the gateway launcher <rosparam param="hub_whitelist">['Buccaneer Hub']</rosparam>