ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I couldn't get on_parameter_event to work when the node was within a namespace, but the object is already a Node so doesn't need a paramaeters client, that is redundant- so get rid parameters_client_ and param_sub_ and onParameterEvent above inside the class that is the receiving end of set parameters.
Instead:
register_param_change_callback(
std::bind(&CppTest::onParameterChange, this, _1));
...
rcl_interfaces::msg::SetParametersResult CppTest::onParameterChange(
std::vector<rclcpp::Parameter> parameters)
{
// this doesn't do any checking, it just assumes the parameter
// changes are good
dirty_ = true;
auto result = rcl_interfaces::msg::SetParametersResult();
result.successful = true;
return result;
}
2 | No.2 Revision |
I couldn't get on_parameter_event to work when the node was within a namespace, but the object is already a Node so doesn't need a paramaeters client, that is redundant- so get rid parameters_client_ and param_sub_ and onParameterEvent above inside the class that is the receiving end of set parameters.
Instead:
class CppTest : public rclcpp::Node {
...
register_param_change_callback(
std::bind(&CppTest::onParameterChange, this, _1));
...
rcl_interfaces::msg::SetParametersResult CppTest::onParameterChange(
std::vector<rclcpp::Parameter> parameters)
{
// this doesn't do any checking, it just assumes the parameter
// changes are good
dirty_ = true;
auto result = rcl_interfaces::msg::SetParametersResult();
result.successful = true;
return result;
}
3 | No.3 Revision |
I couldn't get on_parameter_event to work when the node was within a namespace, but the object is already a Node so doesn't need a paramaeters client, parameters client for itself, that is redundant- so get rid parameters_client_ and param_sub_ and onParameterEvent above inside the class that is the receiving end of set parameters.
Instead:
class CppTest : public rclcpp::Node {
...
register_param_change_callback(
std::bind(&CppTest::onParameterChange, this, _1));
...
rcl_interfaces::msg::SetParametersResult CppTest::onParameterChange(
std::vector<rclcpp::Parameter> parameters)
{
// this doesn't do any checking, it just assumes the parameter
// changes are good
dirty_ = true;
auto result = rcl_interfaces::msg::SetParametersResult();
result.successful = true;
return result;
}