def main(self, *, args): container = run_standalone_container( container_node_name=args.container_node_name) with DirectNode(args) as node: try: load_component_into_container( node=node, remote_container_node_name=args.container_node_name, package_name=args.package_name, plugin_name=args.plugin_name, node_name=args.node_name, node_namespace=args.node_namespace, log_level=args.log_level, remap_rules=args.remap_rules, parameters=args.parameters, extra_arguments=args.extra_arguments) except RuntimeError as ex: # In case the component fails to load, kill the container. print('{}, interrupting container node'.format(ex)) if platform.system() == 'Windows': container.send_signal(signal.CTRL_C_EVENT) else: container.send_signal(signal.SIGINT) while container.returncode is None: try: container.communicate() except KeyboardInterrupt: # the subprocess will also receive the signal and should shut down # therefore we continue here until the process has finished pass return container.returncode
def main(self, *, args): container = run_standalone_container( container_node_name=args.container_node_name) with DirectNode(args) as node: load_component_into_container( node=node, remote_container_node_name=args.container_node_name, package_name=args.package_name, plugin_name=args.plugin_name, node_name=args.node_name, node_namespace=args.node_namespace, log_level=args.log_level, remap_rules=args.remap_rules, parameters=args.parameters, extra_arguments=args.extra_arguments) while container.returncode is None: try: container.communicate() except KeyboardInterrupt: # the subprocess will also receive the signal and should shut down # therefore we continue here until the process has finished pass return container.returncode
def main(self, *, args): with NodeStrategy(args) as node: node_names = get_node_names(node=node) with DirectNode(args) as node: container_node_names = find_container_node_names( node=node, node_names=node_names) rclpy.init() node = rclpy.create_node(NODE_NAME_PREFIX + '_component_load_requester') try: if args.container_node_name in [ n.full_name for n in container_node_names ]: return load_component_into_container( node=node, remote_container_node_name=args.container_node_name, package_name=args.package_name, plugin_name=args.plugin_name, node_name=args.node_name, node_namespace=args.node_namespace, log_level=args.log_level, remap_rules=args.remap_rules, parameters=args.parameters, extra_arguments=args.extra_arguments) else: return "Unable to find container node '" + args.container_node_name + "'" finally: node.destroy_node() rclpy.shutdown()
def main(self, *, args): with NodeStrategy(args) as node: container_node_names = find_container_node_names( node=node, node_names=get_node_names(node=node)) if args.container_node_name not in [ n.full_name for n in container_node_names ]: return "Unable to find container node '" + args.container_node_name + "'" component_uid, component_name = load_component_into_container( node=node, remote_container_node_name=args.container_node_name, package_name=args.package_name, plugin_name=args.plugin_name, node_name=args.node_name, node_namespace=args.node_namespace, log_level=args.log_level, remap_rules=args.remap_rules, parameters=args.parameters, extra_arguments=args.extra_arguments) if not args.quiet: print("Loaded component {} into '{}' container node as '{}'". format(component_uid, args.container_node_name, component_name)) else: print('{} {}'.format(component_uid, component_name))