This repository is a fork of the original project available at uml-robotics/robot-explanation-BTs and is associated with the paper, "What Will You Do Next? Extending Explanation Generation Using Behavior Trees to Include Projection-Level XAI."
In the context of this paper, we have introduced an extension to an existing codebase for generating explanations using behavior trees (BTs). Our contributions to this project include:
-
Next Action Explanations: We've created algorithms that allow users to ask about what an agent's next action will be in case of success or failure in their current action.
-
Pre/Post-Condition Explanations: The extended codebase allows users to pose questions regarding the preconditions and postconditions of the current action being executed.
-
Code Refactoring: We've refactored the original explanation generation code to enhance its modularity, making it easier for future researchers to add new explanations.
-
Dependency Library Upgrade: The project includes an updated version of the dependency library BehaviorTree.CPP, which is tailored to support our enhancements.
-
Graphical User Interface (GUI): To facilitate the exploration of explanation interface designs for future Human-Robot Interaction (HRI) studies, we've integrated a GUI. This GUI provides a simple means to iterate on the presentation of explanations.
To use this codebase, please ensure that your system meets the following requirements:
- ROS Noetic
- Ubuntu 20.04
Our code has been tested on WSL2 Ubuntu 20.04 with ROS Noetic.
To install the necessary dependencies and set up your environment, follow these steps:
-
Verify that you are running Ubuntu 20.04 and have ROS Noetic installed. You can find installation instructions for ROS Noetic here.
-
Install catkin the ROS build system:
sudo apt install ros-noetic-catkin python3-catkin-tools
-
Create a ROS workspace. In your terminal, execute the following commands:
mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src
-
Clone the required repositories:
git clone -b v4.3 https://github.com/ian-chuang/BehaviorTree.CPP.git git clone https://github.com/ian-chuang/robot-explanation-BTs.git
-
Install ROS dependencies for the cloned packages:
cd ~/catkin_ws/src rosdep install -y --from-paths . --ignore-src --rosdistro noetic
-
Build the project using Catkin:
cd ~/catkin_ws catkin build
-
Source the setup script to configure your environment:
source ~/catkin_ws/devel/setup.bash
To run the example behavior tree, use the following command:
roslaunch explain_bt example_bt.launch
Once executed, the GUI will be displayed. Click the "Start" button at the top left of the GUI to begin the behavior tree execution. The GUI will provide real-time generated explanations while the behavior tree is running. If needed, you can restart the behavior tree by clicking "Reset" and "Start."
Feel free to explore and experiment with the behavior tree located at explain_bt/bt_xml/example_bt.xml
.