Hi,
I would like to understand how to use the new parameters API that will be introduced with ROS2 Dashing.
I read some links but it's still not clear.
https://index.ros.org/doc/ros2/Tutorials/Node-arguments/
https://index.ros.org/doc/ros2/Releases/Release-Dashing-Diademata/#declaring-parameters
My scenario is the following: a node has some parameters. The default values for these parameters have to be hardcoded within the node. When running the node, it should be possible to pass a .yaml file with some updated values for one ore more parameters.
This is my node
class MyNode : public rclcpp::Node
{
public:
MyNode() : rclcpp::Node("my_name",
"",
rclcpp::NodeOptions().append_initial_parameter("my_param", 42))
{ }
}
The problem is that, as pointed out in the source code, initial values passed to constructor overwrite yaml file sources
How should I change the code of my node in order let the hardcoded parameter to be overwritten from the yaml one?
Thank you
Originally posted by alsora on ROS Answers with karma: 1322 on 2019-05-22
Post score: 0