ros2 rclpy list parameters from node
Is there an easy way to list parameters from an rclpy Node ??
I can 'manually' set up a service client and do the list_parameters
call but it feels like this should be abstracted,
Current solution,
class Dummy(Node):
def __init__(self):
super().__init__('dummy', allow_undeclared_parameters=True,
automatically_declare_parameters_from_overrides=True)
service_name = self.get_name() + '/list_parameters'
client = self.create_client(ListParameters, service_name)
while not client.service_is_ready():
time.sleep(0.1)
request = ListParameters.Request()
future = client.call_async(request)
# wait for response
rclpy.spin_until_future_complete(self, future)
if future.result is not None:
response = future.result()
for name in sorted(response.result.names):
print(' {name}'.format_map(locals()))
Desired,
class Dummy(Node):
def __init__(self):
super().__init__('dummy', allow_undeclared_parameters=True,
automatically_declare_parameters_from_overrides=True)
param_list = self.list_parameters()