Skip to content

Save / Dump / Load parameters to / from file using rclcpp #2981

@Mat198

Description

@Mat198

Description

Create a function to save parameters to a file inside a C++ node. Something like `node->save_parameters(path);'. This can be useful when the parameters are changed inside a callback and the user wants to restart the node with those changes applied.

I understand that the launch files provide sufficient features to load the parameters at start. However, it can be useful to load a configuration set, making it easier to change the file loaded than each parameter individually.

It differs from ros2_persist_parameter_server in that it's not centralized. The parameters are still owned by the node, and it's responsible for managing them. A non-centrilized aproach is better for modularity as it's not necessary to add or remove packages from the central entity when changes are made. The ros2 param dump is also not the best option, given the modularity argument. Maintenance in a central entity is something we would like to avoid.

Motivation

I'm working on an autonomous sprayer called Arbus 4000 JAV. We have several parameters, such as spraying configuration and behaviour ones, in the system. We would like to save these parameters in a persistent way so the user can change them at run time and have them already configured on reboot. Also, it's useful to change between preconfigured spraying behaviours for different crops wich consist in load some parameters.

Design / Implementation Considerations

No response

Additional Information

Does it make sense to be part of the rclcpp, or is it better to have a dedicated class for that?

Is there a better way to do that? Are there any other use cases?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions