0 purchases
risdk 1.1.1
RI SDK wrapper (autogenerated)
Parse RI SDK docs (https://docs.robointellect.ru/) and autogen Python wrapper.
TODO:
coverage for ri_sdk_codegen
Install
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.
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.