Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.95 KB

README.org

File metadata and controls

68 lines (52 loc) · 1.95 KB

Arduino Behavior Tree

Example platformio project for the arduino due. Uses the beehive header only behavior trees library, and Groot for visual editing of trees.

Steps to run the project

  1. Clone this repo and init submodules
    git clone https://github.com/carlos-cardoso/arduino_behavior_tree.git
    git submodule update --init --recursive
        
  2. Install platformio
    pip install -U platformio
        
  3. Install and use Groot to edit behavior trees.
  4. Run the script to parse the tree xml created by Groot
    python3 pygroot.py simple_tree.xml
        
  5. Compile and upload to arduino
    pio run -t upload
        

How to create your own project

The structure of the project is:

├── lib
│   └── behavior_tree
│       ├── context.cpp
│       └── Data.h
├── platformio.ini
├── pygroot.py
├── README.org
├── simple_tree.xml
└── src
    └── main.cpp
  • context.cpp contains your implementations for the tree action and condition nodes
  • Data.h contains the data structure for the tree state
  • simple_tree.xml is the behavior tree created by Groot
  • main.cpp initializes and runs the behavior tree
  1. Edit the tree in Groot:

    ./images/tree.png

    This example tree will write to the led pin after 5 seconds have passed.

  2. Run the script, this will create a file TREE.h and context.cpp in lib/behavior_tree
    python3 pygroot.py simple_tree.xml
        
  3. If you created new nodes in Groot, you need to implement them in context.cpp
  4. If you need more state, implement it in Data.h
  5. Run your new tree
    pio run -t upload