ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS 2 Crystal : Can't get parameter list of string from YAML file

asked 2019-06-11 03:16:49 -0500

Marc Testier gravatar image

updated 2019-06-11 21:23:11 -0500

Hi, I'm using ROS 2 Crystal and I'm trying to get a list of string from a YAML file in Python.
The problem is that my list also contains numbers, I don't mind them being converted into strings so my YAML file looks like:

        some_list: ['1', '2', '3', '4', 'some_string']

But the parser keeps converting the strings '1', '2', etc into numbers so I get an error Failed to parse yaml params file ...: Sequence should be of same type. Value type 'string' do not belong at line_num X.

If I change some_string to an int, I do get an ARRAY_INTEGER but that's not what I want.
Any way to force the YAML parser to keep '1' as a string ?

I tried using double quotes "1", I tried adding !!str or !!string but it seems to be ignored and gives the same result.

As a temporary solution, I escape my list with a : and remove it in the code but it's a bit ugly...

        some_list: [':1', ':2', ':3', ':4', ':some_string']


edit: Same problem in ROS 2 Dashing.

edit retag flag offensive close merge delete


This sounds like a bug in the YAML parser. If a value is quoted I think it should be interpreted as a string, not a number. You can open an issue at

jacobperron gravatar image jacobperron  ( 2019-06-18 20:52:06 -0500 )edit
Marc Testier gravatar image Marc Testier  ( 2019-06-19 19:52:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-19 20:01:32 -0500

Marc Testier gravatar image

updated 2019-09-19 20:02:03 -0500

Seems like the issue as been fixed:

edit flag offensive delete link more

Question Tools



Asked: 2019-06-11 03:16:49 -0500

Seen: 1,196 times

Last updated: Sep 19 '19