Skip to content

Commit

Permalink
Get parameter descriptors at once for a node.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoya.Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Oct 29, 2020
1 parent 03d2949 commit 6d077e3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ros2param/ros2param/verb/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,18 @@ def main(self, *, args): # noqa: D102
if not args.node_name:
print(f'{node_name.full_name}:')
response = future.result()
# get descriptors for the node if needs to print parameter type
if args.param_type is True:
resp = call_describe_parameters(
node=node, node_name=node_name.full_name,
parameter_names=sorted(response.result.names))
for name in sorted(response.result.names):
if args.param_type is True:
resp = call_describe_parameters(
node=node, node_name=node_name.full_name,
parameter_names={name})
param_type_str = get_parameter_type_string(resp.descriptors[0].type)
print(f' {name} [{param_type_str}]')
param_type_str = None
for descriptor in resp.descriptors:
if descriptor.name == name:
param_type_str = get_parameter_type_string(descriptor.type)
print(f' {name} (type: {param_type_str})')
else:
print(f' {name}')
else:
Expand Down

0 comments on commit 6d077e3

Please sign in to comment.