Passing array of strings as launch arguments in ROS2 python launcher
Dear ROS users,
I am not able to set an array of string as a launch argument in a launcher:
def generate_launch_description():
vals = ['A', 'B']
model_files = LaunchConfiguration('model_files', default=vals)
declare_model_file_cmd = DeclareLaunchArgument(
'model_files',
default_value=vals,
description='PDDL Model file')
# Specify the actions
domain_expert_cmd = Node(
package='plansys2_domain_expert',
node_executable='domain_expert_node',
node_name='domain_expert',
output='screen',
parameters=[{'model_files': model_files}])
ld = LaunchDescription()
ld.add_action(declare_model_file_cmd)
ld.add_action(domain_expert_cmd)
return ld
In my C++ node:
declare_parameter("model_files", std::vector<std::string>());
I receive this message:
[domain_expert_node-1] terminate called after throwing an instance of 'rclcpp::ParameterTypeException'
[domain_expert_node-1] what(): expected [string_array] got [string]
Does anybody know how to use an array of string as a launcher argument?
Best