BehaviorTree.ROS2 icon indicating copy to clipboard operation
BehaviorTree.ROS2 copied to clipboard

Incompatibility Issue Between BehaviorTree.ROS2 (v4) and nav2_behavior_tree (v3) Causing Crash

Open Noah-Lau opened this issue 8 months ago • 2 comments

Description:

I am encountering an issue while trying to use BehaviorTree.ROS2 with navigation2 in a ROS 2 Humble environment on Ubuntu 22.04. Specifically, I want to trigger navigation actions using BehaviorTree.ROS2 instead of the default nav2_bt_navigator. To achieve this, I copied the behavior tree XML files from navigation2 into my sample_bt_executor.yaml configuration for a custom sample_bt_executor node. However, this results in a crash with the following logs:

[INFO] [launch]: All log files can be found below /home/noah/.ros/log/2025-07-04-14-16-02-229927-noah-298395
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [sample_bt_executor-1]: process started with pid [298405]
[INFO] [sleep_server-2]: process started with pid [298407]
[sample_bt_executor-1] [INFO] [1751609762.298440445] [bt_action_server]: Starting Action Server: behavior_server
[sample_bt_executor-1] [INFO] [1751609762.300898229] [bt_action_server]: Loaded ROS Plugin: libmovebase_node_dyn.so
[sample_bt_executor-1] [INFO] [1751609762.301057632] [bt_action_server]: Loaded ROS Plugin: libcrossdoor_nodes_dyn.so
[sample_bt_executor-1] [INFO] [1751609762.301256744] [bt_action_server]: Loaded ROS Plugin: libdummy_nodes_dyn.so
[sample_bt_executor-1] [INFO] [1751609762.302595313] [bt_action_server]: Loaded ROS Plugin: libsleep_plugin.so
[sample_bt_executor-1] munmap_chunk(): invalid pointer
[ERROR] [sample_bt_executor-1]: process has died [pid 298405, exit code -6, cmd '/home/noah/ros2_ws/install/btcpp_ros2_samples/lib/btcpp_ros2_samples/sample_bt_executor --ros-args --params-file /home/noah/ros2_ws/install/btcpp_ros2_samples/share/btcpp_ros2_samples/config/sample_bt_executor.yaml'].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[sleep_server-2] [INFO] [1751610662.775527823] [rclcpp]: signal_handler(signum=2)
[INFO] [sleep_server-2]: process has finished cleanly [pid 298407]

Problem Details:

  • BehaviorTree.ROS2 in my setup is using behaviortree_cpp v4, while the Humble version of navigation2's nav2_behavior_tree is built with behaviortree_cpp v3.
  • I copied the behavior tree XML files (e.g., from navigation2) into sample_bt_executor.yaml to trigger navigation actions via my custom sample_bt_executor instead of nav2_bt_navigator.
  • The process starts and loads several plugins successfully, but crashes with munmap_chunk(): invalid pointer and exit code -6 (SIGABRT), indicating a memory management issue.

Suspected Cause: I suspect this crash is due to the incompatibility between behaviortree_cpp v4 (used by BehaviorTree.ROS2) and v3 (used by nav2_behavior_tree). The mismatch might cause memory allocation/deallocation conflicts, leading to the munmap_chunk() error.

Question: How can I resolve this incompatibility? Possible approaches I am considering include:

  • Modifying navigation2 to build with behaviortree_cpp v4.
  • Adapting the XML files or plugins to be compatible with v4.
  • Using a different version of ROS 2 (e.g., Jazzy) that natively supports v4.

Could you please provide guidance on the best way to address this issue? Any suggestions or patches would be greatly appreciated!

Environment:

  • OS: Ubuntu 22.04
  • ROS 2 Version: Humble Hawksbill
  • behaviortree_cpp Version: v4 (BehaviorTree.ROS2), v3 (nav2_behavior_tree)

Additional Information:

  • I am willing to provide further logs or code snippets if needed.
  • The project involves integrating custom navigation logic with XMobilityNavigator from booster_robotics_sdk.

