You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it is not uncommon to create or destroy either subscription or publisher when the parameter is updated.
for example, having /enable_data_generator parameter in sensor node, and sensor node watches parameter activity with post set parameter callback using add_post_set_parameters_callback. and once that is enabled, sensor node creates the publisher to start publishing sensing data. (or vice-verse)
there is no problem creating publisher or subscription via parameter callback without QoS override parameters for publisher or subscription. but with QoS override parameters, this does not allow us to create publisher or subscription. because parameter set or declare operation is protected by ParameterMutationRecursionGuard.
### this nodes waits until the parameter update, and then tries to create the subscription during parameter post set callback
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run prover_rclcpp create_sub_via_param
terminate called after throwing an instance of 'rclcpp::exceptions::ParameterModifiedInCallbackException'what(): cannot set or declare a parameter, or change the callback from within set callback
[ros2run]: Aborted
### this command never comes back, since it actually kills the server node
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param set /test_node create_sub true
this issue is blocking the enhancement PR #2378,
that 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.
The text was updated successfully, but these errors were encountered:
Description
it is not uncommon to create or destroy either subscription or publisher when the parameter is updated.
for example, having
/enable_data_generator
parameter in sensor node, and sensor node watches parameter activity with post set parameter callback usingadd_post_set_parameters_callback
. and once that is enabled, sensor node creates the publisher to start publishing sensing data. (or vice-verse)there is no problem creating publisher or subscription via parameter callback without QoS override parameters for publisher or subscription. but with QoS override parameters, this does not allow us to create publisher or subscription. because parameter set or declare operation is protected by
ParameterMutationRecursionGuard
.rclcpp/rclcpp/include/rclcpp/node_interfaces/node_parameters.hpp
Line 236 in 605251b
this is blocking user application to create either publisher or subscription via parameter callback.
Reproducible Sample
https://github.com/fujitatomoya/ros2_test_prover/blob/master/prover_rclcpp/src/create_sub_via_param.cpp
Additional Information
related to https://github.com/ros2/rclcpp/pull/2378/files#r1411471264
this issue is blocking the enhancement PR #2378,
that 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 anduse_sim_time
parameter from/parameter_event
topic.The text was updated successfully, but these errors were encountered: