Bug report
Required Info:
- Operating System:
- Installation type:
- Version or commit hash:
Steps to reproduce issue
Setting to accept undeclared parameters and passing initial parameters:
std::vector<rclcpp::Parameter> initial_parameters =
{rclcpp::Parameter("my_string", std::string("str"))};
rclcpp::NodeOptions node_options;
node_options.allow_undeclared_parameters(true);
node_options.initial_parameters(initial_parameters);
auto node = std::make_shared<Node>("name", "ns", node_options);
node->get_parameter(param); // throws
Throws this:
12: terminate called after throwing an instance of 'rclcpp::ParameterTypeException'
12: what(): expected [string] got [not set]
On the other hand, setting the parameters after construction is happy:
rclcpp::NodeOptions node_options;
node_options.allow_undeclared_parameters(true);
auto node = std::make_shared<Node>("name", "ns", node_options);
node->set_parameters(initial_parameters);
node->get_parameter(param); // happy
Expected behavior
No throw on both cases
Actual behavior
Throw on first case
Bug report
Required Info:
Steps to reproduce issue
Setting to accept undeclared parameters and passing initial parameters:
std::vector<rclcpp::Parameter> initial_parameters = {rclcpp::Parameter("my_string", std::string("str"))}; rclcpp::NodeOptions node_options; node_options.allow_undeclared_parameters(true); node_options.initial_parameters(initial_parameters); auto node = std::make_shared<Node>("name", "ns", node_options); node->get_parameter(param); // throwsThrows this:
On the other hand, setting the parameters after construction is happy:
Expected behavior
No throw on both cases
Actual behavior
Throw on first case