-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use NodeParameterInterface instead of /parameter_event to update "use… #2378
base: rolling
Are you sure you want to change the base?
Conversation
…_sim_time" Signed-off-by: Tomoya Fujita <[email protected]>
// TODO(tfoote) use parameters interface not subscribe to events via topic ticketed #609 | ||
parameter_subscription_ = rclcpp::AsyncParametersClient::on_parameter_event( | ||
node_topics_, | ||
[this](std::shared_ptr<const rcl_interfaces::msg::ParameterEvent> event) { | ||
this->on_parameter_event(event); | ||
}); | ||
post_set_parameters_callback_ = node_parameters_->add_post_set_parameters_callback( | ||
std::bind(&TimeSource::NodeState::post_set_parameters, this, std::placeholders::_1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using NodeParameterInterface instead of /parameter_event
provides significant efficiency especially ROS 2 system has many nodes in the network. with this fix, we do not need to receive all the events and filter the node
and use_sim_time
parameter from /parameter_event
topic.
ParameterMutationRecursionGuard guard(parameter_modification_enabled_); | ||
// ParameterMutationRecursionGuard guard(parameter_modification_enabled_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this recursion guard is block this PR work.
rclcpp/rclcpp/include/rclcpp/node_interfaces/node_parameters.hpp
Lines 58 to 80 in 26f6efa
// Internal RAII-style guard for mutation recursion | |
class ParameterMutationRecursionGuard | |
{ | |
public: | |
explicit ParameterMutationRecursionGuard(bool & allow_mod) | |
: allow_modification_(allow_mod) | |
{ | |
if (!allow_modification_) { | |
throw rclcpp::exceptions::ParameterModifiedInCallbackException( | |
"cannot set or declare a parameter, or change the callback from within set callback"); | |
} | |
allow_modification_ = false; | |
} | |
~ParameterMutationRecursionGuard() | |
{ | |
allow_modification_ = true; | |
} | |
private: | |
bool & allow_modification_; | |
}; |
i guess this is not only for this PR's blocker, but also when we create either publisher
or subscription
with overriding the QoS parameters enabled via parameter callback. i guess it is something user would do when the specific parameter is enabled, and then create the subscription
with QoS override. this will be generating rclcpp::exceptions::ParameterModifiedInCallbackException
because it eventually call rclcpp::detail::declare_qos_parameters
.
i will submit the issue to open this discussion.
…_sim_time"
address #2370