erlang_behaviour_trees
An OTP application
Build
$ rebar3 compile
Running a BT
- Run shell
rebar3 shell - Start dummy butler navigator and rack location service:
dummy_butler_server_sup:start_link(1, "002.002", <<"1">>, "007.008").- Initializes locations for butler 1 and rack <<"1">>
- Use
butler_functions:get_butler_status(1)andbutler_functions:get_rack_location(<<"1">>)to get their locations - Use their teleport functions to place them (see code). Can get pids through gproc.
- Create BT:
{ok, Pid} = bt_engine:start_link("src/samples/trees/rackloop.yml", "rackloop_with_count", [{"BId", 1},{"Count", 2}]).- requires yml file name, root node name, proplist of params.
- Tick BT:
bt_engine:tick(Pid, some_event)- Will have to tick it manually till success is achieved. It will return
runningwhile running and thensuccess. Only if something irrecoverable happens it will (should) return failure.
- Will have to tick it manually till success is achieved. It will return
Visualize: