Skip to main content

RI SDK Pythonic Wrapper

Project description

RI SDK wrapper (autogenerated)

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

PyPI - Version PyPI - Status PyPI - Python Version Ruff Code style: black mypy codecov

TODO:

  • coverage for ri_sdk_codegen

Install

pip install ri-sdk

Run

Other examples

Minimal example

Full example at examples/robohand-example.py.

Another example with RoboHand class at examples/robohand-class-example.py.

"""
Смотри полный пример в папке 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

poetry install

Full RI SDK codegen:

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

hatch run test:run

Run coverage

hatch run test:cov

Run coverage and export html report

hatch run test:cov-html

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ri_sdk-1.1.1.tar.gz (38.3 kB view details)

Uploaded Source

Built Distribution

ri_sdk-1.1.1-py3-none-any.whl (67.2 kB view details)

Uploaded Python 3

File details

Details for the file ri_sdk-1.1.1.tar.gz.

File metadata

  • Download URL: ri_sdk-1.1.1.tar.gz
  • Upload date:
  • Size: 38.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ri_sdk-1.1.1.tar.gz
Algorithm Hash digest
SHA256 359a9fda74bf92c85d839823aa4c58578662de1e343434442697e9ef3eaaf21e
MD5 cc2dc19dbf8efae4f48e41d29b122fd3
BLAKE2b-256 db3ef53a62465e4ece2d4971bc0d5e93111d69ba908817e996877495e1af85fc

See more details on using hashes here.

File details

Details for the file ri_sdk-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: ri_sdk-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 67.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ri_sdk-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6a9468a9761e0351ca65e380391128ba87b44d16b381bc01a2ea358409a6a72
MD5 1db61c0feef72a48ce4c2654d9b13810
BLAKE2b-256 bc9c35a0de92901a4f34f4aa17430f4b62d76697d7aeea4ef68dd831eaafed97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page