Skip to content

Commit

Permalink
Improve list hardware components output and code for better readabili…
Browse files Browse the repository at this point in the history
…ty. (#1060)

(cherry picked from commit e14497e)

# Conflicts:
#	ros2controlcli/ros2controlcli/verb/list_hardware_components.py
  • Loading branch information
destogl authored and mergify[bot] committed Jun 23, 2023
1 parent 0dfe01a commit 8474658
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ros2controlcli/ros2controlcli/verb/list_hardware_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,33 @@ def main(self, *, args):
hardware_components = list_hardware_components(node, args.controller_manager)

for idx, component in enumerate(hardware_components.component):
<<<<<<< HEAD
print(f'Hardware Component {idx+1}\n\tname: {component.name}\n\ttype: {component.type}')
if hasattr(component, 'plugin_name'):
=======
print(
f"Hardware Component {idx+1}\n\tname: {component.name}\n\ttype: {component.type}"
)
if hasattr(component, "plugin_name"):
>>>>>>> e14497e (Improve list hardware components output and code for better readability. (#1060))
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}'

<<<<<<< HEAD
print(f'\tplugin name: {plugin_name}\n'
f'\tstate: id={component.state.id} label={component.state.label}\n'
f'\tcommand interfaces')
=======
print(
f"\tplugin name: {plugin_name}\n"
f"\tstate: id={component.state.id} label={component.state.label}\n"
f"\tcommand interfaces"
)
>>>>>>> e14497e (Improve list hardware components output and code for better readability. (#1060))
for cmd_interface in component.command_interfaces:

if cmd_interface.is_available:
Expand Down

0 comments on commit 8474658

Please sign in to comment.