Skip to content

Can't get parameter list of string from YAML file #461

@MarcTestier

Description

@MarcTestier

Bug report

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • Crystal and Dashing
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • N/A (rclpy maybe ?)

Steps to reproduce issue

I'm using Python and I'm trying to get a list of strings from a YAML file with as bellow:

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

Expected behavior

I should get a list of strings

Actual behavior

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 because now the parser thinks that I got both numbers and strings in my list.

If I change some_string to an int, I do get an ARRAY_INTEGER but that's not what I want.
As a temporary solution, I escape my list with a : and remove it in the code but it's a bit ugly...

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

Additional information

I posted on ROS Answers here: https://answers.ros.org/question/325288/ros-2-crystal-cant-get-parameter-list-of-string-from-yaml-file/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions