Skip to main content

Behavior_Machine

Copyright - Transportation, Bots, and Disability Lab, Carnegie Mellon University
Released under MIT License

This is an implementation of a hierarchical state machine but with additional behavior-tree like features (Sequential, Parallal, etc). Unlike behavior trees, the execution of each state is independent of the tick (A repeative signal generated from the root). The transition of the state are determined by the machine's tick but can be set at different levels

Illustrative Example:

from behavior_machine.core import State, Machine
from behavior_machine.library import PrintState, SequentialState, IdleState


ps1 = PrintState("ps1", "Hello World 1")
ps2 = PrintState("ps2", "Hello World 2")
is1 = IdleState("is1")
ps3 = PrintState("ps3", "Hello World 3")

ss = SequentialState("ss", children=[ps1, ps2])
ss.add_transition_on_success(ps3)

m1 = Machine("m1", ss, rate=10)
m1.add_transition(lambda state, board: state._curr_state._name == "ps3", is1)
m2 = Machine("m2", m1, end_state_ids=['is1'], rate=10)
m2.run()

Example

Documentation

You can view more detailed documentation by following this link

Release files for behavior-machine 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for behavior-machine 0.4.0
File Size Uploaded
behavior_machine-0.4.0.tar.gz 20.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for behavior-machine 0.4.0
File Interpreter ABI Platform
behavior_machine-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.1 kB

Release files / behavior_machine-0.4.0.tar.gz

Download URL behavior_machine-0.4.0.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
20f35d10a688ce8df1fb9d2121ec70851fd91906026c101031cdab91c6f4588f
BLAKE2b-256 checksum
How to use checksums
e8b17dbdf476d5b7aa3d5a4317c7300bb03cb5e7c2840ad94b4eef19461b1ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / behavior_machine-0.4.0-py3-none-any.whl

Download URL behavior_machine-0.4.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
facc6b5e35c221a03236a830697d04edf0cf6613e26d881b15f4af4bead12365
BLAKE2b-256 checksum
How to use checksums
bea9e993b1228d94473c3e00885fe01aa4701a782d8fb5eb2a356603bbf5a331
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page