Noah-Lau avatar Jul 04 '25 08:07 Noah-Lau

Yes, please, provide the most basic example to reproduce the issue

On Fri, Jul 4, 2025, 10:04 AM Noah-Lau @.***> wrote:

Noah-Lau created an issue (BehaviorTree/BehaviorTree.ROS2#116) https://github.com/BehaviorTree/BehaviorTree.ROS2/issues/116

Description:

I am encountering an issue while trying to use BehaviorTree.ROS2 with navigation2 in a ROS 2 Humble environment on Ubuntu 22.04. Specifically, I want to trigger navigation actions using BehaviorTree.ROS2 instead of the default nav2_bt_navigator. To achieve this, I copied the behavior tree XML files from navigation2 into my sample_bt_executor.yaml configuration for a custom sample_bt_executor node. However, this results in a crash with the following logs:

[INFO] [launch]: All log files can be found below /home/noah/.ros/log/2025-07-04-14-16-02-229927-noah-298395 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [sample_bt_executor-1]: process started with pid [298405] [INFO] [sleep_server-2]: process started with pid [298407] [sample_bt_executor-1] [INFO] [1751609762.298440445] [bt_action_server]: Starting Action Server: behavior_server [sample_bt_executor-1] [INFO] [1751609762.300898229] [bt_action_server]: Loaded ROS Plugin: libmovebase_node_dyn.so [sample_bt_executor-1] [INFO] [1751609762.301057632] [bt_action_server]: Loaded ROS Plugin: libcrossdoor_nodes_dyn.so [sample_bt_executor-1] [INFO] [1751609762.301256744] [bt_action_server]: Loaded ROS Plugin: libdummy_nodes_dyn.so [sample_bt_executor-1] [INFO] [1751609762.302595313] [bt_action_server]: Loaded ROS Plugin: libsleep_plugin.so [sample_bt_executor-1] munmap_chunk(): invalid pointer [ERROR] [sample_bt_executor-1]: process has died [pid 298405, exit code -6, cmd '/home/noah/ros2_ws/install/btcpp_ros2_samples/lib/btcpp_ros2_samples/sample_bt_executor --ros-args --params-file /home/noah/ros2_ws/install/btcpp_ros2_samples/share/btcpp_ros2_samples/config/sample_bt_executor.yaml']. ^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT) [sleep_server-2] [INFO] [1751610662.775527823] [rclcpp]: signal_handler(signum=2) [INFO] [sleep_server-2]: process has finished cleanly [pid 298407]

Problem Details:

  • BehaviorTree.ROS2 in my setup is using behaviortree_cpp v4, while the Humble version of navigation2's nav2_behavior_tree is built with behaviortree_cpp v3.
  • I copied the behavior tree XML files (e.g., from navigation2) into sample_bt_executor.yaml to trigger navigation actions via my custom sample_bt_executor instead of nav2_bt_navigator.
  • The process starts and loads several plugins successfully, but crashes with munmap_chunk(): invalid pointer and exit code -6 (SIGABRT), indicating a memory management issue.

Suspected Cause: I suspect this crash is due to the incompatibility between behaviortree_cpp v4 (used by BehaviorTree.ROS2) and v3 (used by nav2_behavior_tree). The mismatch might cause memory allocation/deallocation conflicts, leading to the munmap_chunk() error.

Question: How can I resolve this incompatibility? Possible approaches I am considering include:

  • Modifying navigation2 to build with behaviortree_cpp v4.
  • Adapting the XML files or plugins to be compatible with v4.
  • Using a different version of ROS 2 (e.g., Jazzy) that natively supports v4.

Could you please provide guidance on the best way to address this issue? Any suggestions or patches would be greatly appreciated!

Environment:

  • OS: Ubuntu 22.04
  • ROS 2 Version: Humble Hawksbill
  • behaviortree_cpp Version: v4 (BehaviorTree.ROS2), v3 (nav2_behavior_tree)

