{"id":19012739,"url":"https://github.com/njdevpro/behaviour-tree","last_synced_at":"2025-08-19T08:10:54.828Z","repository":{"id":63379333,"uuid":"98227769","full_name":"NJdevPro/Behaviour-Tree","owner":"NJdevPro","description":"A C++11 implementation of the Behaviour Tree data structure/design pattern","archived":false,"fork":false,"pushed_at":"2022-11-17T20:58:07.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T22:11:45.961Z","etag":null,"topics":["behavior-trees","behaviour-trees","robotics-control","state-machines"],"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/NJdevPro.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":"2017-07-24T19:36:21.000Z","updated_at":"2024-12-20T20:06:13.000Z","dependencies_parsed_at":"2022-11-17T22:30:37.108Z","dependency_job_id":null,"html_url":"https://github.com/NJdevPro/Behaviour-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/NJdevPro%2FBehaviour-Tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJdevPro%2FBehaviour-Tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJdevPro%2FBehaviour-Tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NJdevPro%2FBehaviour-Tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NJdevPro","download_url":"https://codeload.github.com/NJdevPro/Behaviour-Tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240044750,"owners_count":19739183,"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-trees","behaviour-trees","robotics-control","state-machines"],"created_at":"2024-11-08T19:19:25.344Z","updated_at":"2025-02-21T15:51:39.971Z","avatar_url":"https://github.com/NJdevPro.png","language":"C++","readme":"A C++11 implementation of the Behaviour Tree data structure/design pattern\n.\nThe behaviour tree design pattern fills the same niche as state machines,\nbut it has several advantages over them:\n- it is easier to maintain and understand\n- it can be multithreaded\n\nThe Behaviour tree (BT) is a decision tree where branching decisions are  \nbased on user defined environment variables.\nA BT is comparable in some ways to an abstract syntax tree. \nBecause it features nodes that allow branching, loops, delays and actions, it is \nTuring complete.\nThis particular implementation allows to run subtrees in a separate thread in a\nfashion similar to futures.\n\nThe main disadvantage of BT compared to state machines is they can be \nless responsive than state machines because the tree needs to be \nconstantly traversed.\n\nThis implementation is a single .h file making it very easy to integrate.\n\nEach node has a NOTRUN status, and a run() method that returns to their parent node a final status. The final status can be either SUCCESS, FAILURE, or ERROR. Additionally, asynchronous nodes can have an intermediate RUNNING status indicating their parent nodes that they cannot return a final state as yet.\n\n## Detailed descrition\n\n### Branching type nodes\n\n*Composite*: This type of Node follows the Composite Pattern, containing a list of 1...n children Nodes.\n\n*Sequence*: Composite node. If one child fails, then the entire sequence fails and quits immediately.  \nThe Status is SUCCESS only if all children succeed. Equivalent of a logical AND.\n\n*Select*: Composite Node. If one child succeeds, the Select succeeds and quits immediately.\nThe status is FAILURE only if all children fail. Equivalent of a logical OR.\n\n*DecoratorNode*: A DecoratorNode adds a functionality to its child node. Function is either to transform the Status it receives from the child, to terminate the child, or repeat the processing of the child.\n\n*Root*: A Decorator at the root of the Behaviour Tree.\n\n*Invert*: A Decorator that negates the Status of the child. \n\n*Succeed*: A Decorator that will always return Status SUCCESS, irrespective of what the child node actually returned. These are useful in cases where you want to process a branch of a tree where a Status::FAILURE is expected or anticipated, but you don’t want to abandon the processing of a sequence that branch sits on.\n\n*Fail*: A Decorator that is the opposite of a Succeed node, always returning fail.\n\n*Repeat*: This Decorator will reprocess its child node each time its child returns a Status. These are often used at the root of the tree, to make the tree run continuously. Repeaters may optionally run their children a defined number of times before returning to their parent.\n\n*RepeatUntil*: This Decorator will continue to reprocess its child until the child finally returns the expected status, at which point the repeater will return the status to its parent. The expected status must be either SUCCESS or FAILURE.\n\n*Async*: This Decorator executes its child asynchronously in a separate thread, regularly yielding RUNNNING until it gets a final Status.\n\n*Sleep*: A Decorator that inserts a delay in msec (1 msec by default) and return Status SUCCESS.\n\n### Memory type nodes\n\nThese nodes persist data between node runs.\nThere are two sorts of memory: a thread safe stack and variables.\n\n*SetVar*: associate a memory object to a variable\n\n*IsNull*: return SUCCESS if the object passed in argument is nullptr.\n\n*StackNode*: this node implements a stack.\n\n*Push*: push an object on the stack node\n\n*Pop*: pop an object from the stack node\n\n\n\nPublished under MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjdevpro%2Fbehaviour-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnjdevpro%2Fbehaviour-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjdevpro%2Fbehaviour-tree/lists"}