hierarchical-state-machine


Namehierarchical-state-machine JSON
Version 1.0.16 PyPI version JSON
download
home_pageNone
SummaryThis python library provides an easy-to-learn and easy-to-use API for using Hierarchical State Machines in your project. The state machine is defined using a basic JSON string, and includes convenience timers.
upload_time2024-05-31 23:23:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Dan Tebbs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords hierarchical state machine hsm state machine state-machine statemachine sm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">
Crystal Clear Design's Hierarchical State Machine for Python
</h1><br>

# hierarchical_state_machine
This python library provides an easy-to-learn and easy-to-use API for using Hierarchical State Machines in your project. The state machine is defined using a basic JSON string, and includes convenience timers.

- **Source code:** https://github.com/dantebbs/hierarchical_state_machine

## Simplest Example
The Blinky Light

## Countdown Example
Fireworks

## A More Involved Example
A Hierarchical State Machine Implementing a Simple Crosswalk Controller

1. Get the location of the examples:
    `python -m pip show hierarchical_state_machine`
2. Go to the example folder:
    `cd <site-packages>/hierarchical_state_machine/example/pedestrian_crosswalk/`
3. Look at the state machine diagram:
    `hierarchical_example_pedestrian_crosswalk_signaler.pdf`
4. Execute and follow along:
    `python crosswalk_light_simulator.py`
5. Press the `b` button to request a crossing.
6. Press the `Esc` button to exit the simulation.

## A Tutorial
Here are details about creating a hierarchical state machine in python.

### Components of a State Machine
--Events - Are user inputs, timeouts, code-generated, or an output of another state machine.
--States - A state machine waits in a state until an event or condition causes a transition to another state.
--Transitions - Are paths gated by events and/or conditions, to go to another state.
--Actions - Are behaviors (i.e. callbacks) evoked as a side-effect of a transition.

### Creating a State
Each state contains the following optional elements:
**entry** A list of callback functions that will be invoked each time the state is entered.
**exit** A list of callback functions that will be invoked each time the state is exited.
**tran** A list of transitions which will be followed when conditions are met.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hierarchical-state-machine",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "hierarchical, state, machine, hsm, State Machine, State-Machine, statemachine, sm",
    "author": null,
    "author_email": "Dan Tebbs <dantebbs@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/27/ab/d2d11aa5513211ea0e5d04df6e58264edbc65f37e0fe1e682afe0720fb4f/hierarchical_state_machine-1.0.16.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">\r\nCrystal Clear Design's Hierarchical State Machine for Python\r\n</h1><br>\r\n\r\n# hierarchical_state_machine\r\nThis python library provides an easy-to-learn and easy-to-use API for using Hierarchical State Machines in your project. The state machine is defined using a basic JSON string, and includes convenience timers.\r\n\r\n- **Source code:** https://github.com/dantebbs/hierarchical_state_machine\r\n\r\n## Simplest Example\r\nThe Blinky Light\r\n\r\n## Countdown Example\r\nFireworks\r\n\r\n## A More Involved Example\r\nA Hierarchical State Machine Implementing a Simple Crosswalk Controller\r\n\r\n1. Get the location of the examples:\r\n    `python -m pip show hierarchical_state_machine`\r\n2. Go to the example folder:\r\n    `cd <site-packages>/hierarchical_state_machine/example/pedestrian_crosswalk/`\r\n3. Look at the state machine diagram:\r\n    `hierarchical_example_pedestrian_crosswalk_signaler.pdf`\r\n4. Execute and follow along:\r\n    `python crosswalk_light_simulator.py`\r\n5. Press the `b` button to request a crossing.\r\n6. Press the `Esc` button to exit the simulation.\r\n\r\n## A Tutorial\r\nHere are details about creating a hierarchical state machine in python.\r\n\r\n### Components of a State Machine\r\n--Events - Are user inputs, timeouts, code-generated, or an output of another state machine.\r\n--States - A state machine waits in a state until an event or condition causes a transition to another state.\r\n--Transitions - Are paths gated by events and/or conditions, to go to another state.\r\n--Actions - Are behaviors (i.e. callbacks) evoked as a side-effect of a transition.\r\n\r\n### Creating a State\r\nEach state contains the following optional elements:\r\n**entry** A list of callback functions that will be invoked each time the state is entered.\r\n**exit** A list of callback functions that will be invoked each time the state is exited.\r\n**tran** A list of transitions which will be followed when conditions are met.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Dan Tebbs  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "This python library provides an easy-to-learn and easy-to-use API for using Hierarchical State Machines in your project. The state machine is defined using a basic JSON string, and includes convenience timers.",
    "version": "1.0.16",
    "project_urls": {
        "Repository": "https://github.com/dantebbs/hierarchical_state_machine"
    },
    "split_keywords": [
        "hierarchical",
        " state",
        " machine",
        " hsm",
        " state machine",
        " state-machine",
        " statemachine",
        " sm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb07c423886bec152eb2f2a4c14f46ab3a8aa05100c1c0276a3681fddb4f9633",
                "md5": "65a87d17046e5941b17171b32aed3c41",
                "sha256": "c9afff9eafc8730d2b2bec6ff6a28f0f972ad7ba3fb5e3c2223e10fc8115e521"
            },
            "downloads": -1,
            "filename": "hierarchical_state_machine-1.0.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65a87d17046e5941b17171b32aed3c41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 75169,
            "upload_time": "2024-05-31T23:23:11",
            "upload_time_iso_8601": "2024-05-31T23:23:11.753143Z",
            "url": "https://files.pythonhosted.org/packages/cb/07/c423886bec152eb2f2a4c14f46ab3a8aa05100c1c0276a3681fddb4f9633/hierarchical_state_machine-1.0.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27abd2d11aa5513211ea0e5d04df6e58264edbc65f37e0fe1e682afe0720fb4f",
                "md5": "ac20ac38c6ee33a38c20de0088cd646e",
                "sha256": "fc3fa0f4c32bf4de3ba9a1df9c8102d92e1192409efdc91f375584b75050dd8b"
            },
            "downloads": -1,
            "filename": "hierarchical_state_machine-1.0.16.tar.gz",
            "has_sig": false,
            "md5_digest": "ac20ac38c6ee33a38c20de0088cd646e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 76689,
            "upload_time": "2024-05-31T23:23:13",
            "upload_time_iso_8601": "2024-05-31T23:23:13.531722Z",
            "url": "https://files.pythonhosted.org/packages/27/ab/d2d11aa5513211ea0e5d04df6e58264edbc65f37e0fe1e682afe0720fb4f/hierarchical_state_machine-1.0.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-31 23:23:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dantebbs",
    "github_project": "hierarchical_state_machine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "hierarchical-state-machine"
}
        
Elapsed time: 0.29784s