ros2cli icon indicating copy to clipboard operation
ros2cli copied to clipboard

`ros2 param load` sets the unexpected parameter value from yaml

Open fujitatomoya opened this issue 2 years ago • 2 comments

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • source build, rolling
  • Version or commit hash:
    • https://github.com/ros2/ros2/commit/1f5bd8ed43beea199dabe48bc8023af3aba9806c
  • DDS implementation:
    • Any
  • Client library (if applicable):
    • rclpy, ros2cli

Steps to reproduce issue

  • terminal-1
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run demo_nodes_cpp parameter_blackboard --ros-args -r __ns:=/demo
[INFO] [1698430890.996467163] [demo.parameter_blackboard]: Parameter blackboard node named '/demo/parameter_blackboard' ready, and serving '6' parameters already!
...
  • terminal-2
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run demo_nodes_cpp parameter_blackboard --ros-args -r __ns:=/foobar
[INFO] [1698430892.707078622] [foobar.parameter_blackboard]: Parameter blackboard node named '/foobar/parameter_blackboard' ready, and serving '6' parameters already!
...
  • terminal-3
root@tomoyafujita:~/ros2_ws/colcon_ws# cat params.yaml 
/foobar/parameter_blackboard:
  ros__parameters:
    test_double: 1e-06
    test: hoge
/demo/parameter_blackboard:
  ros__parameters:
    test_double: 5e-06

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param load /demo/parameter_blackboard params.yaml
Set parameter test_double successful
Set parameter test successful
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param list /demo/parameter_blackboard
  qos_overrides./parameter_events.publisher.depth
  qos_overrides./parameter_events.publisher.durability
  qos_overrides./parameter_events.publisher.history
  qos_overrides./parameter_events.publisher.reliability
  start_type_description_service
  test
  test_double
  use_sim_time

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param get /demo/parameter_blackboard test
String value is: hoge

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 param get /demo/parameter_blackboard test_double
String value is: 1e-06

Expected behavior

for /demo/parameter_blackboard, i was expecting only test_double with 5e-06

Actual behavior

/demo/parameter_blackboard is set with the parameters of /foobar/parameter_blackboard siliently.

Additional information

i think rclpy.parameter.parameter_dict_from_yaml_file should be called with targeted remote node name. if wildcard is not enabled, it should generate the exception if it can find /** in the yaml parameter file. and then we can check the target_nodes are actually in the yaml parameter file.

fujitatomoya avatar Oct 27 '23 18:10 fujitatomoya

either @iuhilnehc-ynos or @Barry-Xu-2018 , can you take a look at the following patches?

  • https://github.com/ros2/rclpy/pull/1193
  • https://github.com/ros2/ros2cli/pull/864

fujitatomoya avatar Nov 01 '23 06:11 fujitatomoya

@clalancette assigned for you to review 🧇

sloretz avatar Nov 16 '23 17:11 sloretz