ros2 / ros2/rclcpp

cannot use QoS override parameters via `NodeParameter` callbacks

Open
#2,379 3 comments 0 reactions 1 assignee View on GitHub

@fujitatomoya is already working on this.

Since Dec 1, 2023.

Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Bug report

Required Info:

Steps to reproduce issue
  • register callback that creates the subscription with QosOverridingOptions via add_post_set_parameters_callback.
  • update parameter successfully, the gets ParameterModifiedInCallbackException exception.
cd colcon_ws/src
git clone https://github.com/fujitatomoya/ros2_test_prover
cd colcon_ws
colcon build --symlink-install --packages-select prover_interfaces prover_rclcpp
ros2 run prover_rclcpp rclcpp_237

and, with another terminal

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param get /test_params switch
Boolean value is: False
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param set /test_params switch true
Set parameter successful
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param set /test_params switch false
Set parameter successful

this will generate the exception below,

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run prover_rclcpp rclcpp_2379
[INFO] [1701396695.327098876] [test_params]: Parameter switch changed: 1
[INFO] [1701396695.327206255] [test_params]: Creating Subscription
[ERROR] [1701396695.327343914] [test_params]: Caught Exception with cannot set or declare a parameter, or change the callback from within set callback
[INFO] [1701396699.343136018] [test_params]: Parameter switch changed: 0
[INFO] [1701396699.343206436] [test_params]: Destroying Subscription
^C[INFO] [1701396701.596623929] [rclcpp]: signal_handler(signum=2)
Expected behavior

No exception received.

Actual behavior

ParameterModifiedInCallbackException

Additional information

This behavior blocks https://github.com/ros2/rclcpp/pull/2378

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.