diff --git a/launch/app_manager.launch b/launch/app_manager.launch index 2b9e3f7..3eadb13 100644 --- a/launch/app_manager.launch +++ b/launch/app_manager.launch @@ -24,6 +24,12 @@ + + + + @@ -41,8 +47,12 @@ - - - + + interface_master: http://$(arg master_address):$(arg master_port) + enable_app_replacement: $(arg enable_app_replacement) + enable_topic_remapping: $(arg enable_topic_remapping) + sigint_timeout: $(arg sigint_timeout) + sigterm_timeout: $(arg sigterm_timeout) + diff --git a/scripts/app_manager b/scripts/app_manager index b941cf1..4fcd61e 100755 --- a/scripts/app_manager +++ b/scripts/app_manager @@ -103,10 +103,12 @@ def main(): sys.exit(1) enable_app_replacement = rospy.get_param('~enable_app_replacement', True) + enable_topic_remapping = rospy.get_param('~enable_topic_remapping', True) am = app_manager.AppManager( robot_name, interface_master, app_list, exchange, plugins, enable_app_replacement=enable_app_replacement, + enable_topic_remapping=enable_topic_remapping, sigint_timeout=sigint_timeout, sigterm_timeout=sigterm_timeout) rospy.on_shutdown(am.shutdown) diff --git a/src/app_manager/app_manager.py b/src/app_manager/app_manager.py index f6fb7a0..9115c40 100644 --- a/src/app_manager/app_manager.py +++ b/src/app_manager/app_manager.py @@ -125,6 +125,7 @@ class AppManager(object): def __init__( self, robot_name, interface_master, app_list, exchange, plugins=None, enable_app_replacement=True, + enable_topic_remapping=True, sigint_timeout=15.0, sigterm_timeout=2.0, ): self._robot_name = robot_name @@ -134,6 +135,7 @@ def __init__( self._exchange = exchange self._plugins = plugins self._enable_app_replacement = enable_app_replacement + self._enable_topic_remapping = enable_topic_remapping self._sigint_timeout = sigint_timeout self._sigterm_timeout = sigterm_timeout @@ -442,11 +444,12 @@ def handle_start_app(self, req): nodes.extend(self._launch.config.nodes) if app.run: nodes.append(app.run) - for N in nodes: - for t in app.interface.published_topics.keys(): - N.remap_args.append((t, self._app_interface + '/' + t)) - for t in app.interface.subscribed_topics.keys(): - N.remap_args.append((t, self._app_interface + '/' + t)) + if self._enable_topic_remapping: + for N in self._launch.config.nodes: + for t in app.interface.published_topics.keys(): + N.remap_args.append((t, self._app_interface + '/' + t)) + for t in app.interface.subscribed_topics.keys(): + N.remap_args.append((t, self._app_interface + '/' + t)) # run plugin modules first self._current_plugin_processes = [] @@ -514,8 +517,11 @@ def handle_start_app(self, req): if app.timeout is not None: self._start_time = rospy.Time.now() - fp = [self._app_interface + '/' + x for x in app.interface.subscribed_topics.keys()] - lp = [self._app_interface + '/' + x for x in app.interface.published_topics.keys()] + fp = [x for x in app.interface.subscribed_topics.keys()] + lp = [x for x in app.interface.published_topics.keys()] + if self._enable_topic_remapping: + fp = [self._app_interface + '/' + x for x in fp] + lp = [self._app_interface + '/' + x for x in lp] self._interface_sync = MasterSync(self._interface_master, foreign_pub_names=fp, local_pub_names=lp)