-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Bug report
Required Info:
- Operating System: Ubuntu 22.04
- ROS2 Version: Humble
- Version or commit hash: 1.1.8
- Package: nav2_behavior_tree
Description of the bug
Behavior Tree XML Nodes Plugins (Action, Condition, Control and Decorator) are trying to get parameters from bt_navigator when they can't. For instance, DistanceController from distance_controller.cpp is performing this code:
node_ = config().blackboard->get<rclcpp::Node::SharedPtr>("node");
node_->get_parameter("transform_tolerance", transform_tolerance_);
When node_ is in fact from bt_action_server_impl.hpp:
client_node_ = std::make_shared<rclcpp::Node>("_", options);
blackboard_->set<rclcpp::Node::SharedPtr>("node", client_node_);
Expected behavior
transform_tolerance_ value has the value set in navigation params yaml:
bt_navigator:
ros__parameters:
transform_tolerance: 0.1
Or from nav2_bt_navigator, bt_navigator.cpp:
declare_parameter("transform_tolerance", rclcpp::ParameterValue(0.1));
Actual behavior
transform_tolerance_ is not getting the value from node_->get_parameter. When you print the value, it is 0.0, instead of 0.1.
Additional information
Use navigate_w_replanning_distance.xml behavior tree.
It seems that everything works fine, but in reality, the value is always 0.
The problem seems to be because the fake node, client_node_, is sent instead of the actual node that is given in used in bt_action_server_impl.hpp because adding to this code:
node->get_parameter("transform_tolerance", transform_tolerance_);
where node is auto node = node_.lock(); you have the current value of transform_tolerance.