rclcpp: Cannot load yaml config to composable node in dashing
Bug report
I used to load a yaml configuration file into a composable node with ROS crystal that is started from a standalone executable. This stopped working after porting to dashing. The lack of parameter file loading examples for composable nodes also makes debugging this more difficult.
Required Info:
- Operating System: Ubuntu 18.04
- Installation type: binary
- Version or commit hash: dashing
- DDS implementation: Fast-RTPS
- Client library (if applicable): rclcpp
Steps to reproduce issue
- create a node, e.g.
AprilTag2Node::AprilTag2Node(rclcpp::NodeOptions options) : Node("apriltag2", "apriltag", options.use_intra_process_comms(true)) - create a config config.yaml with with parameters:
apriltag: # namespace
apriltag2: # node name
ros__parameters:
image_transport: raw
size: 0.162
parameter1: 89
parameter2: 56.89
- load a yaml file like:
ros2 run your_package your_node __params:=<path_to>/config.yaml
Expected behavior
A call to get_parameter_or<double>("size", tag_edge_size, 2.0); within the node should provide the value of the parameter in the yaml file.
Actual behavior
The default parameter is returned.
Additional information
The main change for porting from crystal to dashing is the adaptation of the node options:
-AprilTag2Node::AprilTag2Node() : Node("apriltag2", "apriltag", true) {
+AprilTag2Node::AprilTag2Node(rclcpp::NodeOptions options) : Node("apriltag2", "apriltag", options.use_intra_process_comms(true)) {
This should keep the namespace intact and not change the behaviour of setting parameters.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (5 by maintainers)
Links to this issue
Commits related to this issue
- Adapt to ROS2 Dashing: automatically declare paramter According to discussion in RCLCPP, for ROS2 Dashing release, "declare parameter" is expected to load configures from yaml file. See detail discu... — committed to sharronliu/ros2_intel_realsense by sharronliu 5 years ago
- Adapt to ROS2 Dashing: automatically declare paramter Fix issue https://github.com/intel/ros2_intel_realsense/issues/55 According to discussion in RCLCPP, for ROS2 Dashing release, "declare paramete... — committed to sharronliu/ros2_intel_realsense by sharronliu 5 years ago
- Adapt to ROS2 Dashing: automatically declare paramter Fix issue https://github.com/intel/ros2_intel_realsense/issues/55 According to discussion in RCLCPP, for ROS2 Dashing release, "declare paramete... — committed to sharronliu/ros2_intel_realsense by sharronliu 5 years ago
- Topic fix rcl lifecycle test issue (#715) * Fix missing call fini() for lifecycle_transition and node in test_rcl_lifecycle Signed-off-by: Barry Xu <barry.xu@sony.com> * Fix error overwritten w... — committed to ApexAI/rclcpp by Barry-Xu-2018 4 years ago
- use rclcpp logging macros (#715) * use rclcpp::Node for generic pub/sub Signed-off-by: Karsten Knese <Karsten1987@users.noreply.github.com> * address review comments Signed-off-by: Karsten K... — committed to DensoADAS/rclcpp by Karsten1987 3 years ago
@mjcarroll any update on this? The last of the discussion looks to be before the dashing release. We’re coming up on Foxy and this feels like something that should be included in the next LTS.
Hey @christianrauch, @wjwwood and I spent some time discussing this today, and here’s the conclusion for the
dashingrelease:The way that you are currently passing the parameters to the load command
ros2 component load /ComponentManager test Test -r __params:=ros2 pkg prefix test/share/test/cfg/demo.yamlis essentially a remapping argument. The parameter file that is read in that case has to have the parameters nested undernode_name/ros__parametersin the YAML file, which is consistent with how a standalone node will work. In this case though, the container does not receive the parameters via theparametersfield in the service call, but instead receives a remapping argument for__params.The current implementation of the
ComposableNodelaunch description does not understand the nested structure in the YAML file, which causes the parameters to be (incorrectly) expanded to:I think that there are two potential short-term workarounds (without requiring major changes in the way that the
ComposableNodedescription works)yamlfile in as a remapping argument in the launch description:This will then pass in parameters similar to the
loadcall above.yamlfile that doesn’t have any of the nesting:And then pass that in as
parametersto theComposableNodedescription:The caveat on approach 1 is that any additional loose parameters passed via the
parameterskwarg will always supersede what’s in theremappingsargument, where in approach 2, the ordering in the list passed toparametersis important (later definitions will supersede earlier definitions).So in the case of:
The parameter
somethingwill bebaz, but in the case of:The parameter
somethingwill beblah.