diff --git a/ros2controlcli/ros2controlcli/verb/list_hardware_components.py b/ros2controlcli/ros2controlcli/verb/list_hardware_components.py index a319a09b1b..abce8bfb04 100644 --- a/ros2controlcli/ros2controlcli/verb/list_hardware_components.py +++ b/ros2controlcli/ros2controlcli/verb/list_hardware_components.py @@ -38,13 +38,18 @@ 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}') + print(f'Hardware Component {idx+1}\n\tname: {component.name}\n\ttype: {component.type}') if hasattr(component, 'plugin_name'): plugin_name = component.plugin_name + # Keep compatibility to the obsolete filed name in Humble + elif hasattr(component, 'class_type'): + plugin_name = component.class_type else: 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' + f'\tstate: id={component.state.id} label={component.state.label}\n' + f'\tcommand interfaces') for cmd_interface in component.command_interfaces: if cmd_interface.is_available: