From 8ffe7dff2d7ca8cca204c316edb0479bd99fd133 Mon Sep 17 00:00:00 2001 From: "Dr. Denis" Date: Wed, 8 Feb 2023 19:42:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=96=A4=20Add=20Black=20formatter=20for=20?= =?UTF-8?q?Python=20files.=20(#936)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 10 +- .../controller_manager/__init__.py | 20 +- .../controller_manager_services.py | 94 +++++-- .../controller_manager/launch_utils.py | 59 ++-- .../controller_manager/spawner.py | 264 +++++++++++------- .../controller_manager/unspawner.py | 33 +-- .../test/joint_limits_rosparam.launch.py | 4 +- ros2controlcli/ros2controlcli/api/__init__.py | 24 +- .../ros2controlcli/command/control.py | 6 +- .../verb/list_controller_types.py | 2 +- .../ros2controlcli/verb/list_controllers.py | 59 ++-- .../verb/list_hardware_components.py | 43 +-- .../verb/list_hardware_interfaces.py | 24 +- .../ros2controlcli/verb/load_controller.py | 28 +- .../verb/reload_controller_libraries.py | 6 +- .../verb/set_controller_state.py | 56 ++-- .../ros2controlcli/verb/switch_controllers.py | 54 ++-- .../ros2controlcli/verb/unload_controller.py | 6 +- .../verb/view_controller_chains.py | 144 ++++++---- ros2controlcli/setup.py | 72 ++--- .../test/test_view_controller_chains.py | 10 +- .../controller_manager.py | 102 +++---- .../rqt_controller_manager/main.py | 4 +- .../rqt_controller_manager/update_combo.py | 3 +- rqt_controller_manager/setup.py | 22 +- 25 files changed, 666 insertions(+), 483 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7972346fb..4af4875830 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,11 +43,17 @@ repos: # PyDocStyle - repo: https://github.com/PyCQA/pydocstyle - rev: 6.2.2 + rev: 6.3.0 hooks: - id: pydocstyle args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"] + - repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + args: ["--line-length=99"] + - repo: https://github.com/pycqa/flake8 rev: 6.0.0 hooks: @@ -117,7 +123,7 @@ repos: exclude: CHANGELOG\.rst$ - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: rst-backticks exclude: CHANGELOG\.rst$ diff --git a/controller_manager/controller_manager/__init__.py b/controller_manager/controller_manager/__init__.py index ee5cbdd3f0..ca90f4a2c6 100644 --- a/controller_manager/controller_manager/__init__.py +++ b/controller_manager/controller_manager/__init__.py @@ -21,17 +21,17 @@ load_controller, reload_controller_libraries, switch_controllers, - unload_controller + unload_controller, ) __all__ = [ - 'configure_controller', - 'list_controller_types', - 'list_controllers', - 'list_hardware_components', - 'list_hardware_interfaces', - 'load_controller', - 'reload_controller_libraries', - 'switch_controllers', - 'unload_controller', + "configure_controller", + "list_controller_types", + "list_controllers", + "list_hardware_components", + "list_hardware_interfaces", + "load_controller", + "reload_controller_libraries", + "switch_controllers", + "unload_controller", ] diff --git a/controller_manager/controller_manager/controller_manager_services.py b/controller_manager/controller_manager/controller_manager_services.py index 8fb2c1aca7..b5a712778e 100644 --- a/controller_manager/controller_manager/controller_manager_services.py +++ b/controller_manager/controller_manager/controller_manager_services.py @@ -12,9 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from controller_manager_msgs.srv import ConfigureController, \ - ListControllers, ListControllerTypes, ListHardwareComponents, ListHardwareInterfaces, \ - LoadController, ReloadControllerLibraries, SwitchController, UnloadController +from controller_manager_msgs.srv import ( + ConfigureController, + ListControllers, + ListControllerTypes, + ListHardwareComponents, + ListHardwareInterfaces, + LoadController, + ReloadControllerLibraries, + SwitchController, + UnloadController, +) import rclpy @@ -24,68 +32,90 @@ def service_caller(node, service_name, service_type, request, service_timeout=10 if not cli.service_is_ready(): node.get_logger().debug( - f'waiting {service_timeout} seconds for service {service_name} to become available...') + f"waiting {service_timeout} seconds for service {service_name} to become available..." + ) if not cli.wait_for_service(service_timeout): - raise RuntimeError(f'Could not contact service {service_name}') + raise RuntimeError(f"Could not contact service {service_name}") - node.get_logger().debug(f'requester: making request: {request}\n') + node.get_logger().debug(f"requester: making request: {request}\n") future = cli.call_async(request) rclpy.spin_until_future_complete(node, future) if future.result() is not None: return future.result() else: - raise RuntimeError(f'Exception while calling service: {future.exception()}') + raise RuntimeError(f"Exception while calling service: {future.exception()}") def configure_controller(node, controller_manager_name, controller_name): request = ConfigureController.Request() request.name = controller_name - return service_caller(node, f'{controller_manager_name}/configure_controller', - ConfigureController, request) + return service_caller( + node, f"{controller_manager_name}/configure_controller", ConfigureController, request + ) def list_controllers(node, controller_manager_name): request = ListControllers.Request() - return service_caller(node, f'{controller_manager_name}/list_controllers', - ListControllers, request) + return service_caller( + node, f"{controller_manager_name}/list_controllers", ListControllers, request + ) def list_controller_types(node, controller_manager_name): request = ListControllerTypes.Request() - return service_caller(node, - f'{controller_manager_name}/list_controller_types', - ListControllerTypes, request) + return service_caller( + node, f"{controller_manager_name}/list_controller_types", ListControllerTypes, request + ) def list_hardware_components(node, controller_manager_name): request = ListHardwareComponents.Request() - return service_caller(node, f'{controller_manager_name}/list_hardware_components', - ListHardwareComponents, request) + return service_caller( + node, + f"{controller_manager_name}/list_hardware_components", + ListHardwareComponents, + request, + ) def list_hardware_interfaces(node, controller_manager_name): request = ListHardwareInterfaces.Request() - return service_caller(node, f'{controller_manager_name}/list_hardware_interfaces', - ListHardwareInterfaces, request) + return service_caller( + node, + f"{controller_manager_name}/list_hardware_interfaces", + ListHardwareInterfaces, + request, + ) def load_controller(node, controller_manager_name, controller_name): request = LoadController.Request() request.name = controller_name - return service_caller(node, f'{controller_manager_name}/load_controller', - LoadController, request) + return service_caller( + node, f"{controller_manager_name}/load_controller", LoadController, request + ) def reload_controller_libraries(node, controller_manager_name, force_kill): request = ReloadControllerLibraries.Request() request.force_kill = force_kill - return service_caller(node, - f'{controller_manager_name}/reload_controller_libraries', - ReloadControllerLibraries, request) - - -def switch_controllers(node, controller_manager_name, deactivate_controllers, - activate_controllers, strict, activate_asap, timeout): + return service_caller( + node, + f"{controller_manager_name}/reload_controller_libraries", + ReloadControllerLibraries, + request, + ) + + +def switch_controllers( + node, + controller_manager_name, + deactivate_controllers, + activate_controllers, + strict, + activate_asap, + timeout, +): request = SwitchController.Request() request.activate_controllers = activate_controllers request.deactivate_controllers = deactivate_controllers @@ -95,12 +125,14 @@ def switch_controllers(node, controller_manager_name, deactivate_controllers, request.strictness = SwitchController.Request.BEST_EFFORT request.activate_asap = activate_asap request.timeout = rclpy.duration.Duration(seconds=timeout).to_msg() - return service_caller(node, f'{controller_manager_name}/switch_controller', - SwitchController, request) + return service_caller( + node, f"{controller_manager_name}/switch_controller", SwitchController, request + ) def unload_controller(node, controller_manager_name, controller_name): request = UnloadController.Request() request.name = controller_name - return service_caller(node, f'{controller_manager_name}/unload_controller', - UnloadController, request) + return service_caller( + node, f"{controller_manager_name}/unload_controller", UnloadController, request + ) diff --git a/controller_manager/controller_manager/launch_utils.py b/controller_manager/controller_manager/launch_utils.py index d3f9356eae..93941cc11f 100644 --- a/controller_manager/controller_manager/launch_utils.py +++ b/controller_manager/controller_manager/launch_utils.py @@ -19,9 +19,9 @@ from launch_ros.actions import Node -def generate_load_controller_launch_description(controller_name, - controller_type=None, - controller_params_file=None): +def generate_load_controller_launch_description( + controller_name, controller_type=None, controller_params_file=None +): """ Generate launch description for loading a controller using spawner. @@ -44,38 +44,53 @@ def generate_load_controller_launch_description(controller_name, """ declare_controller_mgr_name = DeclareLaunchArgument( - 'controller_manager_name', default_value='controller_manager', - description='Controller manager node name' + "controller_manager_name", + default_value="controller_manager", + description="Controller manager node name", ) declare_unload_on_kill = DeclareLaunchArgument( - 'unload_on_kill', default_value='false', - description='Wait until the node is interrupted and then unload controller' + "unload_on_kill", + default_value="false", + description="Wait until the node is interrupted and then unload controller", ) spawner_arguments = [ controller_name, - '--controller-manager', - LaunchConfiguration('controller_manager_name') + "--controller-manager", + LaunchConfiguration("controller_manager_name"), ] if controller_type: - spawner_arguments += ['--controller-type', controller_type] + spawner_arguments += ["--controller-type", controller_type] if controller_params_file: - spawner_arguments += ['--param-file', controller_params_file] + spawner_arguments += ["--param-file", controller_params_file] # Setting --unload-on-kill if launch arg unload_on_kill is "true" # See https://github.com/ros2/launch/issues/290 - spawner_arguments += [PythonExpression( - ['"--unload-on-kill"', ' if "true" == "', - LaunchConfiguration('unload_on_kill'), '" else ""'] - )] + spawner_arguments += [ + PythonExpression( + [ + '"--unload-on-kill"', + ' if "true" == "', + LaunchConfiguration("unload_on_kill"), + '" else ""', + ] + ) + ] - spawner = Node(package='controller_manager', executable='spawner', - arguments=spawner_arguments, shell=True, output='screen') + spawner = Node( + package="controller_manager", + executable="spawner", + arguments=spawner_arguments, + shell=True, + output="screen", + ) - return LaunchDescription([ - declare_controller_mgr_name, - declare_unload_on_kill, - spawner, - ]) + return LaunchDescription( + [ + declare_controller_mgr_name, + declare_unload_on_kill, + spawner, + ] + ) diff --git a/controller_manager/controller_manager/spawner.py b/controller_manager/controller_manager/spawner.py index f5e74c0b78..11b710aaeb 100644 --- a/controller_manager/controller_manager/spawner.py +++ b/controller_manager/controller_manager/spawner.py @@ -20,8 +20,13 @@ import time import warnings -from controller_manager import configure_controller, list_controllers, \ - load_controller, switch_controllers, unload_controller +from controller_manager import ( + configure_controller, + list_controllers, + load_controller, + switch_controllers, + unload_controller, +) import rclpy from rcl_interfaces.msg import Parameter @@ -36,15 +41,15 @@ class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKCYAN = '\033[96m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' + HEADER = "\033[95m" + OKBLUE = "\033[94m" + OKCYAN = "\033[96m" + OKGREEN = "\033[92m" + WARNING = "\033[93m" + FAIL = "\033[91m" + ENDC = "\033[0m" + BOLD = "\033[1m" + UNDERLINE = "\033[4m" def first_match(iterable, predicate): @@ -56,21 +61,22 @@ def wait_for_value_or(function, node, timeout, default, description): if result := function(): return result node.get_logger().info( - f'Waiting for {description}', - throttle_duration_sec=2, skip_first=True) + f"Waiting for {description}", throttle_duration_sec=2, skip_first=True + ) time.sleep(0.2) return default def combine_name_and_namespace(name_and_namespace): node_name, namespace = name_and_namespace - return namespace + ('' if namespace.endswith('/') else '/') + node_name + return namespace + ("" if namespace.endswith("/") else "/") + node_name def find_node_and_namespace(node, full_node_name): node_names_and_namespaces = node.get_node_names_and_namespaces() - return first_match(node_names_and_namespaces, - lambda n: combine_name_and_namespace(n) == full_node_name) + return first_match( + node_names_and_namespaces, lambda n: combine_name_and_namespace(n) == full_node_name + ) def has_service_names(node, node_name, node_namespace, service_names): @@ -84,29 +90,37 @@ def has_service_names(node, node_name, node_namespace, service_names): def wait_for_controller_manager(node, controller_manager, timeout_duration): # List of service names from controller_manager we wait for service_names = ( - f'{controller_manager}/configure_controller', - f'{controller_manager}/list_controllers', - f'{controller_manager}/list_controller_types', - f'{controller_manager}/list_hardware_components', - f'{controller_manager}/list_hardware_interfaces', - f'{controller_manager}/load_controller', - f'{controller_manager}/reload_controller_libraries', - f'{controller_manager}/switch_controller', - f'{controller_manager}/unload_controller' + f"{controller_manager}/configure_controller", + f"{controller_manager}/list_controllers", + f"{controller_manager}/list_controller_types", + f"{controller_manager}/list_hardware_components", + f"{controller_manager}/list_hardware_interfaces", + f"{controller_manager}/load_controller", + f"{controller_manager}/reload_controller_libraries", + f"{controller_manager}/switch_controller", + f"{controller_manager}/unload_controller", ) # Wait for controller_manager timeout = node.get_clock().now() + Duration(seconds=timeout_duration) node_and_namespace = wait_for_value_or( lambda: find_node_and_namespace(node, controller_manager), - node, timeout, None, f'\'{controller_manager}\' node to exist') + node, + timeout, + None, + f"'{controller_manager}' node to exist", + ) # Wait for the services if the node was found if node_and_namespace: node_name, namespace = node_and_namespace return wait_for_value_or( lambda: has_service_names(node, node_name, namespace, service_names), - node, timeout, False, f"'{controller_manager}' services to be available") + node, + timeout, + False, + f"'{controller_manager}' services to be available", + ) return False @@ -117,42 +131,63 @@ def is_controller_loaded(node, controller_manager, controller_name): def main(args=None): - rclpy.init(args=args, signal_handler_options=SignalHandlerOptions.NO) parser = argparse.ArgumentParser() + parser.add_argument("controller_name", help="Name of the controller") parser.add_argument( - 'controller_name', help='Name of the controller') - parser.add_argument( - '-c', '--controller-manager', help='Name of the controller manager ROS node', - default='controller_manager', required=False) + "-c", + "--controller-manager", + help="Name of the controller manager ROS node", + default="controller_manager", + required=False, + ) parser.add_argument( - '-p', '--param-file', - help='Controller param file to be loaded into controller node before configure', - required=False) + "-p", + "--param-file", + help="Controller param file to be loaded into controller node before configure", + required=False, + ) parser.add_argument( - '-n', '--namespace', - help='Namespace for the controller', default='', - required=False) + "-n", "--namespace", help="Namespace for the controller", default="", required=False + ) parser.add_argument( - '--load-only', help='Only load the controller and leave unconfigured.', - action='store_true', required=False) + "--load-only", + help="Only load the controller and leave unconfigured.", + action="store_true", + required=False, + ) parser.add_argument( - '--stopped', help='Load and configure the controller, however do not activate them', - action='store_true', required=False) + "--stopped", + help="Load and configure the controller, however do not activate them", + action="store_true", + required=False, + ) parser.add_argument( - '--inactive', help='Load and configure the controller, however do not activate them', - action='store_true', required=False) + "--inactive", + help="Load and configure the controller, however do not activate them", + action="store_true", + required=False, + ) parser.add_argument( - '-t', '--controller-type', - help='If not provided it should exist in the controller manager namespace', - default=None, required=False) + "-t", + "--controller-type", + help="If not provided it should exist in the controller manager namespace", + default=None, + required=False, + ) parser.add_argument( - '-u', '--unload-on-kill', - help='Wait until this application is interrupted and unload controller', - action='store_true') + "-u", + "--unload-on-kill", + help="Wait until this application is interrupted and unload controller", + action="store_true", + ) parser.add_argument( - '--controller-manager-timeout', - help='Time to wait for the controller manager', required=False, default=10, type=int) + "--controller-manager-timeout", + help="Time to wait for the controller manager", + required=False, + default=10, + type=int, + ) command_line_args = rclpy.utilities.remove_ros_args(args=sys.argv)[1:] args = parser.parse_args(command_line_args) @@ -168,78 +203,116 @@ def main(args=None): prefixed_controller_name = controller_name if controller_namespace: - prefixed_controller_name = controller_namespace + '/' + controller_name + prefixed_controller_name = controller_namespace + "/" + controller_name - node = Node('spawner_' + controller_name) - if not controller_manager_name.startswith('/'): + node = Node("spawner_" + controller_name) + if not controller_manager_name.startswith("/"): spawner_namespace = node.get_namespace() - if spawner_namespace != '/': + if spawner_namespace != "/": controller_manager_name = f"{spawner_namespace}/{controller_manager_name}" else: controller_manager_name = f"/{controller_manager_name}" try: - if not wait_for_controller_manager(node, controller_manager_name, - controller_manager_timeout): - node.get_logger().error('Controller manager not available') + if not wait_for_controller_manager( + node, controller_manager_name, controller_manager_timeout + ): + node.get_logger().error("Controller manager not available") return 1 if is_controller_loaded(node, controller_manager_name, prefixed_controller_name): - node.get_logger().warn('Controller already loaded, skipping load_controller') + node.get_logger().warn("Controller already loaded, skipping load_controller") else: if controller_type: parameter = Parameter() - Parameter.name = prefixed_controller_name + '.type' + Parameter.name = prefixed_controller_name + ".type" parameter.value = get_parameter_value(string_value=controller_type) response = call_set_parameters( - node=node, node_name=controller_manager_name, parameters=[parameter]) + node=node, node_name=controller_manager_name, parameters=[parameter] + ) assert len(response.results) == 1 result = response.results[0] if result.successful: - node.get_logger().info(bcolors.OKCYAN + 'Set controller type to "' + controller_type + '" for ' + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + node.get_logger().info( + bcolors.OKCYAN + + 'Set controller type to "' + + controller_type + + '" for ' + + bcolors.BOLD + + prefixed_controller_name + + bcolors.ENDC + ) else: - node.get_logger().fatal(bcolors.FAIL + 'Could not set controller type to "' + controller_type + '" for ' + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + node.get_logger().fatal( + bcolors.FAIL + + 'Could not set controller type to "' + + controller_type + + '" for ' + + bcolors.BOLD + + prefixed_controller_name + + bcolors.ENDC + ) return 1 ret = load_controller(node, controller_manager_name, controller_name) if not ret.ok: - node.get_logger().fatal(bcolors.FAIL + 'Failed loading controller ' + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + node.get_logger().fatal( + bcolors.FAIL + + "Failed loading controller " + + bcolors.BOLD + + prefixed_controller_name + + bcolors.ENDC + ) return 1 - node.get_logger().info(bcolors.OKBLUE + 'Loaded ' + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + node.get_logger().info( + bcolors.OKBLUE + "Loaded " + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC + ) if param_file: - load_parameter_file(node=node, node_name=prefixed_controller_name, parameter_file=param_file, - use_wildcard=True) - node.get_logger().info(bcolors.OKCYAN + 'Loaded parameters file "' + param_file + '" for ' + bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + load_parameter_file( + node=node, + node_name=prefixed_controller_name, + parameter_file=param_file, + use_wildcard=True, + ) + node.get_logger().info( + bcolors.OKCYAN + + 'Loaded parameters file "' + + param_file + + '" for ' + + bcolors.BOLD + + prefixed_controller_name + + bcolors.ENDC + ) # TODO(destogl): use return value when upstream return value is merged # ret = # if ret.returncode != 0: # Error message printed by ros2 param # return ret.returncode - node.get_logger().info('Loaded ' + param_file + ' into ' + prefixed_controller_name) + node.get_logger().info("Loaded " + param_file + " into " + prefixed_controller_name) if not args.load_only: ret = configure_controller(node, controller_manager_name, controller_name) if not ret.ok: - node.get_logger().error('Failed to configure controller') + node.get_logger().error("Failed to configure controller") return 1 if not args.stopped and not args.inactive: ret = switch_controllers( - node, - controller_manager_name, - [], - [controller_name], - True, - True, - 5.0) + node, controller_manager_name, [], [controller_name], True, True, 5.0 + ) if not ret.ok: - node.get_logger().error('Failed to activate controller') + node.get_logger().error("Failed to activate controller") return 1 - node.get_logger().info(bcolors.OKGREEN + 'Configured and activated ' + - bcolors.BOLD + prefixed_controller_name + bcolors.ENDC) + node.get_logger().info( + bcolors.OKGREEN + + "Configured and activated " + + bcolors.BOLD + + prefixed_controller_name + + bcolors.ENDC + ) elif args.stopped: node.get_logger().warn('"--stopped" flag is deprecated use "--inactive" instead') @@ -247,44 +320,39 @@ def main(args=None): return 0 try: - node.get_logger().info('Waiting until interrupt to unload controllers') + node.get_logger().info("Waiting until interrupt to unload controllers") while True: time.sleep(1) except KeyboardInterrupt: if not args.stopped and not args.inactive: - node.get_logger().info('Interrupt captured, deactivating and unloading controller') + node.get_logger().info("Interrupt captured, deactivating and unloading controller") ret = switch_controllers( - node, - controller_manager_name, - [controller_name], - [], - True, - True, - 5.0) + node, controller_manager_name, [controller_name], [], True, True, 5.0 + ) if not ret.ok: - node.get_logger().error('Failed to deactivate controller') + node.get_logger().error("Failed to deactivate controller") return 1 - node.get_logger().info('Deactivated controller') + node.get_logger().info("Deactivated controller") elif args.stopped: node.get_logger().warn('"--stopped" flag is deprecated use "--inactive" instead') - ret = unload_controller( - node, controller_manager_name, controller_name) + ret = unload_controller(node, controller_manager_name, controller_name) if not ret.ok: - node.get_logger().error('Failed to unload controller') + node.get_logger().error("Failed to unload controller") return 1 - node.get_logger().info('Unloaded controller') + node.get_logger().info("Unloaded controller") return 0 finally: rclpy.shutdown() -if __name__ == '__main__': +if __name__ == "__main__": warnings.warn( "'spawner.py' is deprecated, please use 'spawner' (without .py extension)", - DeprecationWarning) + DeprecationWarning, + ) ret = main() sys.exit(ret) diff --git a/controller_manager/controller_manager/unspawner.py b/controller_manager/controller_manager/unspawner.py index 4020e2ad06..766dc5d4f8 100644 --- a/controller_manager/controller_manager/unspawner.py +++ b/controller_manager/controller_manager/unspawner.py @@ -25,48 +25,45 @@ def main(args=None): - rclpy.init(args=args) parser = argparse.ArgumentParser() + parser.add_argument("controller_name", help="Name of the controller") parser.add_argument( - 'controller_name', help='Name of the controller') - parser.add_argument( - '-c', '--controller-manager', help='Name of the controller manager ROS node', - default='/controller_manager', required=False) + "-c", + "--controller-manager", + help="Name of the controller manager ROS node", + default="/controller_manager", + required=False, + ) command_line_args = rclpy.utilities.remove_ros_args(args=sys.argv)[1:] args = parser.parse_args(command_line_args) controller_name = args.controller_name controller_manager_name = args.controller_manager - node = Node('unspawner_' + controller_name) + node = Node("unspawner_" + controller_name) try: # Ignore returncode, because message is already printed and we'll try to unload anyway ret = switch_controllers( - node, - controller_manager_name, - [controller_name], - [], - True, - True, - 5.0) - node.get_logger().info('Deactivated controller') + node, controller_manager_name, [controller_name], [], True, True, 5.0 + ) + node.get_logger().info("Deactivated controller") ret = unload_controller(node, controller_manager_name, controller_name) if not ret.ok: - node.get_logger().info('Failed to unload controller') + node.get_logger().info("Failed to unload controller") return 1 - node.get_logger().info('Unloaded controller') + node.get_logger().info("Unloaded controller") return 0 finally: rclpy.shutdown() -if __name__ == '__main__': +if __name__ == "__main__": warnings.warn( "'unspawner.py' is deprecated, please use 'unspawner' (without .py extension)", - DeprecationWarning + DeprecationWarning, ) ret = main() sys.exit(ret) diff --git a/joint_limits/test/joint_limits_rosparam.launch.py b/joint_limits/test/joint_limits_rosparam.launch.py index c808954207..c92f51f863 100644 --- a/joint_limits/test/joint_limits_rosparam.launch.py +++ b/joint_limits/test/joint_limits_rosparam.launch.py @@ -33,9 +33,7 @@ def generate_test_description(): package="joint_limits", executable="joint_limits_rosparam_test", output="screen", - parameters=[ - os.path.join(joint_limits_path, "test", "joint_limits_rosparam.yaml") - ], + parameters=[os.path.join(joint_limits_path, "test", "joint_limits_rosparam.yaml")], ) return ( LaunchDescription( diff --git a/ros2controlcli/ros2controlcli/api/__init__.py b/ros2controlcli/ros2controlcli/api/__init__.py index 9729b90c7b..df522670ec 100644 --- a/ros2controlcli/ros2controlcli/api/__init__.py +++ b/ros2controlcli/ros2controlcli/api/__init__.py @@ -33,19 +33,19 @@ def service_caller(service_name, service_type, request): cli = node.create_client(service_type, service_name) if not cli.service_is_ready(): - node.get_logger().debug(f'waiting for service {service_name} to become available...') + node.get_logger().debug(f"waiting for service {service_name} to become available...") if not cli.wait_for_service(2.0): - raise RuntimeError(f'Could not contact service {service_name}') + raise RuntimeError(f"Could not contact service {service_name}") - node.get_logger().debug(f'requester: making request: { repr(request) }\n') + node.get_logger().debug(f"requester: making request: { repr(request) }\n") future = cli.call_async(request) rclpy.spin_until_future_complete(node, future) if future.result() is not None: return future.result() else: future_exception = future.exception() - raise RuntimeError(f'Exception while calling service: { repr(future_exception) }') + raise RuntimeError(f"Exception while calling service: { repr(future_exception) }") finally: node.destroy_node() rclpy.shutdown() @@ -59,14 +59,14 @@ def __call__(self, prefix, parsed_args, **kwargs): parameter_names = call_list_parameters( node=node, node_name=parsed_args.controller_manager ) - suffix = '.type' + suffix = ".type" return [n[: -len(suffix)] for n in parameter_names if n.endswith(suffix)] class LoadedControllerNameCompleter: """Callable returning a list of loaded controllers.""" - def __init__(self, valid_states=['active', 'inactive', 'configured', 'unconfigured']): + def __init__(self, valid_states=["active", "inactive", "configured", "unconfigured"]): self.valid_states = valid_states def __call__(self, prefix, parsed_args, **kwargs): @@ -78,13 +78,13 @@ def __call__(self, prefix, parsed_args, **kwargs): def add_controller_mgr_parsers(parser): """Parser arguments to get controller manager node name, defaults to /controller_manager.""" arg = parser.add_argument( - '-c', - '--controller-manager', - help='Name of the controller manager ROS node', - default='/controller_manager', + "-c", + "--controller-manager", + help="Name of the controller manager ROS node", + default="/controller_manager", required=False, ) - arg.completer = NodeNameCompleter(include_hidden_nodes_key='include_hidden_nodes') + arg.completer = NodeNameCompleter(include_hidden_nodes_key="include_hidden_nodes") parser.add_argument( - '--include-hidden-nodes', action='store_true', help='Consider hidden nodes as well' + "--include-hidden-nodes", action="store_true", help="Consider hidden nodes as well" ) diff --git a/ros2controlcli/ros2controlcli/command/control.py b/ros2controlcli/ros2controlcli/command/control.py index 6ca4386709..dad12f2065 100644 --- a/ros2controlcli/ros2controlcli/command/control.py +++ b/ros2controlcli/ros2controlcli/command/control.py @@ -23,15 +23,15 @@ class ControlCommand(CommandExtension): def add_arguments(self, parser, cli_name): self._subparser = parser # get verb extensions and let them add their arguments - add_subparsers_on_demand(parser, cli_name, '_verb', 'ros2controlcli.verb', required=False) + add_subparsers_on_demand(parser, cli_name, "_verb", "ros2controlcli.verb", required=False) def main(self, *, parser, args): - if not hasattr(args, '_verb'): + if not hasattr(args, "_verb"): # in case no verb was passed self._subparser.print_help() return 0 - extension = getattr(args, '_verb') + extension = getattr(args, "_verb") # call the verb's main method return extension.main(args=args) diff --git a/ros2controlcli/ros2controlcli/verb/list_controller_types.py b/ros2controlcli/ros2controlcli/verb/list_controller_types.py index 7b4e778f8f..086b820124 100644 --- a/ros2controlcli/ros2controlcli/verb/list_controller_types.py +++ b/ros2controlcli/ros2controlcli/verb/list_controller_types.py @@ -33,6 +33,6 @@ def main(self, *, args): response = list_controller_types(node, args.controller_manager) types_and_classes = zip(response.types, response.base_classes) for c in types_and_classes: - print(f'{c[0]:70s} {c[1]}') + print(f"{c[0]:70s} {c[1]}") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/list_controllers.py b/ros2controlcli/ros2controlcli/verb/list_controllers.py index d21ec7d2e1..ca73e7afef 100644 --- a/ros2controlcli/ros2controlcli/verb/list_controllers.py +++ b/ros2controlcli/ros2controlcli/verb/list_controllers.py @@ -22,28 +22,28 @@ def print_controller_state(c, args): - print(f'{c.name:20s}[{c.type:20s}] {c.state:10s}') + print(f"{c.name:20s}[{c.type:20s}] {c.state:10s}") if args.claimed_interfaces or args.verbose: - print('\tclaimed interfaces:') + print("\tclaimed interfaces:") for claimed_interface in c.claimed_interfaces: - print(f'\t\t{claimed_interface}') + print(f"\t\t{claimed_interface}") if args.required_command_interfaces or args.verbose: - print('\trequired command interfaces:') + print("\trequired command interfaces:") for required_command_interface in c.required_command_interfaces: - print(f'\t\t{required_command_interface}') + print(f"\t\t{required_command_interface}") if args.required_state_interfaces or args.verbose: - print('\trequired state interfaces:') + print("\trequired state interfaces:") for required_state_interface in c.required_state_interfaces: - print(f'\t\t{required_state_interface}') + print(f"\t\t{required_state_interface}") if args.chained_interfaces or args.verbose: - print('\tchained to interfaces:') + print("\tchained to interfaces:") for connection in c.chain_connections: for reference in connection.reference_interfaces: - print(f'\t\t{reference:20s}') + print(f"\t\t{reference:20s}") if args.reference_interfaces or args.verbose: - print('\texported reference interfaces:') + print("\texported reference interfaces:") for reference_interfaces in c.reference_interfaces: - print(f'\t\t{reference_interfaces}') + print(f"\t\t{reference_interfaces}") class ListControllersVerb(VerbExtension): @@ -52,34 +52,35 @@ class ListControllersVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) parser.add_argument( - '--claimed-interfaces', - action='store_true', - help='List controller\'s claimed interfaces', + "--claimed-interfaces", + action="store_true", + help="List controller's claimed interfaces", ) parser.add_argument( - '--required-state-interfaces', - action='store_true', - help='List controller\'s required state interfaces', + "--required-state-interfaces", + action="store_true", + help="List controller's required state interfaces", ) parser.add_argument( - '--required-command-interfaces', - action='store_true', - help='List controller\'s required command interfaces', + "--required-command-interfaces", + action="store_true", + help="List controller's required command interfaces", ) parser.add_argument( - '--chained-interfaces', - action='store_true', - help='List interfaces that the controllers are chained to', + "--chained-interfaces", + action="store_true", + help="List interfaces that the controllers are chained to", ) parser.add_argument( - '--reference-interfaces', - action='store_true', - help='List controller\'s exported references', + "--reference-interfaces", + action="store_true", + help="List controller's exported references", ) parser.add_argument( - '--verbose', '-v', - action='store_true', - help='List controller\'s claimed interfaces, required state interfaces and required command interfaces', + "--verbose", + "-v", + action="store_true", + help="List controller's claimed interfaces, required state interfaces and required command interfaces", ) add_controller_mgr_parsers(parser) diff --git a/ros2controlcli/ros2controlcli/verb/list_hardware_components.py b/ros2controlcli/ros2controlcli/verb/list_hardware_components.py index 2b56db6549..2f94d70969 100644 --- a/ros2controlcli/ros2controlcli/verb/list_hardware_components.py +++ b/ros2controlcli/ros2controlcli/verb/list_hardware_components.py @@ -27,9 +27,10 @@ class ListHardwareComponentsVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) parser.add_argument( - '--verbose', '-v', - action='store_true', - help='List hardware components with command and state interfaces', + "--verbose", + "-v", + action="store_true", + help="List hardware components with command and state interfaces", ) add_controller_mgr_parsers(parser) @@ -38,41 +39,43 @@ def main(self, *, args): hardware_components = list_hardware_components(node, args.controller_manager) for idx, component in enumerate(hardware_components.component): - print(f'Hardware Component {idx}\n\tname: {component.name}\n\ttype: {component.type}') - if hasattr(component, 'plugin_name'): + print( + f"Hardware Component {idx}\n\tname: {component.name}\n\ttype: {component.type}" + ) + if hasattr(component, "plugin_name"): plugin_name = component.plugin_name else: - plugin_name = f'{bcolors.WARNING}plugin name missing!{bcolors.ENDC}' + plugin_name = f"{bcolors.WARNING}plugin name missing!{bcolors.ENDC}" - print(f'\tplugin name: {plugin_name}\n\tstate: id={component.state.id} label={component.state.label}\n\tcommand interfaces') + print( + f"\tplugin name: {plugin_name}\n\tstate: id={component.state.id} label={component.state.label}\n\tcommand interfaces" + ) for cmd_interface in component.command_interfaces: - if cmd_interface.is_available: - available_str = f'{bcolors.OKBLUE}[available]{bcolors.ENDC}' + available_str = f"{bcolors.OKBLUE}[available]{bcolors.ENDC}" else: - available_str = f'{bcolors.WARNING}[unavailable]{bcolors.ENDC}' + available_str = f"{bcolors.WARNING}[unavailable]{bcolors.ENDC}" if cmd_interface.is_claimed: - claimed_str = f'{bcolors.OKBLUE}[claimed]{bcolors.ENDC}' + claimed_str = f"{bcolors.OKBLUE}[claimed]{bcolors.ENDC}" else: - claimed_str = '[unclaimed]' + claimed_str = "[unclaimed]" - print(f'\t\t{cmd_interface.name} {available_str} {claimed_str}') + print(f"\t\t{cmd_interface.name} {available_str} {claimed_str}") if args.verbose: - print('\tstate interfaces') + print("\tstate interfaces") for state_interface in component.command_interfaces: - if state_interface.is_available: - available_str = f'{bcolors.OKBLUE}[available]{bcolors.ENDC}' + available_str = f"{bcolors.OKBLUE}[available]{bcolors.ENDC}" else: - available_str = f'{bcolors.WARNING}[unavailable]{bcolors.ENDC}' + available_str = f"{bcolors.WARNING}[unavailable]{bcolors.ENDC}" if state_interface.is_claimed: - claimed_str = f'{bcolors.OKBLUE}[claimed]{bcolors.ENDC}' + claimed_str = f"{bcolors.OKBLUE}[claimed]{bcolors.ENDC}" else: - claimed_str = '[unclaimed]' + claimed_str = "[unclaimed]" - print(f'\t\t{state_interface.name} {available_str} {claimed_str}') + print(f"\t\t{state_interface.name} {available_str} {claimed_str}") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/list_hardware_interfaces.py b/ros2controlcli/ros2controlcli/verb/list_hardware_interfaces.py index 305df18e10..7aa850f3bc 100644 --- a/ros2controlcli/ros2controlcli/verb/list_hardware_interfaces.py +++ b/ros2controlcli/ros2controlcli/verb/list_hardware_interfaces.py @@ -37,21 +37,27 @@ def main(self, *, args): state_interfaces = sorted( hardware_interfaces.state_interfaces, key=lambda hwi: hwi.name ) - print('command interfaces') + print("command interfaces") for command_interface in command_interfaces: if command_interface.is_available: if command_interface.is_claimed: - print(f'\t{bcolors.OKBLUE}{command_interface.name} ' - f'[available] [claimed]{bcolors.ENDC}') + print( + f"\t{bcolors.OKBLUE}{command_interface.name} " + f"[available] [claimed]{bcolors.ENDC}" + ) else: - print(f'\t{bcolors.OKCYAN}{command_interface.name} ' - f'[available] [unclaimed]{bcolors.ENDC}') + print( + f"\t{bcolors.OKCYAN}{command_interface.name} " + f"[available] [unclaimed]{bcolors.ENDC}" + ) else: - print(f'\t{bcolors.WARNING}{command_interface.name} ' - f'[unavailable] [unclaimed]{bcolors.ENDC}') + print( + f"\t{bcolors.WARNING}{command_interface.name} " + f"[unavailable] [unclaimed]{bcolors.ENDC}" + ) - print('state interfaces') + print("state interfaces") for state_interface in state_interfaces: - print(f'\t{state_interface.name}') + print(f"\t{state_interface.name}") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/load_controller.py b/ros2controlcli/ros2controlcli/verb/load_controller.py index e8fc47b903..267c93ef3d 100644 --- a/ros2controlcli/ros2controlcli/verb/load_controller.py +++ b/ros2controlcli/ros2controlcli/verb/load_controller.py @@ -26,12 +26,12 @@ class LoadControllerVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) - arg = parser.add_argument('controller_name', help='Name of the controller') + arg = parser.add_argument("controller_name", help="Name of the controller") arg.completer = ControllerNameCompleter() arg = parser.add_argument( - '--set-state', - choices=['configured', 'active'], - help='Set the state of the loaded controller', + "--set-state", + choices=["configured", "active"], + help="Set the state of the loaded controller", ) add_controller_mgr_parsers(parser) @@ -39,29 +39,31 @@ def main(self, *, args): with NodeStrategy(args) as node: response = load_controller(node, args.controller_manager, args.controller_name) if not response.ok: - return 'Error loading controller, check controller_manager logs' + return "Error loading controller, check controller_manager logs" if not args.set_state: - print(f'Successfully loaded controller {args.controller_name}') + print(f"Successfully loaded controller {args.controller_name}") return 0 # we in any case configure the controller response = configure_controller(node, args.controller_manager, args.controller_name) if not response.ok: - return 'Error configuring controller' + return "Error configuring controller" # TODO(destogl): remove in humble+ - if args.set_state == 'start': + if args.set_state == "start": print('Setting state "start" is deprecated "activate" instead!') - args.set_state == 'activate' + args.set_state == "activate" - if args.set_state == 'active': + if args.set_state == "active": response = switch_controllers( node, args.controller_manager, [], [args.controller_name], True, True, 5.0 ) if not response.ok: - return 'Error activating controller, check controller_manager logs' + return "Error activating controller, check controller_manager logs" - print(f'Sucessfully loaded controller {args.controller_name} into ' - f'state { "inactive" if args.set_state == "configure" else "active" }') + print( + f"Successfully loaded controller {args.controller_name} into " + f'state { "inactive" if args.set_state == "configure" else "active" }' + ) return 0 diff --git a/ros2controlcli/ros2controlcli/verb/reload_controller_libraries.py b/ros2controlcli/ros2controlcli/verb/reload_controller_libraries.py index 9d56c6d17e..82bc2e480f 100644 --- a/ros2controlcli/ros2controlcli/verb/reload_controller_libraries.py +++ b/ros2controlcli/ros2controlcli/verb/reload_controller_libraries.py @@ -27,7 +27,7 @@ class ReloadControllerLibrariesVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) parser.add_argument( - '--force-kill', action='store_true', help='Force stop of loaded controllers' + "--force-kill", action="store_true", help="Force stop of loaded controllers" ) add_controller_mgr_parsers(parser) @@ -37,7 +37,7 @@ def main(self, *, args): node, args.controller_manager, force_kill=args.force_kill ) if not response.ok: - return 'Error reloading libraries, check controller_manager logs' + return "Error reloading libraries, check controller_manager logs" - print('Reload successful') + print("Reload successful") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/set_controller_state.py b/ros2controlcli/ros2controlcli/verb/set_controller_state.py index 4ce6cdf7c7..ee4f5c8e7d 100644 --- a/ros2controlcli/ros2controlcli/verb/set_controller_state.py +++ b/ros2controlcli/ros2controlcli/verb/set_controller_state.py @@ -26,13 +26,13 @@ class SetControllerStateVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) - arg = parser.add_argument('controller_name', help='Name of the controller to be changed') + arg = parser.add_argument("controller_name", help="Name of the controller to be changed") arg.completer = LoadedControllerNameCompleter() arg = parser.add_argument( - 'state', + "state", # choices=['unconfigured', 'inactive', 'active'], TODO(destogl): when cleanup is impl - choices=['inactive', 'active'], - help='State in which the controller should be changed to', + choices=["inactive", "active"], + help="State in which the controller should be changed to", ) add_controller_mgr_parsers(parser) @@ -43,7 +43,7 @@ def main(self, *, args): try: matched_controller = [c for c in controllers if c.name == args.controller_name][0] except IndexError: - return f'controller {args.controller_name} does not seem to be loaded' + return f"controller {args.controller_name} does not seem to be loaded" # TODO(destogl): This has to be implemented in CLI and controller manager # if args.state == 'unconfigured': @@ -58,52 +58,56 @@ def main(self, *, args): # # print(f'successfully cleaned up {args.controller_name}') # return 0 - if args.state == 'configure': - args.state = 'inactive' + if args.state == "configure": + args.state = "inactive" print('Setting state "configure" is deprecated, use "inactive" instead!') - if args.state == 'stop': - args.state = 'inactive' + if args.state == "stop": + args.state = "inactive" print('Setting state "stop" is deprecated, use "inactive" instead!') - if args.state == 'inactive': - if matched_controller.state == 'unconfigured': + if args.state == "inactive": + if matched_controller.state == "unconfigured": response = configure_controller( node, args.controller_manager, args.controller_name ) if not response.ok: - return 'Error configuring controller, check controller_manager logs' + return "Error configuring controller, check controller_manager logs" - print(f'successfully configured {args.controller_name}') + print(f"successfully configured {args.controller_name}") return 0 - elif matched_controller.state == 'active': + elif matched_controller.state == "active": response = switch_controllers( node, args.controller_manager, [args.controller_name], [], True, True, 5.0 ) if not response.ok: - return 'Error stopping controller, check controller_manager logs' + return "Error stopping controller, check controller_manager logs" - print(f'successfully deactivated {args.controller_name}') + print(f"successfully deactivated {args.controller_name}") return 0 else: - return f'cannot put {matched_controller.name} in "inactive" state' \ - f'from its current state {matched_controller.state}' + return ( + f'cannot put {matched_controller.name} in "inactive" state' + f"from its current state {matched_controller.state}" + ) - if args.state == 'start': - args.state = 'active' + if args.state == "start": + args.state = "active" print('Setting state "start" is deprecated, use "active" instead!') - if args.state == 'active': - if matched_controller.state != 'inactive': - return f'cannot activate {matched_controller.name} ' \ - f'from its current state {matched_controller.state}' + if args.state == "active": + if matched_controller.state != "inactive": + return ( + f"cannot activate {matched_controller.name} " + f"from its current state {matched_controller.state}" + ) response = switch_controllers( node, args.controller_manager, [], [args.controller_name], True, True, 5.0 ) if not response.ok: - return 'Error activating controller, check controller_manager logs' + return "Error activating controller, check controller_manager logs" - print(f'successfully activated {args.controller_name}') + print(f"successfully activated {args.controller_name}") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/switch_controllers.py b/ros2controlcli/ros2controlcli/verb/switch_controllers.py index c6436635bc..141fefd593 100644 --- a/ros2controlcli/ros2controlcli/verb/switch_controllers.py +++ b/ros2controlcli/ros2controlcli/verb/switch_controllers.py @@ -27,53 +27,53 @@ class SwitchControllersVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) arg = parser.add_argument( - '--stop', - nargs='*', + "--stop", + nargs="*", default=[], - help='Name of the controllers to be deactivated', + help="Name of the controllers to be deactivated", ) - arg.completer = LoadedControllerNameCompleter(['active']) + arg.completer = LoadedControllerNameCompleter(["active"]) arg = parser.add_argument( - '--deactivate', - nargs='*', + "--deactivate", + nargs="*", default=[], - help='Name of the controllers to be deactivated', + help="Name of the controllers to be deactivated", ) - arg.completer = LoadedControllerNameCompleter(['active']) + arg.completer = LoadedControllerNameCompleter(["active"]) arg = parser.add_argument( - '--start', - nargs='*', + "--start", + nargs="*", default=[], - help='Name of the controllers to be activated', + help="Name of the controllers to be activated", ) - arg.completer = LoadedControllerNameCompleter(['inactive']) + arg.completer = LoadedControllerNameCompleter(["inactive"]) arg = parser.add_argument( - '--activate', - nargs='*', + "--activate", + nargs="*", default=[], - help='Name of the controllers to be activated', + help="Name of the controllers to be activated", ) - arg.completer = LoadedControllerNameCompleter(['inactive']) - parser.add_argument('--strict', action='store_true', help='Strict switch') - parser.add_argument('--start-asap', action='store_true', help='Start asap controllers') - parser.add_argument('--activate-asap', action='store_true', help='Start asap controllers') + arg.completer = LoadedControllerNameCompleter(["inactive"]) + parser.add_argument("--strict", action="store_true", help="Strict switch") + parser.add_argument("--start-asap", action="store_true", help="Start asap controllers") + parser.add_argument("--activate-asap", action="store_true", help="Start asap controllers") parser.add_argument( - '--switch-timeout', + "--switch-timeout", default=5.0, required=False, - help='Timeout for switching controllers', + help="Timeout for switching controllers", ) - arg.completer = LoadedControllerNameCompleter(['inactive']) + arg.completer = LoadedControllerNameCompleter(["inactive"]) add_controller_mgr_parsers(parser) def main(self, *, args): - if (args.stop): + if args.stop: print('"--stop" flag is deprecated, use "--deactivate" instead!') args.deactivate = args.stop - if (args.start): + if args.start: print('"--start" flag is deprecated, use "--activate" instead!') args.activate = args.start - if (args.start_asap): + if args.start_asap: print('"--start-asap" flag is deprecated, use "--activate-asap" instead!') args.activate_asap = args.start_asap @@ -88,7 +88,7 @@ def main(self, *, args): args.switch_timeout, ) if not response.ok: - return 'Error switching controllers, check controller_manager logs' + return "Error switching controllers, check controller_manager logs" - print('Successfully switched controllers') + print("Successfully switched controllers") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/unload_controller.py b/ros2controlcli/ros2controlcli/verb/unload_controller.py index cf24d4847b..81612eb3ad 100644 --- a/ros2controlcli/ros2controlcli/verb/unload_controller.py +++ b/ros2controlcli/ros2controlcli/verb/unload_controller.py @@ -26,7 +26,7 @@ class UnloadControllerVerb(VerbExtension): def add_arguments(self, parser, cli_name): add_arguments(parser) - arg = parser.add_argument('controller_name', help='Name of the controller') + arg = parser.add_argument("controller_name", help="Name of the controller") arg.completer = LoadedControllerNameCompleter() add_controller_mgr_parsers(parser) @@ -34,7 +34,7 @@ def main(self, *, args): with NodeStrategy(args) as node: response = unload_controller(node, args.controller_manager, args.controller_name) if not response.ok: - return 'Error unloading controllers, check controller_manager logs' + return "Error unloading controllers, check controller_manager logs" - print(f'Successfully unloaded controller {args.controller_name}') + print(f"Successfully unloaded controller {args.controller_name}") return 0 diff --git a/ros2controlcli/ros2controlcli/verb/view_controller_chains.py b/ros2controlcli/ros2controlcli/verb/view_controller_chains.py index 891ee7c088..fbd999192e 100644 --- a/ros2controlcli/ros2controlcli/verb/view_controller_chains.py +++ b/ros2controlcli/ros2controlcli/verb/view_controller_chains.py @@ -24,70 +24,98 @@ import pygraphviz as pgz -def make_controller_node(s, controller_name, state_interfaces, command_interfaces, input_controllers, - output_controllers, port_map): +def make_controller_node( + s, + controller_name, + state_interfaces, + command_interfaces, + input_controllers, + output_controllers, + port_map, +): state_interfaces = sorted(list(state_interfaces)) command_interfaces = sorted(list(command_interfaces)) input_controllers = sorted(list(input_controllers)) output_controllers = sorted(list(output_controllers)) - inputs_str = '' + inputs_str = "" for ind, state_interface in enumerate(state_interfaces): - deliminator = '|' + deliminator = "|" if ind == len(state_interface) - 1: - deliminator = '' - inputs_str += '<{}> {} {} '.format("state_end_" + state_interface, state_interface, deliminator) + deliminator = "" + inputs_str += "<{}> {} {} ".format( + "state_end_" + state_interface, state_interface, deliminator + ) for ind, input_controller in enumerate(input_controllers): - deliminator = '|' + deliminator = "|" if ind == len(input_controller) - 1: - deliminator = '' - inputs_str += '<{}> {} {} '.format("controller_end_" + input_controller, input_controller, deliminator) + deliminator = "" + inputs_str += "<{}> {} {} ".format( + "controller_end_" + input_controller, input_controller, deliminator + ) port_map["controller_end_" + input_controller] = controller_name - outputs_str = '' + outputs_str = "" for ind, command_interface in enumerate(command_interfaces): - deliminator = '|' + deliminator = "|" if ind == len(command_interface) - 1: - deliminator = '' - outputs_str += '<{}> {} {} '.format("command_start_" + command_interface, command_interface, deliminator) + deliminator = "" + outputs_str += "<{}> {} {} ".format( + "command_start_" + command_interface, command_interface, deliminator + ) for ind, output_controller in enumerate(output_controllers): - deliminator = '|' + deliminator = "|" if ind == len(output_controller) - 1: - deliminator = '' - outputs_str += '<{}> {} {} '.format("controller_start_" + output_controller, output_controller, deliminator) + deliminator = "" + outputs_str += "<{}> {} {} ".format( + "controller_start_" + output_controller, output_controller, deliminator + ) - s.add_node(controller_name, label=f'{controller_name}|{{{{{inputs_str}}}|{{{outputs_str}}}}}') + s.add_node(controller_name, label=f"{controller_name}|{{{{{inputs_str}}}|{{{outputs_str}}}}}") def make_command_node(s, command_interfaces): command_interfaces = sorted(list(command_interfaces)) - outputs_str = '' + outputs_str = "" for ind, command_interface in enumerate(command_interfaces): - deliminator = '|' + deliminator = "|" if ind == len(command_interfaces) - 1: - deliminator = '' - outputs_str += '<{}> {} {} '.format("command_end_" + command_interface, command_interface, deliminator) + deliminator = "" + outputs_str += "<{}> {} {} ".format( + "command_end_" + command_interface, command_interface, deliminator + ) - s.add_node("command_interfaces", label='{}|{{{{{}}}}}'.format("command_interfaces", outputs_str)) + s.add_node( + "command_interfaces", label="{}|{{{{{}}}}}".format("command_interfaces", outputs_str) + ) def make_state_node(s, state_interfaces): state_interfaces = sorted(list(state_interfaces)) - inputs_str = '' + inputs_str = "" for ind, state_interface in enumerate(state_interfaces): - deliminator = '|' + deliminator = "|" if ind == len(state_interfaces) - 1: - deliminator = '' - inputs_str += '<{}> {} {} '.format("state_start_" + state_interface, state_interface, deliminator) - - s.add_node("state_interfaces", label='{}|{{{{{}}}}}'.format("state_interfaces", inputs_str)) - - -def show_graph(input_chain_connections, output_chain_connections, command_connections, state_connections, - command_interfaces, state_interfaces, visualize): - s = pgz.AGraph(name='g', strict=False, directed=True, rankdir='LR') + deliminator = "" + inputs_str += "<{}> {} {} ".format( + "state_start_" + state_interface, state_interface, deliminator + ) + + s.add_node("state_interfaces", label="{}|{{{{{}}}}}".format("state_interfaces", inputs_str)) + + +def show_graph( + input_chain_connections, + output_chain_connections, + command_connections, + state_connections, + command_interfaces, + state_interfaces, + visualize, +): + s = pgz.AGraph(name="g", strict=False, directed=True, rankdir="LR") s.node_attr["shape"] = "record" s.node_attr["style"] = "rounded" port_map = dict() @@ -99,29 +127,42 @@ def show_graph(input_chain_connections, output_chain_connections, command_connec controller_names = controller_names.union({name for name in state_connections}) # create node for each controller for controller_name in controller_names: - make_controller_node(s, controller_name, state_connections[controller_name], - command_connections[controller_name], - input_chain_connections[controller_name], - output_chain_connections[controller_name], port_map) + make_controller_node( + s, + controller_name, + state_connections[controller_name], + command_connections[controller_name], + input_chain_connections[controller_name], + output_chain_connections[controller_name], + port_map, + ) make_state_node(s, state_interfaces) make_command_node(s, command_interfaces) for controller_name in controller_names: for connection in output_chain_connections[controller_name]: - s.add_edge('{}:{}'.format(controller_name, "controller_start_" + connection), - '{}:{}'.format(port_map['controller_end_' + connection], 'controller_end_' + connection)) + s.add_edge( + "{}:{}".format(controller_name, "controller_start_" + connection), + "{}:{}".format( + port_map["controller_end_" + connection], "controller_end_" + connection + ), + ) for state_connection in state_connections[controller_name]: - s.add_edge('{}:{}'.format("state_interfaces", "state_start_" + state_connection), - '{}:{}'.format(controller_name, 'state_end_' + state_connection)) + s.add_edge( + "{}:{}".format("state_interfaces", "state_start_" + state_connection), + "{}:{}".format(controller_name, "state_end_" + state_connection), + ) for command_connection in command_connections[controller_name]: - s.add_edge('{}:{}'.format(controller_name, "command_start_" + command_connection), - '{}:{}'.format("command_interfaces", 'command_end_' + command_connection)) + s.add_edge( + "{}:{}".format(controller_name, "command_start_" + command_connection), + "{}:{}".format("command_interfaces", "command_end_" + command_connection), + ) - s.graph_attr.update(ranksep='2') - s.layout(prog='dot') + s.graph_attr.update(ranksep="2") + s.layout(prog="dot") if visualize: - s.draw('/tmp/controller_diagram.gv.pdf', format='pdf') + s.draw("/tmp/controller_diagram.gv.pdf", format="pdf") def parse_response(list_controllers_response, list_hardware_response, visualize=True): @@ -142,8 +183,15 @@ def parse_response(list_controllers_response, list_hardware_response, visualize= command_connections[controller.name] = set(controller.required_command_interfaces) state_connections[controller.name] = set(controller.required_state_interfaces) - show_graph(input_chain_connections, output_chain_connections, command_connections, state_connections, - command_interfaces, state_interfaces, visualize) + show_graph( + input_chain_connections, + output_chain_connections, + command_connections, + state_connections, + command_interfaces, + state_interfaces, + visualize, + ) class ViewControllerChainsVerb(VerbExtension): diff --git a/ros2controlcli/setup.py b/ros2controlcli/setup.py index 999517fafd..3f18a1ae87 100644 --- a/ros2controlcli/setup.py +++ b/ros2controlcli/setup.py @@ -15,55 +15,55 @@ from setuptools import find_packages from setuptools import setup -package_name = 'ros2controlcli' +package_name = "ros2controlcli" setup( name=package_name, - version='3.7.0', - packages=find_packages(exclude=['test']), + version="3.7.0", + packages=find_packages(exclude=["test"]), data_files=[ - ('share/' + package_name, ['package.xml']), - ('share/ament_index/resource_index/packages', ['resource/' + package_name]), + ("share/" + package_name, ["package.xml"]), + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), ], - install_requires=['ros2cli'], + install_requires=["ros2cli"], zip_safe=True, - author='Victor Lopez', - author_email='victor.lopez@pal-robotics.com', - maintainer='Victor Lopez', - maintainer_email='victor.lopez@pal-robotics.com', - url='https://github.com/ros-controls/ros2_control', + author="Victor Lopez", + author_email="victor.lopez@pal-robotics.com", + maintainer="Victor Lopez", + maintainer_email="victor.lopez@pal-robotics.com", + url="https://github.com/ros-controls/ros2_control", keywords=[], classifiers=[ - 'Environment :: Console', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", ], - description='ROS2 Control command interface.', + description="ROS2 Control command interface.", long_description="""\ ROS2 Control command interface.""", - license='Apache License, Version 2.0', - tests_require=['pytest'], + license="Apache License, Version 2.0", + tests_require=["pytest"], entry_points={ - 'ros2cli.command': [ - 'control = ros2controlcli.command.control:ControlCommand', + "ros2cli.command": [ + "control = ros2controlcli.command.control:ControlCommand", ], - 'ros2controlcli.verb': [ - 'list_controllers = ros2controlcli.verb.list_controllers:ListControllersVerb', - 'view_controller_chains = ros2controlcli.verb.view_controller_chains:ViewControllerChainsVerb', - 'list_hardware_components = \ - ros2controlcli.verb.list_hardware_components:ListHardwareComponentsVerb', - 'list_hardware_interfaces = \ - ros2controlcli.verb.list_hardware_interfaces:ListHardwareInterfacesVerb', - 'list_controller_types = \ - ros2controlcli.verb.list_controller_types:ListControllerTypesVerb', - 'load_controller = ros2controlcli.verb.load_controller:LoadControllerVerb', - 'reload_controller_libraries = \ - ros2controlcli.verb.reload_controller_libraries:ReloadControllerLibrariesVerb', - 'set_controller_state = \ - ros2controlcli.verb.set_controller_state:SetControllerStateVerb', - 'switch_controllers = ros2controlcli.verb.switch_controllers:SwitchControllersVerb', - 'unload_controller = ros2controlcli.verb.unload_controller:UnloadControllerVerb', + "ros2controlcli.verb": [ + "list_controllers = ros2controlcli.verb.list_controllers:ListControllersVerb", + "view_controller_chains = ros2controlcli.verb.view_controller_chains:ViewControllerChainsVerb", + "list_hardware_components = \ + ros2controlcli.verb.list_hardware_components:ListHardwareComponentsVerb", + "list_hardware_interfaces = \ + ros2controlcli.verb.list_hardware_interfaces:ListHardwareInterfacesVerb", + "list_controller_types = \ + ros2controlcli.verb.list_controller_types:ListControllerTypesVerb", + "load_controller = ros2controlcli.verb.load_controller:LoadControllerVerb", + "reload_controller_libraries = \ + ros2controlcli.verb.reload_controller_libraries:ReloadControllerLibrariesVerb", + "set_controller_state = \ + ros2controlcli.verb.set_controller_state:SetControllerStateVerb", + "switch_controllers = ros2controlcli.verb.switch_controllers:SwitchControllersVerb", + "unload_controller = ros2controlcli.verb.unload_controller:UnloadControllerVerb", ], }, ) diff --git a/ros2controlcli/test/test_view_controller_chains.py b/ros2controlcli/test/test_view_controller_chains.py index 3ac37198a5..517c451faf 100644 --- a/ros2controlcli/test/test_view_controller_chains.py +++ b/ros2controlcli/test/test_view_controller_chains.py @@ -23,9 +23,7 @@ class TestViewControllerChains(unittest.TestCase): - def test_expected(self): - list_controllers_response = ListControllers.Response() list_hardware_response = ListHardwareInterfaces.Response() @@ -62,9 +60,13 @@ def test_expected(self): chain_connection.reference_interfaces.append(f"joint{i}/position") chain_connection.reference_interfaces.append(f"joint{i}/velocity") - chained_to_controller.required_command_interfaces = chained_to_controller.claimed_interfaces + chained_to_controller.required_command_interfaces = ( + chained_to_controller.claimed_interfaces + ) - chained_from_controller.required_command_interfaces = chained_from_controller.claimed_interfaces + chained_from_controller.required_command_interfaces = ( + chained_from_controller.claimed_interfaces + ) chained_from_controller.chain_connections.append(chain_connection) controller_list = [chained_from_controller, chained_to_controller] diff --git a/rqt_controller_manager/rqt_controller_manager/controller_manager.py b/rqt_controller_manager/rqt_controller_manager/controller_manager.py index 18d1ec0925..4d3c247e5b 100644 --- a/rqt_controller_manager/rqt_controller_manager/controller_manager.py +++ b/rqt_controller_manager/rqt_controller_manager/controller_manager.py @@ -17,8 +17,13 @@ import os from ament_index_python.packages import get_package_share_directory -from controller_manager.controller_manager_services import configure_controller, \ - list_controllers, load_controller, switch_controllers, unload_controller +from controller_manager.controller_manager_services import ( + configure_controller, + list_controllers, + load_controller, + switch_controllers, + unload_controller, +) from controller_manager_msgs.msg import ControllerState from controller_manager_msgs.srv import SwitchController from python_qt_binding import loadUi @@ -39,7 +44,7 @@ class ControllerManager(Plugin): def __init__(self, context): super().__init__(context) - self.setObjectName('ControllerManager') + self.setObjectName("ControllerManager") # Create QWidget and extend it with all the attributes and children # from the UI file @@ -47,18 +52,18 @@ def __init__(self, context): ui_file = os.path.join( get_package_share_directory("rqt_controller_manager"), "resource", - "controller_manager.ui") + "controller_manager.ui", + ) loadUi(ui_file, self._widget) - self._widget.setObjectName('ControllerManagerUi') + self._widget.setObjectName("ControllerManagerUi") # Pop-up that displays controller information self._popup_widget = QWidget() ui_file = os.path.join( - get_package_share_directory("rqt_controller_manager"), - 'resource', - 'controller_info.ui') + get_package_share_directory("rqt_controller_manager"), "resource", "controller_info.ui" + ) loadUi(ui_file, self._popup_widget) - self._popup_widget.setObjectName('ControllerInfoUi') + self._popup_widget.setObjectName("ControllerInfoUi") # Show _widget.windowTitle on left-top of each plugin (when # it's set in _widget). This is useful when you open multiple @@ -66,12 +71,12 @@ def __init__(self, context): # plugin at once, these lines add number to make it easy to # tell from pane to pane. if context.serial_number() > 1: - self._widget.setWindowTitle(f'{self._widget.windowTitle()} {context.serial_number()}') + self._widget.setWindowTitle(f"{self._widget.windowTitle()} {context.serial_number()}") # Add widget to the user interface context.add_widget(self._widget) # Initialize members - self._cm_name = '' # Name of the selected controller manager's node + self._cm_name = "" # Name of the selected controller manager's node self._controllers = [] # State of each controller self._table_model = None @@ -81,10 +86,10 @@ def __init__(self, context): # Controller state icons path = get_package_share_directory("rqt_controller_manager") self._icons = { - 'active': QIcon(f'{path}/resource/led_green.png'), - 'finalized': QIcon(f'{path}/resource/led_off.png'), - 'inactive': QIcon(f'{path}/resource/led_red.png'), - 'unconfigured': QIcon(f'{path}/resource/led_off.png'), + "active": QIcon(f"{path}/resource/led_green.png"), + "finalized": QIcon(f"{path}/resource/led_off.png"), + "inactive": QIcon(f"{path}/resource/led_red.png"), + "unconfigured": QIcon(f"{path}/resource/led_off.png"), } # Controllers display @@ -121,18 +126,18 @@ def shutdown_plugin(self): self._popup_widget.hide() def save_settings(self, plugin_settings, instance_settings): - instance_settings.set_value('cm_name', self._cm_name) + instance_settings.set_value("cm_name", self._cm_name) def restore_settings(self, plugin_settings, instance_settings): # Restore last session's controller_manager, if present self._update_cm_list() - cm_name = instance_settings.value('cm_name') + cm_name = instance_settings.value("cm_name") cm_combo = self._widget.cm_combo cm_list = [cm_combo.itemText(i) for i in range(cm_combo.count())] try: idx = cm_list.index(cm_name) cm_combo.setCurrentIndex(idx) - except (ValueError): + except ValueError: pass def _update_cm_list(self): @@ -145,7 +150,6 @@ def _on_cm_change(self, cm_name): self._update_controllers() def _update_controllers(self): - if not self._cm_name: return @@ -175,8 +179,7 @@ def _list_controllers(self): add_ctrl = all(name != ctrl.name for ctrl in controllers) if add_ctrl: type_str = _get_controller_type(self._node, self._cm_name, name) - uninit_ctrl = ControllerState(name=name, - type=type_str) + uninit_ctrl = ControllerState(name=name, type=type_str) controllers.append(uninit_ctrl) return controllers @@ -195,39 +198,36 @@ def _on_ctrl_menu(self, pos): # Show context menu menu = QMenu(self._widget.table_view) - if ctrl.state == 'active': - action_deactivate = menu.addAction(self._icons['inactive'], 'Deactivate') - action_kill = menu.addAction(self._icons['finalized'], - 'Deactivate and Unload') - elif ctrl.state == 'inactive': - action_activate = menu.addAction(self._icons['active'], 'Activate') - action_unload = menu.addAction(self._icons['unconfigured'], - 'Unload') - elif ctrl.state == 'unconfigured': - action_configure = menu.addAction(self._icons['inactive'], 'Configure') - action_spawn = menu.addAction(self._icons['active'], - 'Configure and Activate') + if ctrl.state == "active": + action_deactivate = menu.addAction(self._icons["inactive"], "Deactivate") + action_kill = menu.addAction(self._icons["finalized"], "Deactivate and Unload") + elif ctrl.state == "inactive": + action_activate = menu.addAction(self._icons["active"], "Activate") + action_unload = menu.addAction(self._icons["unconfigured"], "Unload") + elif ctrl.state == "unconfigured": + action_configure = menu.addAction(self._icons["inactive"], "Configure") + action_spawn = menu.addAction(self._icons["active"], "Configure and Activate") else: # Controller isn't loaded - action_load = menu.addAction(self._icons['unconfigured'], 'Load') - action_configure = menu.addAction(self._icons['inactive'], 'Load and Configure') - action_activate = menu.addAction(self._icons['active'], 'Load, Configure and Activate') + action_load = menu.addAction(self._icons["unconfigured"], "Load") + action_configure = menu.addAction(self._icons["inactive"], "Load and Configure") + action_activate = menu.addAction(self._icons["active"], "Load, Configure and Activate") action = menu.exec_(self._widget.table_view.mapToGlobal(pos)) # Evaluate user action - if ctrl.state == 'active': + if ctrl.state == "active": if action is action_deactivate: self._deactivate_controller(ctrl.name) elif action is action_kill: self._deactivate_controller(ctrl.name) unload_controller(self._node, self._cm_name, ctrl.name) - elif ctrl.state in ('finalized', 'inactive'): + elif ctrl.state in ("finalized", "inactive"): if action is action_activate: self._activate_controller(ctrl.name) elif action is action_unload: unload_controller(self._node, self._cm_name, ctrl.name) - elif ctrl.state == 'unconfigured': + elif ctrl.state == "unconfigured": if action is action_configure: configure_controller(self._node, self._cm_name, ctrl.name) elif action is action_spawn: @@ -253,7 +253,7 @@ def _on_ctrl_info(self, index): popup.ctrl_type.setText(ctrl.type) res_model = QStandardItemModel() - model_root = QStandardItem('Claimed Interfaces') + model_root = QStandardItem("Claimed Interfaces") res_model.appendRow(model_root) for claimed_interface in ctrl.claimed_interfaces: hw_iface_item = QStandardItem(claimed_interface) @@ -270,7 +270,7 @@ def _on_header_menu(self, pos): # Show context menu menu = QMenu(self._widget.table_view) - action_toggle_auto_resize = menu.addAction('Toggle Auto-Resize') + action_toggle_auto_resize = menu.addAction("Toggle Auto-Resize") action = menu.exec_(header.mapToGlobal(pos)) # Evaluate user action @@ -288,7 +288,7 @@ def _activate_controller(self, name): activate_controllers=[name], strict=SwitchController.Request.STRICT, activate_asap=False, - timeout=0.3 + timeout=0.3, ) def _deactivate_controller(self, name): @@ -299,7 +299,7 @@ def _deactivate_controller(self, name): activate_controllers=[], strict=SwitchController.Request.STRICT, activate_asap=False, - timeout=0.3 + timeout=0.3, ) @@ -311,7 +311,7 @@ class ControllerTable(QAbstractTableModel): name and state. """ - def __init__(self, controller_info, icons, parent=None): + def __init__(self, controller_info, icons, parent=None): QAbstractTableModel.__init__(self, parent) self._data = controller_info self._icons = icons @@ -326,9 +326,9 @@ def headerData(self, col, orientation, role): if orientation != Qt.Horizontal or role != Qt.DisplayRole: return None if col == 0: - return 'controller' + return "controller" elif col == 1: - return 'state' + return "state" def data(self, index, role): if not index.isValid(): @@ -340,7 +340,7 @@ def data(self, index, role): if index.column() == 0: return ctrl.name elif index.column() == 1: - return ctrl.state or 'not loaded' + return ctrl.state or "not loaded" if role == Qt.DecorationRole and index.column() == 0: return self._icons.get(ctrl.state) @@ -385,7 +385,7 @@ def _get_controller_type(node, node_name, ctrl_name): @rtype str """ response = call_get_parameters(node=node, node_name=node_name, parameter_names=[ctrl_name]) - return response.values[0].string_value if response.values else '' + return response.values[0].string_value if response.values else "" def _list_controller_managers(node): @@ -398,14 +398,14 @@ def _list_controller_managers(node): @rtype list of str """ return [ - name.rstrip('list_controllers').rstrip('/') + name.rstrip("list_controllers").rstrip("/") for name, _ in get_service_names_and_types(node=node) - if name.endswith('list_controllers') + if name.endswith("list_controllers") ] def _get_parameter_controller_names(node, node_name): """Get list of ROS parameter names that potentially represent a controller configuration.""" parameter_names = call_list_parameters(node=node, node_name=node_name) - suffix = '.type' + suffix = ".type" return [n[: -len(suffix)] for n in parameter_names.result().result.names if n.endswith(suffix)] diff --git a/rqt_controller_manager/rqt_controller_manager/main.py b/rqt_controller_manager/rqt_controller_manager/main.py index 4dd77d350b..14de0aea54 100644 --- a/rqt_controller_manager/rqt_controller_manager/main.py +++ b/rqt_controller_manager/rqt_controller_manager/main.py @@ -20,8 +20,8 @@ def main(): main = Main() - sys.exit(main.main(sys.argv, standalone='rqt_controller_manager')) + sys.exit(main.main(sys.argv, standalone="rqt_controller_manager")) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/rqt_controller_manager/rqt_controller_manager/update_combo.py b/rqt_controller_manager/rqt_controller_manager/update_combo.py index a838f28112..4a61736aa3 100644 --- a/rqt_controller_manager/rqt_controller_manager/update_combo.py +++ b/rqt_controller_manager/rqt_controller_manager/update_combo.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + def update_combo(combo, new_vals): """ Update the contents of a combo box with a set of new values. @@ -33,7 +34,7 @@ def update_combo(combo, new_vals): selected_id = -1 try: selected_id = new_vals.index(selected_val) - except (ValueError): + except ValueError: combo.setCurrentIndex(-1) # Re-populate items diff --git a/rqt_controller_manager/setup.py b/rqt_controller_manager/setup.py index bf2fc5fb51..b2793c2dda 100644 --- a/rqt_controller_manager/setup.py +++ b/rqt_controller_manager/setup.py @@ -2,27 +2,27 @@ from setuptools import setup -package_name = 'rqt_controller_manager' +package_name = "rqt_controller_manager" setup( name=package_name, - version='3.7.0', + version="3.7.0", packages=[package_name], data_files=[ - ('share/ament_index/resource_index/packages', ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), + ("share/ament_index/resource_index/packages", ["resource/" + package_name]), + ("share/" + package_name, ["package.xml"]), ("share/" + package_name + "/resource", glob("resource/*.*")), ("share/" + package_name, ["plugin.xml"]), ], - install_requires=['setuptools'], + install_requires=["setuptools"], zip_safe=True, - maintainer='Bence Magyar', - maintainer_email='bence.magyar.robotics@gmail.com', - description='Graphical frontend for interacting with the controller manager.', - license='Apache License, Version 2.0', - tests_require=['pytest'], + maintainer="Bence Magyar", + maintainer_email="bence.magyar.robotics@gmail.com", + description="Graphical frontend for interacting with the controller manager.", + license="Apache License, Version 2.0", + tests_require=["pytest"], entry_points={ - 'console_scripts': [ + "console_scripts": [ "rqt_controller_manager = \ rqt_controller_manager.main:main", ],