I saw that this was moved, but I believe I am running into an issue that is independent of the ParameterService starting by default.
I haven't seen an example of doing ros params not involving the "manual_composition" yet. All the tutorials for parameters still appear to use clients/services.
Looking over the comments for the register_param_change_callback, it appears that the callback should be doing set_parameters_atomically, unless I am misreading that.
This is what I have:
auto node = rclcpp::node::Node::make_shared(path_control_auditor::NODE_NAME);
auto paramServer = make_shared<rclcpp::parameter_service::ParameterService>(node);
node->set_parameters({ rcllcpp::parameter::ParameterVariant("someVar", ""), });
node->register_param_change_callback(
[node](const std::vector<rclcpp::parameter::ParameterVariant> params) {
for (auto param : params)
{
std::cout << "Parameter name: " << param.get_name() << std::endl;
std::cout << "Parameter value (" << param.get_type_name() << "): " <<
param.value_to_string() << std::endl;
}
rcl_interfaces::msg::SetParametersResult result;
result = node->set_parameters_atomically(params);
return result;
}
);
Then when I use ros2params to set the parameter. Callback occurs, but as soon as "set_paremeters_atomically" occurs, I get memory violations. If I fail to call that I see no problems.
So am I reading the comments correctly? Should I be calling "set_parameters_atomically"
FYI, I am using Alpha 8 on Windows.
Thanks,
---
[Visit Topic](
https://discourse.ros.org/t/composition-and-parameters-best-practice-suggestions/1001/10) or reply to this email to respond.
If you do not want to receive messages from ros-users please use the unsubscribe link below. If you use the one above, you will stop all of ros-users from receiving updates.
______________________________________________________________________________
ros-users mailing list
ros-users@lists.ros.org
http://lists.ros.org/mailman/listinfo/ros-users
Unsubscribe: <
http://lists.ros.org/mailman//options/ros-users>