Closed KrasnovPavel closed 2 years ago
From your logs for Foxy and Galactic I can observe that the BT you are using for galactic and foxy are completely different.
In the foxy log, you can note that different BT nodes that are not part of your BT are configured by the BT Navigator, such as FollowPath
and ClearGlobalCostmap-Context
. This is indeed not configured by the BT navigator for Galactic. Also, these behaviors are not configured in the BT attached by you.
Also ComputePathToPose
on a simpler terms is just for generating the path by the planner. If you want your robot to move, you indeed need to use the FollowPath
BT node, which would indeed send the generated plan to the controller. You can also look into the default BT tree of Nav2 and of course our wonderful documentation for more information, hope this helps.
Thanks for your response!
From your logs for Foxy and Galactic I can observe that the BT you are using for galactic and foxy are completely different. In the foxy log, you can note that different BT nodes that are not part of your BT are configured by the BT Navigator, such as FollowPath and ClearGlobalCostmap-Context. This is indeed not configured by the BT navigator for Galactic. Also, these behaviors are not configured in the BT attached by you.
I reexamined logs and it looks like galactic does not log bt_navigation configuration process at all. In my yaml file I tried to:
bt_navigator.default_nav_to_pose_bt_xml
and in all cases I get in log only
[lifecycle_manager-6] [INFO] [1642144534.123876069] [lifecycle_manager_navigation]: Configuring bt_navigator
[bt_navigator-4] [INFO] [1642144534.124013902] [bt_navigator]: Configuring
while in foxy it is much more detailed:
[lifecycle_manager-6] [INFO] [1642086578.216939354] [lifecycle_manager_navigation]: Configuring bt_navigator
[bt_navigator-4] [INFO] [1642086578.217099191] [bt_navigator]: Configuring
[bt_navigator-4] [INFO] [1642086578.249554992] [bt_navigator_rclcpp_node]: Waiting for "compute_path_to_pose" action server
[bt_navigator-4] [INFO] [1642086578.249726056] [bt_navigator_rclcpp_node]: "ComputePathToPose" BtActionNode initialized
[bt_navigator-4] [INFO] [1642086578.250442107] [bt_navigator_rclcpp_node]: Waiting for "global_costmap/clear_entirely_global_costmap" service
[bt_navigator-4] [INFO] [1642086578.250518040] [bt_navigator_rclcpp_node]: "ClearGlobalCostmap-Context" BtServiceNode initialized
[bt_navigator-4] [INFO] [1642086578.253388677] [bt_navigator_rclcpp_node]: Waiting for "follow_path" action server
[bt_navigator-4] [INFO] [1642086578.253525401] [bt_navigator_rclcpp_node]: "FollowPath" BtActionNode initialized
[bt_navigator-4] [INFO] [1642086578.254252399] [bt_navigator_rclcpp_node]: Waiting for "local_costmap/clear_entirely_local_costmap" service
[bt_navigator-4] [INFO] [1642086578.254422363] [bt_navigator_rclcpp_node]: "ClearLocalCostmap-Context" BtServiceNode initialized
[bt_navigator-4] [INFO] [1642086578.255300009] [bt_navigator_rclcpp_node]: Waiting for "local_costmap/clear_entirely_local_costmap" service
[bt_navigator-4] [INFO] [1642086578.255396095] [bt_navigator_rclcpp_node]: "ClearLocalCostmap-Subtree" BtServiceNode initialized
[bt_navigator-4] [INFO] [1642086578.256146041] [bt_navigator_rclcpp_node]: Waiting for "global_costmap/clear_entirely_global_costmap" service
[bt_navigator-4] [INFO] [1642086578.256241174] [bt_navigator_rclcpp_node]: "ClearGlobalCostmap-Subtree" BtServiceNode initialized
[bt_navigator-4] [INFO] [1642086578.260113468] [bt_navigator_rclcpp_node]: Waiting for "spin" action server
[bt_navigator-4] [INFO] [1642086578.260256003] [bt_navigator_rclcpp_node]: "Spin" BtActionNode initialized
[bt_navigator-4] [INFO] [1642086578.263619358] [bt_navigator_rclcpp_node]: Waiting for "wait" action server
[bt_navigator-4] [INFO] [1642086578.263770860] [bt_navigator_rclcpp_node]: "Wait" BtActionNode initialized
Also ComputePathToPose on a simpler terms is just for generating the path by the planner.
I know it. I am using only ComputePathToPose
to isolate the problem. I am trying do debug BT using my simple xml:
<root main_tree_to_execute="MainTree">
<BehaviorTree ID="MainTree">
<RecoveryNode number_of_retries="1" name="rec">
<Sequence name="pipe">
<Spin spin_dist="0.3" server_name="spin" server_timeout="10"/>
<ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/>
<Spin spin_dist="-0.6" server_name="spin" server_timeout="10"/>
</Sequence>
<Spin spin_dist="-0.3" server_name="spin" server_timeout="10"/>
</RecoveryNode>
</BehaviorTree>
</root>
as far as I understand BTs it should do spin then compute path and then do big counterspin or if something goes wrong do small counterspin.
not specify bt_navigator.default_nav_to_pose_bt_xml set it to "/opt/ros/galactic/share/nav2_bt_navigator/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml" set it to my simple BT: "/home/notebook/work/ROS2-planner/src/planner/config/nav_to_pose.xml"
I tried to reproduce your issue, but all the BT works as intended.
and in all cases I get in log only
You are right, galactic does not show all the BT node configurations. But, they work as intended.
as far as I understand BTs it should do spin then compute path and then do big counterspin or if something goes wrong do small counterspin.
It does an initial spin, plans a path and finally does another spin.
I've added bt_navigator.default_nav_to_pose_bt_xml parameter pointing to my custom very simple tree:
Make sure, you've done this correctly. Also, if you are using nav2_bringup I highly doubt there is an issue right now with it. As most of the features that I develop are tested with the launch from nav2_bringup.
Btw, do you know how to debug BTs properly?
At the moment, I do not have an actual suggestion for the debugging. For me it is more based on the behavior that the robot exhibits and it's just on the fly.
BTW, it would have been nice if you had asked this question in ROS Answers. As, I think there is no actual bug with any of the BT nodes or BT itself.
Please ask on ROS Answers, I'm pretty active on there. Lets keep the issue tracker for issues / features
Bug report
Required Info:
Steps to reproduce issue
I am launching
ros2 launch nav2_bringup navigation_launch.py params_file:=./src/planner/config/nav2_params_1.yaml
in foxy and in galactic (not simultaneously) with almost identical configs and then trigger actionros2 action send_goal navigate_to_pose nav2_msgs/NavigateToPose "pose: { pose: { position: { x: 1.0 } } }"
. Foxy works correctly and robot is moving while galatcic logs[bt_navigator-4] [INFO] [1642088149.265828484] [bt_navigator]: Begin navigating from current location to (1.00, 0.00)
and does nothing more.In the same time at other terminal I am providing transforms: map->odom and odom->base_link.
My params file
The only difference between foxy and galactic is list of
bt_navigator.plugin_lib_names
(commented are for foxy). I have read migration guide and looks like it should work without additional changes.Logs from foxy:
Logs from Galactic:
I am sure that is exactly
ComputePathToPose
BT-Node because I've addedbt_navigator.default_nav_to_pose_bt_xml
parameter pointing to my custom very simple tree:Now I can see that robot only did first spin action.
Expected behavior
Computing path to pose.
Actual behavior
ComputePathToPose silently does noting.