Additional Information:

  • I am willing to provide further logs or code snippets if needed.
  • The project involves integrating custom navigation logic with XMobilityNavigator from booster_robotics_sdk.

— Reply to this email directly, view it on GitHub https://github.com/BehaviorTree/BehaviorTree.ROS2/issues/116, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVRF2BY5Z35YGMCM2ZBT5D3GYYRLAVCNFSM6AAAAACAYYFEVWVHI2DSMVQWIX3LMV43ASLTON2WKOZTGIYDCNZUGI2TEMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

facontidavide avatar Jul 04 '25 08:07 facontidavide

Thank you for your response! I have prepared the most basic example to reproduce the issue based on your request. Below are the detailed steps to reproduce the problem:

Reproduction Steps

1. Verify the Added XML Files

I added the behavior tree XML files to the btcpp_ros2_samples/behavior_trees directory. I used the tree command to confirm the structure:


noah@noah:~/ros2_ws/src/BehaviorTree.ROS2/btcpp_ros2_samples/behavior_trees$ tree
.
├── cross_door.xml
├── door_closed.xml
├── navigate_through_poses_w_replanning_and_recovery.xml
└── sleep_action.xml
  • The output confirms that navigate_through_poses_w_replanning_and_recovery.xml is present, which is the file I intend to use.

2. Update sample_bt_executor.yaml

I modified the sample_bt_executor.yaml configuration file to include the necessary plugin paths and behavior trees. The updated content is as follows:

yaml
bt_action_server:
  ros__parameters:
    action_name: "behavior_server" # Optional (defaults to `bt_action_server`)
    tick_frequency: 100 # Optional (defaults to 100 Hz)
    groot2_port: 1667 # Optional (defaults to 1667)
    ros_plugins_timeout: 1000  # Optional (defaults 1000 ms)
    enable_groot_monitoring: true

    plugins:
      - behaviortree_cpp/bt_plugins
      - btcpp_ros2_samples/bt_plugins
      - nav2_behavior_tree/lib

    behavior_trees:
      - btcpp_ros2_samples/behavior_trees

I added - nav2_behavior_tree/lib to the plugins list and verified that this path contains the required plugins (e.g., libnav2_recovery_node_bt_node.so).

3. Launch the Node

I launched the node using the following command: noah@noah:~/ros2_ws$ ros2 launch btcpp_ros2_samples sample_bt_executor.launch.xml The output and error logs are as follows:

[INFO] [launch]: All log files can be found below /home/noah/.ros/log/2025-07-04-17-23-15-498971-noah-8917
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [sample_bt_executor-1]: process started with pid [8918]
[INFO] [sleep_server-2]: process started with pid [8920]
[sample_bt_executor-1] [INFO] [1751620995.559912302] [bt_action_server]: Starting Action Server: behavior_server
[sample_bt_executor-1] [INFO] [1751620995.562403415] [bt_action_server]: Loaded ROS Plugin: libmovebase_node_dyn.so
[sample_bt_executor-1] [INFO] [1751620995.562566903] [bt_action_server]: Loaded ROS Plugin: libcrossdoor_nodes_dyn.so
[sample_bt_executor-1] [INFO] [1751620995.562759454] [bt_action_server]: Loaded ROS Plugin: libdummy_nodes_dyn.so
[sample_bt_executor-1] [INFO] [1751620995.564772130] [bt_action_server]: Loaded ROS Plugin: libsleep_plugin.so
[sample_bt_executor-1] munmap_chunk(): invalid pointer
[ERROR] [sample_bt_executor-1]: process has died [pid 8918, exit code -6, cmd '/home/noah/ros2_ws/install/btcpp_ros2_samples/lib/btcpp_ros2_samples/sample_bt_executor --ros-args --params-file /home/noah/ros2_ws/install/btcpp_ros2_samples/share/btcpp_ros2_samples/config/sample_bt_executor.yaml'].

Noah-Lau avatar Jul 04 '25 09:07 Noah-Lau