ri-sdk


Nameri-sdk JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryRI SDK Pythonic Wrapper
upload_time2024-07-19 20:05:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords ri sdk robohand robointellect
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RI SDK wrapper (autogenerated)

Parse RI SDK docs (https://docs.robointellect.ru/) and autogen Python wrapper.


[![PyPI - Version](https://img.shields.io/pypi/v/ri-sdk?style=for-the-badge&logo=pypi)](https://pypi.org/project/ri-sdk/)
[![PyPI - Status](https://img.shields.io/pypi/status/ri-sdk?style=for-the-badge)](https://pypi.org/project/ri-sdk/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ri-sdk?style=for-the-badge&logo=python)](https://pypi.org/project/ri-sdk/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://docs.astral.sh/ruff/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000?style=for-the-badge)](https://black.readthedocs.io/)
[![mypy](https://img.shields.io/badge/mypy-checked-1F5082?style=for-the-badge)](https://mypy.readthedocs.io/)
[![codecov](https://img.shields.io/codecov/c/github/mahenzon/ri-sdk-python-wrapper?token=K736Q6JF26&style=for-the-badge&logo=codecov)](https://codecov.io/gh/mahenzon/ri-sdk-python-wrapper)

### TODO:

- coverage for ri_sdk_codegen

### Install

```shell
pip install ri-sdk
```

### Run


#### Other examples
- GUI Control (PyQt / PySide) example: https://github.com/mahenzon/robohand-gui-control


#### Minimal example

Full example at [examples/robohand-example.py](https://github.com/mahenzon/ri-sdk-python-wrapper/blob/master/examples/robohand-example.py).

Another example with RoboHand class at [examples/robohand-class-example.py](https://github.com/mahenzon/ri-sdk-python-wrapper/blob/master/examples/robohand-class-example.py).

```python
"""
Смотри полный пример в папке examples
"""
from ri_sdk import RoboIntellectSDK, contrib

lib = contrib.get_lib()
ri_sdk = RoboIntellectSDK(
    lib=lib,
    setup_methods_args=True,
)
ri_sdk.init_sdk(log_level=1)
# pwm_descriptor = init_pwm(ri_sdk)
pwm_descriptor = 0
# i2c_descriptor = init_i2c(ri_sdk, pwm_descriptor)
i2c_descriptor = 0
# led_descriptor = init_led(ri_sdk, pwm_descriptor)
led_descriptor = 0

# Устанавливаем фиолетовый цвет светодиода
ri_sdk.exec_rgb_led_single_pulse(
    descriptor=led_descriptor,
    r=255,
    g=0,
    b=255,
    duration=0,
    run_async=True,
)

# инициализируем сервоприводы
# init_servos(ri_sdk, pwm_descriptor)

# переводим сервоприводы в стартовое положение
# servos_to_start_position(ri_sdk)

servo_rotate_descriptor = 0
# поворачиваем башню на угол 60 со скоростью 30
ri_sdk.exec_servo_drive_turn_with_relative_speed(
    descriptor=servo_rotate_descriptor,
    # угол 60º
    angle=60,
    # скорость в градусах в секунду
    speed=30,
)

# готовимся к завершению, включаем красный свет
ri_sdk.exec_rgb_led_single_pulse(
    descriptor=led_descriptor,
    r=255,
    g=0,
    b=0,
    duration=0,
    run_async=True,
)

# Красиво завершаем работу через destruct
# destruct(
#     ri_sdk=ri_sdk,
#     led_descriptor=led_descriptor,
#     pwm_descriptor=pwm_descriptor,
#     i2c_descriptor=i2c_descriptor,
# )
ri_sdk.destroy_sdk(is_force=True)
```

### Notes

#### Features to implement

- TODO: handy angle control (like in adafruit-servokit)
- TODO: code tests coverage


## Codegen

#### Install dependencies

```shell
poetry install
```

#### Full RI SDK codegen:

```shell
main.py --update-links --parse-docs --remove-unknown-methods-cache --generate-sdk
```

Each stage can be used separately:

- `--update-links`
- `--parse-docs [--remove-unknown-methods-cache]`
- `--generate-sdk`

Add `-v` flag for verbose output.


## Testing

Run tests

```shell
hatch run test:run
```

Run coverage

```shell
hatch run test:cov
```

Run coverage and export html report

```shell
hatch run test:cov-html
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ri-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Suren Khorenyan <surenkhorenyan@gmail.com>",
    "keywords": "RI SDK, RoboHand, RoboIntellect",
    "author": null,
    "author_email": "Suren Khorenyan <surenkhorenyan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/db/3e/f53a62465e4ece2d4971bc0d5e93111d69ba908817e996877495e1af85fc/ri_sdk-1.1.1.tar.gz",
    "platform": null,
    "description": "# RI SDK wrapper (autogenerated)\n\nParse RI SDK docs (https://docs.robointellect.ru/) and autogen Python wrapper.\n\n\n[![PyPI - Version](https://img.shields.io/pypi/v/ri-sdk?style=for-the-badge&logo=pypi)](https://pypi.org/project/ri-sdk/)\n[![PyPI - Status](https://img.shields.io/pypi/status/ri-sdk?style=for-the-badge)](https://pypi.org/project/ri-sdk/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ri-sdk?style=for-the-badge&logo=python)](https://pypi.org/project/ri-sdk/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://docs.astral.sh/ruff/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000?style=for-the-badge)](https://black.readthedocs.io/)\n[![mypy](https://img.shields.io/badge/mypy-checked-1F5082?style=for-the-badge)](https://mypy.readthedocs.io/)\n[![codecov](https://img.shields.io/codecov/c/github/mahenzon/ri-sdk-python-wrapper?token=K736Q6JF26&style=for-the-badge&logo=codecov)](https://codecov.io/gh/mahenzon/ri-sdk-python-wrapper)\n\n### TODO:\n\n- coverage for ri_sdk_codegen\n\n### Install\n\n```shell\npip install ri-sdk\n```\n\n### Run\n\n\n#### Other examples\n- GUI Control (PyQt / PySide) example: https://github.com/mahenzon/robohand-gui-control\n\n\n#### Minimal example\n\nFull example at [examples/robohand-example.py](https://github.com/mahenzon/ri-sdk-python-wrapper/blob/master/examples/robohand-example.py).\n\nAnother example with RoboHand class at [examples/robohand-class-example.py](https://github.com/mahenzon/ri-sdk-python-wrapper/blob/master/examples/robohand-class-example.py).\n\n```python\n\"\"\"\n\u0421\u043c\u043e\u0442\u0440\u0438 \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043f\u0430\u043f\u043a\u0435 examples\n\"\"\"\nfrom ri_sdk import RoboIntellectSDK, contrib\n\nlib = contrib.get_lib()\nri_sdk = RoboIntellectSDK(\n    lib=lib,\n    setup_methods_args=True,\n)\nri_sdk.init_sdk(log_level=1)\n# pwm_descriptor = init_pwm(ri_sdk)\npwm_descriptor = 0\n# i2c_descriptor = init_i2c(ri_sdk, pwm_descriptor)\ni2c_descriptor = 0\n# led_descriptor = init_led(ri_sdk, pwm_descriptor)\nled_descriptor = 0\n\n# \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439 \u0446\u0432\u0435\u0442 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\nri_sdk.exec_rgb_led_single_pulse(\n    descriptor=led_descriptor,\n    r=255,\n    g=0,\n    b=255,\n    duration=0,\n    run_async=True,\n)\n\n# \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0432\u043e\u0434\u044b\n# init_servos(ri_sdk, pwm_descriptor)\n\n# \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u0432\u043e\u0434\u044b \u0432 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\n# servos_to_start_position(ri_sdk)\n\nservo_rotate_descriptor = 0\n# \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0431\u0430\u0448\u043d\u044e \u043d\u0430 \u0443\u0433\u043e\u043b 60 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e 30\nri_sdk.exec_servo_drive_turn_with_relative_speed(\n    descriptor=servo_rotate_descriptor,\n    # \u0443\u0433\u043e\u043b 60\u00ba\n    angle=60,\n    # \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\n    speed=30,\n)\n\n# \u0433\u043e\u0442\u043e\u0432\u0438\u043c\u0441\u044f \u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\nri_sdk.exec_rgb_led_single_pulse(\n    descriptor=led_descriptor,\n    r=255,\n    g=0,\n    b=0,\n    duration=0,\n    run_async=True,\n)\n\n# \u041a\u0440\u0430\u0441\u0438\u0432\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 destruct\n# destruct(\n#     ri_sdk=ri_sdk,\n#     led_descriptor=led_descriptor,\n#     pwm_descriptor=pwm_descriptor,\n#     i2c_descriptor=i2c_descriptor,\n# )\nri_sdk.destroy_sdk(is_force=True)\n```\n\n### Notes\n\n#### Features to implement\n\n- TODO: handy angle control (like in adafruit-servokit)\n- TODO: code tests coverage\n\n\n## Codegen\n\n#### Install dependencies\n\n```shell\npoetry install\n```\n\n#### Full RI SDK codegen:\n\n```shell\nmain.py --update-links --parse-docs --remove-unknown-methods-cache --generate-sdk\n```\n\nEach stage can be used separately:\n\n- `--update-links`\n- `--parse-docs [--remove-unknown-methods-cache]`\n- `--generate-sdk`\n\nAdd `-v` flag for verbose output.\n\n\n## Testing\n\nRun tests\n\n```shell\nhatch run test:run\n```\n\nRun coverage\n\n```shell\nhatch run test:cov\n```\n\nRun coverage and export html report\n\n```shell\nhatch run test:cov-html\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "RI SDK Pythonic Wrapper",
    "version": "1.1.1",
    "project_urls": {
        "Documentation": "https://github.com/mahenzon/ri-sdk-python-wrapper",
        "Homepage": "https://github.com/mahenzon/ri-sdk-python-wrapper",
        "Source code": "https://github.com/mahenzon/ri-sdk-python-wrapper"
    },
    "split_keywords": [
        "ri sdk",
        " robohand",
        " robointellect"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc9c35a0de92901a4f34f4aa17430f4b62d76697d7aeea4ef68dd831eaafed97",
                "md5": "1db61c0feef72a48ce4c2654d9b13810",
                "sha256": "b6a9468a9761e0351ca65e380391128ba87b44d16b381bc01a2ea358409a6a72"
            },
            "downloads": -1,
            "filename": "ri_sdk-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1db61c0feef72a48ce4c2654d9b13810",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 67192,
            "upload_time": "2024-07-19T20:05:48",
            "upload_time_iso_8601": "2024-07-19T20:05:48.360731Z",
            "url": "https://files.pythonhosted.org/packages/bc/9c/35a0de92901a4f34f4aa17430f4b62d76697d7aeea4ef68dd831eaafed97/ri_sdk-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db3ef53a62465e4ece2d4971bc0d5e93111d69ba908817e996877495e1af85fc",
                "md5": "cc2dc19dbf8efae4f48e41d29b122fd3",
                "sha256": "359a9fda74bf92c85d839823aa4c58578662de1e343434442697e9ef3eaaf21e"
            },
            "downloads": -1,
            "filename": "ri_sdk-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cc2dc19dbf8efae4f48e41d29b122fd3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 38265,
            "upload_time": "2024-07-19T20:05:49",
            "upload_time_iso_8601": "2024-07-19T20:05:49.883075Z",
            "url": "https://files.pythonhosted.org/packages/db/3e/f53a62465e4ece2d4971bc0d5e93111d69ba908817e996877495e1af85fc/ri_sdk-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 20:05:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mahenzon",
    "github_project": "ri-sdk-python-wrapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ri-sdk"
}
        
Elapsed time: 0.38808s