Note: This tutorial assumes that you have completed the previous tutorials: Advertising and Pulling. |
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. |
Writing Gateway Launchers
Description: Tips on writing launchers that incorporate a gateway into your ros master.Keywords: rocon, gateway
Tutorial Level: INTERMEDIATE
Tips
There are some key features that are typical to most gateway launchers:
Public Args: exposing variables to users who'd like to modify behaviour from their own launcher
Firewalling: blocking anything coming into your robot
Default Flips/Pulls: setting a few regular expression rules to define flips/pulls that you want activated by default (saves alot of service calling).
Hub Whitelists/Blacklists: be selective about where your gateway interacts on the lan.
Example
The following is a launcher used by the rocon_app_manager and demonstrates all of the above features.
<launch> <arg name="gateway_name" default="gateway"/> <!-- Polling period for multimaster advertising/flipping --> <arg name="gateway_watch_loop_period" default="5"/> <!-- semi-colon separated hub names/regex patterns --> <arg name="hub_whitelist" default=""/> <node pkg="rocon_gateway" type="gateway.py" name="gateway"> <rosparam command="load" file="$(find rocon_gateway)/param/default.yaml" /> <rosparam command="load" file="$(find rocon_gateway)/param/default_blacklist.yaml" /> <rosparam command="load" file="$(find rocon_app_manager)/param/app_manager_advertisements.yaml" /> <rosparam command="load" file="$(find rocon_app_manager)/param/app_manager_flips.yaml" /> <!-- The paired hub, if available --> <rosparam param="hub_uri">http://localhost:6380</rosparam> <param name="name" value="$(arg gateway_name)"/> <!-- Nothing comes in! --> <rosparam param="firewall">true</rosparam> <param name="watch_loop_period" value="$(arg gateway_watch_loop_period)"/> <param name="hub_whitelist" value="$(arg hub_whitelist)"/> </node> </launch>