Skip to content

Decoding RecordOptions from YAML conflicts with chrono::milliseconds #1764

@JoLichtenfeld

Description

@JoLichtenfeld

Description

Currently, for parsing a yaml node to RecordOptions, the key "topic_polling_interval" of type std::chrono::milliseconds throws an error. Only the key "milliseconds" can be parsed to std::chrono::milliseconds.

Expected Behavior

I try to parse a yaml node node to rosbag2_transport::RecordOptions using this approach:
ROSBAG2_TRANSPORT_PUBLIC YAML::convert<rosbag2_transport::RecordOptions>::decode(node, record_options);
The yaml node looks like this:

...
topics: []
topic_polling_interval: 100
topic_types: []
...

Actual Behavior

This line called from here (record_options.cpp) throws the following error:

terminate called after throwing an instance of 'YAML::BadSubscript'
what(): yaml-cpp: error at line 29, column 25: operator[] call on a scalar (key: "milliseconds")

The method expects the key "milliseconds". If I change the yaml node to

...
topics: []
topic_polling_interval: 
  milliseconds: 100
topic_types: []
...

it works. But I don't see a reason why the additional key should be necessary.

System

  • OS: Ubuntu 24.04
  • ROS 2 Distro: jazzy

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