{"id":13732267,"url":"https://github.com/miccol/Behavior-Tree","last_synced_at":"2025-05-08T06:31:47.549Z","repository":{"id":31379321,"uuid":"34942367","full_name":"miccol/Behavior-Tree","owner":"miccol","description":"A lightweight library of Behavior Trees Library in C++. ","archived":false,"fork":false,"pushed_at":"2018-10-17T07:10:24.000Z","size":1318,"stargazers_count":182,"open_issues_count":0,"forks_count":46,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-05-02T20:13:56.632Z","etag":null,"topics":["behavior-tree","behavior-trees","cpp11"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miccol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-02T09:33:26.000Z","updated_at":"2024-05-01T06:58:38.000Z","dependencies_parsed_at":"2022-08-17T18:31:03.710Z","dependency_job_id":null,"html_url":"https://github.com/miccol/Behavior-Tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miccol%2FBehavior-Tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miccol%2FBehavior-Tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miccol%2FBehavior-Tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miccol%2FBehavior-Tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miccol","download_url":"https://codeload.github.com/miccol/Behavior-Tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213757427,"owners_count":15634177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behavior-tree","behavior-trees","cpp11"],"created_at":"2024-08-03T02:01:51.067Z","updated_at":"2024-08-03T02:09:21.088Z","avatar_url":"https://github.com/miccol.png","language":"C++","readme":"A lightweight behavior tree library in `C++`.\n\n\n\nNEWS!\n-----------\n:boom: Thanks to [Davide Faconti](https://github.com/facontidavide) there is now a more sophisticated version of the library. The new version of this library is available [here](https://github.com/BehaviorTree/BehaviorTree.CPP). There is also GUI available [here](https://github.com/BehaviorTree/Groot).\n\n\n\n\u003ca href=\"https://btirai.github.io\"\u003e\u003cimg width=\"200\" align=\"left\" url= \"https://btirai.github.io/\" src=\"http://michelecolledanchise.com/wp-content/uploads/2018/05/btbook.jpg\"\u003e\u003c/a\u003e\nOur book **Behavior Trees in Robotics and AI**, published by CRC Press Taylor \u0026 Francis, is available for purchase (ebook and hardcover) on the CRC Press Store or Amazon. The Preprint version (**free**) is available here: https://arxiv.org/abs/1709.00084\u003cbr\u003e\u003cbr\u003e\n**Tutorials** available at https://btirai.github.io/\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n-----------\n\n\u003cimg width=\"100\" alt=\"portfolio_view\" src=\"http://michelecolledanchise.com/BTPPLOGO.png\"\u003e BT++ \n====\n![License MIT](https://img.shields.io/dub/l/vibe-d.svg) ![Version](https://img.shields.io/badge/version-v1.4-green.svg) \u003cimg src=\"https://travis-ci.org/miccol/Behavior-Tree.svg?branch=master\"/\u003e\n \u003cbr/\u003e       \n\n\nREFERENCE\n------------\nPlease refer to the following paper when using the library:\n\n**How Behavior Trees Modularize Hybrid Control Systems and Generalize Sequential Behavior Compositions, the Subsumption Architecture, and Decision Trees.** Michele Colledanchise and Petter Ogren. IEEE Transaction on Robotics 2017.\n\nbibtex entry:\n\n`@ARTICLE{TRO17Colledanchise,` \u003cbr/\u003e\n`author={M. Colledanchise and P. Ögren},` \u003cbr/\u003e\n`journal={IEEE Transactions on Robotics},` \u003cbr/\u003e\n`title={{How Behavior Trees Modularize Hybrid Control Systems and Generalize Sequential Behavior Compositions, the Subsumption Architecture, and Decision Trees}},` \u003cbr/\u003e \n`year={2017},` \u003cbr/\u003e\n`volume={33},` \u003cbr/\u003e\n`number={2},` \u003cbr/\u003e\n`pages={372-389},` \u003cbr/\u003e\n`keywords={Computer architecture;Decision trees;High definition video;Robot control;Switches;Behavior trees (BTs);decision trees;finite state machines (FSMs);hybrid dynamical systems (HDSs);modularity;sequential behavior compositions;subsumption architecture}, ` \u003cbr/\u003e\n`doi={10.1109/TRO.2016.2633567},` \u003cbr/\u003e\n`ISSN={1552-3098},` \u003cbr/\u003e\n`month={April},}`\u003cbr/\u003e\n\nDEPENDENCIES\n------------\n\nRegarding visualization purposes:\n* [OpenGL](https://www.opengl.org/)\n* [Glut](https://www.opengl.org/resources/libraries/glut/)\n\nRegarding tests:\n* [GTests](https://github.com/google/googletest)\n\nBT NODES SUPPORT\n----------------\n**Fallback:** Fallback nodes are used to find and execute the first child that does not fail. A Selector node will return immediately with a status code of success or running when one of its children returns success or running. The children are ticked in order of importance, from `left` to `right`.\n\n**Sequence:** Sequence nodes are used to find and execute the first child that has not yet succeeded. A sequence node will return immediately with a status code of `failure` or `running` when one of its children returns failure or running. The children are ticked in order, from `left` to `right`.\n\n**Parallel:** The parallel node ticks its children in parallel and returns success if `M ≤ N` children return success, it returns failure if `N − M + 1` children return failure, and it returns running otherwise.\n\n**Decorator:** The decorator node manipulates the return status of its child according to the policy defined by the user (e.g. it inverts the success/failure status of the child). In this library the decorators implemented are the two common ones: *Decorator Retry* which retries the execution of a node if this fails; and *Decorator Negation* That inverts the Success/Failure outcome.\n\n**Action:** An Action node performs an action, and returns Success if the action is completed, Failure if it can not be completed and Running if completion is under way.\n\n**Condition:** A Condition node determines if a desired condition `c` has been met. Conditions are technically a subset of the Actions, but are given a separate category and graphical symbol to improve readability of the BT and emphasize the fact that they never return running and do not change any internal states/variables of the BT.\n\nA user manual is available in the project folder ([BTppUserManual.pdf](https://github.com/miccol/Behavior-Tree/blob/master/BTppUserManual.pdf)).\n\nSETUP\n-----------\n\nThe first step to use BT++ is to retrieve its source code. You can either download it \nhere (https://github.com/miccol/Behavior-Tree) or clone the repository:\n\n`$ cd /path/to/folder` \u003cbr/\u003e\n`$ git clone https://github.com/miccol/Behavior−Tree.git`\n\nOnce you have the repository, compile the library:\n\n`$ cd /path/to/folder/` \u003cbr/\u003e\n`$ mkdir ./build` \u003cbr/\u003e\n`$ cd build` \u003cbr/\u003e\n`$ cmake ..` \u003cbr/\u003e\n`$ make` \u003cbr/\u003e\n\n\n**NOTE**\nIn case you get the following error:\n\n`CMake Error: The following variables are used in this project, but they are set to NOTFOUND.\nPlease set them or make sure they are set and tested correctly in the CMake files:\nGLUT_Xmu_LIBRARY (ADVANCED)`\n\nplease see solution [here](https://ubuntuforums.org/archive/index.php/t-1703770.html). Thanks [miquelramirez](https://github.com/miquelramirez) for this.\n\n\nCheck the installation by running a sample example.\n\n`$ cd /path/to/folder/` \u003cbr/\u003e\n`$ cd build/sample` \u003cbr/\u003e\n`$ ./btpp_example` \u003cbr/\u003e\n\nINSTALL THE LIBRARY SYSTEM-WIDE (tested on Ubuntu 14.04 and 16.04)\n-------------------------------\n\nIf you would like to install the library system-wide, then run:\n\n`$ cd /path/to/folder/` \u003cbr/\u003e\n`$ cd build` \u003cbr/\u003e\n`$ sudo make install` \u003cbr/\u003e\n\nOn Ubuntu, this will install the library (libbtpp.so) in `/usr/local/lib`. \u003cbr/\u003e\nIn an external project, just call in your CMakeLists 'find_package(BTpp)' to find the library. \u003cbr/\u003e\nThe include directory is defined as `BTpp_INCLUDE_DIRS` and the libraries to link as `BTpp_LIBRARIES`.\u003cbr/\u003e\nThe repository [my-behavior-tree-project](https://github.com/miccol/my-behavior-tree-project) shows an example on how to use the library once system-wide installed.\n\n\nCREATE YOUR OWN ACTION NODE\n------\n1) Implement your action node class extending the abstract class `BT::ActionNode`.\n2) Implement the method `BT::ReturnStatus Tick()` with the code you want to execute while the action is running. Use the method `is_halted()` to check if the action has been prempted. When the execution of your action finished, return `BT::SUCCESS` or `BT::FAILURE` accordingly.  \n3) Implement the method `void Halt()` with the code you want to execute when the action gets preempted (halted).\nSee the file `src/example.cpp` for an example.\n\nCREATE YOUR OWN CONDITION NODE\n------\n1) Implement your condition node class extending the abstract class `BT::ConditionNode`.\n2) Implement the method `BT::ReturnStatus Tick()` with the code you want to execute to check the condition. Return `BT::SUCCESS` or `BT::FAILURE` accordingly.  \nSee the file `src/example.cpp` for an example.\n\n\nNOTES\n-------\nIn case you are puzzled about why a sequence (or fallback) node with 2 or more actions as children never get past the first action, see [this](https://github.com/miccol/ROS-Behavior-Tree/issues/16) discussion.\n\nLICENSE\n-------\nThe MIT License (MIT)\n\nCopyright (c) 2014-2018 Michele Colledanchise\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["GameProgramming"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiccol%2FBehavior-Tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiccol%2FBehavior-Tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiccol%2FBehavior-Tree/lists"}