Python SDK - Revo 1 灵巧手
系统要求
- Linux: Ubuntu 20.04/22.04 LTS
- macOS: 10.15+
- Windows: 10/11
- Python: 3.9 ~ 3.12 (推荐 Conda)
快速开始
克隆仓库
shell
# 使用 HTTPS 方式
git clone https://github.com/BrainCoTech/brainco-hand-sdk.git
# 或使用 SSH 方式
git clone git@github.com:BrainCoTech/brainco-hand-sdk.git安装与配置
shell
# 进入 Python 目录
cd brainco-hand-sdk/python
# 激活 Conda 环境(推荐)
conda activate py310
# 安装 SDK 依赖
pip install -r requirements.txt --index-url https://pypi.org/simple/
# 如果无法通过 PyPI 安装,可手动下载 .whl 文件安装
# 下载地址: https://pypi.org/project/bc-stark-sdk/#files
pip install --force-reinstall '/path/to/bc_stark_sdk-x.x.x-cp39-abi3-manylinux_2_31_x86_64.whl'
# 配置串口设备权限
# Linux 系统中,串口设备(如 /dev/ttyUSB0)通常归属于 dialout 用户组
# 将当前用户添加到 dialout 组
sudo usermod -aG dialout $USER
# 注意:添加后需要重新登录才能生效
# 运行示例
cd revo1
python revo1_ctrl.py # 单手控制
python revo1_touch.py # 触觉传感器(触觉版)
python revo1_ctrl_multi.py # 多手控制
python revo1_action_seq.py # 动作序列
python revo1_cfg.py # 设备配置
python revo1_dfu.py # 固件升级shell
# 安装步骤同 Ubuntu
# 注意:macOS 串口设备名称通常为 /dev/tty.usbserial-xxxshell
# 如果 USB 驱动无法识别,请在设备管理器中查看串口名称
# 串口驱动下载: https://app.brainco.cn/universal/stark-serialport-prebuild/driver/CH340-drivers.zip
# 其他安装步骤同 Ubuntu
# 注意:Windows 串口设备名称通常为 COM3, COM4 等示例代码
SDK 提供了丰富的示例代码,涵盖不同通信协议和应用场景。
跨平台示例(推荐)⭐
统一的跨平台示例,支持自动检测设备和多种通信协议。
| 示例 | 说明 |
|---|---|
| hand_demo.py | 综合演示 |
| hand_monitor.py | 实时数据监控 |
| hand_dfu.py | 固件升级 |
Modbus-RTU 协议
单手/双手控制
触觉传感器
动作序列(手势)
API 参考
API 查阅与代码自动补全建议以 SDK 2.x 生成的完整类型存根为准。
展开查看 Python 类型存根 (main_mod.pyi)
python
# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401, F403, F405
import builtins
import enum
import typing
import typing_extensions
__all__ = [
"ActionCmd",
"ActionSequence",
"ActionSequenceId",
"ActionSequenceItem",
"ActionStatus",
"ArrayPressureStatus",
"ArrayPressureTouchData",
"ArrayPressureTouchDataBuffer",
"Baudrate",
"BaudrateCAN",
"ButtonPressEvent",
"CanChannel",
"CanCmd",
"CanFrameMultiRead",
"CanParamAddress",
"ContactState",
"DataCollector",
"DetectedDevice",
"DeviceContext",
"DeviceInfo",
"DfuCommandType",
"DfuExitReason",
"DfuState",
"EcModulusSdoSubIdx",
"EcTashanSdoSubIdx",
"EtherCATAddress",
"EtherCATConfigIndex",
"EtherCATCtrlAddress",
"EtherCATCtrlSubAddressMulti",
"EtherCATCtrlSubAddressSingle",
"EtherCATFoeType",
"FingerCtrlMode",
"FingerId",
"FingerUnitMode",
"Force3DFingerData",
"Force3DPoint",
"Force3DTouchData",
"Force3DTouchDataBuffer",
"ForceLevel",
"HandType",
"LedColor",
"LedInfo",
"LedMode",
"LogLevel",
"ModulusTouchDataType",
"MotorSettings",
"MotorState",
"MotorStatusBuffer",
"MotorStatusData",
"MsgType",
"PressState",
"PressureDetailedBuffer",
"PressureDetailedItem",
"PressureSummaryBuffer",
"RegAddrArrayPressure",
"RegAddrForce3D",
"RegAddrRevo1",
"RegAddrRevo2",
"SerialPortCfg",
"SkuType",
"StarkError",
"StarkHardwareType",
"StarkModuleId",
"StarkProtocolType",
"TouchDataType",
"TouchFingerData",
"TouchFingerItem",
"TouchRawData",
"TouchSensorData",
"TouchSensorItem",
"TouchSensorStatus",
"TouchStatusBuffer",
"TouchVendor",
"TurboConfig",
"ZqwlDeviceInfo",
"auto_detect",
"auto_detect_device",
"auto_detect_modbus_revo1",
"auto_detect_modbus_revo2",
"available_usb_ports",
"close_device_handler",
"close_socketcan",
"close_zqwl",
"get_sdk_version",
"init_device_handler",
"init_from_detected",
"init_logging",
"init_socketcan_can",
"init_socketcan_canfd",
"init_zqwl_can",
"init_zqwl_canfd",
"is_socketcan_available",
"list_available_ports",
"list_zqwl_devices",
"modbus_close",
"modbus_open",
"protobuf_open",
"scan_can_devices",
"scan_canfd_devices",
"set_can_rx_callback",
"set_can_tx_callback",
"set_modbus_read_holding_callback",
"set_modbus_read_input_callback",
"set_modbus_write_callback",
]
@typing.final
class ActionSequence:
r"""
Represents a full action sequence containing multiple items.
"""
def __new__(cls, action_id: ActionSequenceId, data: typing.Sequence[ActionSequenceItem]) -> ActionSequence:
r"""
Create a new ActionSequence.
Returns:
ActionSequence: A new ActionSequence instance containing the given data items.
"""
@property
def action_id(self) -> ActionSequenceId: ...
@property
def data(self) -> builtins.list[ActionSequenceItem]: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
def new(self, action_id: ActionSequenceId, data: typing.Sequence[ActionSequenceItem]) -> ActionSequence: ...
@typing.final
class ActionSequenceItem:
r"""
Represents an item in an action sequence.
"""
def __new__(cls, index: builtins.int, duration: builtins.int, mode: builtins.int, positions: typing.Sequence[builtins.int], durations: typing.Sequence[builtins.int], speeds: typing.Sequence[builtins.int], currents: typing.Sequence[builtins.int]) -> ActionSequenceItem:
r"""
Create a new ActionSequenceItem.
Returns:
ActionSequenceItem: A new ActionSequenceItem instance.
"""
@property
def currents(self) -> builtins.list[builtins.int]: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def duration(self) -> builtins.int: ...
@property
def durations(self) -> builtins.list[builtins.int]: ...
@property
def index(self) -> builtins.int: ...
@property
def mode(self) -> builtins.int: ...
def new(self, index: builtins.int, duration: builtins.int, mode: builtins.int, positions: typing.Sequence[builtins.int], durations: typing.Sequence[builtins.int], speeds: typing.Sequence[builtins.int], currents: typing.Sequence[builtins.int]) -> ActionSequenceItem: ...
@property
def positions(self) -> builtins.list[builtins.int]: ...
@property
def speeds(self) -> builtins.list[builtins.int]: ...
@typing.final
class ArrayPressureStatus:
r"""
ArrayPressure touch sensor status
"""
...
@typing.final
class ArrayPressureTouchData:
r"""
ArrayPressure touch data
"""
...
@typing.final
class ArrayPressureTouchDataBuffer:
r"""
ArrayPressure touch data shared buffer.
"""
def __new__(cls, max_size: builtins.int) -> ArrayPressureTouchDataBuffer: ...
def clear(self) -> None: ...
def is_empty(self) -> builtins.bool: ...
def len(self) -> builtins.int: ...
def peek_latest(self) -> typing.Optional[ArrayPressureTouchData]: ...
def pop_all(self) -> builtins.list[ArrayPressureTouchData]: ...
@typing.final
class ButtonPressEvent:
def __new__(cls, timestamp: builtins.int, button_id: builtins.int, press_state: PressState) -> ButtonPressEvent: ...
@property
def button_id(self) -> builtins.int: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
def new(self, timestamp: builtins.int, button_id: builtins.int, press_state: PressState) -> ButtonPressEvent: ...
@property
def press_state(self) -> PressState: ...
@property
def timestamp(self) -> builtins.int: ...
@typing.final
class DataCollector:
r"""
Python data collector wrapper
"""
def get_motor_frequency(self) -> builtins.int:
r"""
Get current motor frequency
Returns:
int: Current motor frequency in Hz
"""
def get_touch_frequency(self) -> builtins.int:
r"""
Get current touch frequency
Returns:
int: Current touch frequency in Hz
"""
def is_running(self) -> builtins.bool:
r"""
Check if data collection is running
"""
@staticmethod
def new_array_pressure(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, touch_buffer: ArrayPressureTouchDataBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, touch_frequency: builtins.int = 10, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - ArrayPressure touch version (华立创: 5 fingers × Fx/Fy/Fz/Mx/My)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
touch_buffer: ArrayPressureTouchDataBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
touch_frequency: Touch collection frequency in Hz (default 10)
enable_stats: Whether to print statistics (default True)
Examples:
collector = DataCollector.new_array_pressure(ctx, motor_buffer, touch_buffer)
"""
@staticmethod
def new_basic(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Basic version (motor data only)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
enable_stats: Whether to print statistics (default True)
Examples:
# Basic version (no touch sensor)
collector = PyDataCollector.new_basic(ctx, motor_buffer)
"""
@staticmethod
def new_capacitive(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, touch_buffer: TouchStatusBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, touch_frequency: builtins.int = 100, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Capacitive touch version
Touch sensor type is automatically detected from device info
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
touch_buffer: TouchStatusBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
touch_frequency: Touch collection frequency in Hz (default 100)
enable_stats: Whether to print statistics (default True)
Examples:
# Capacitive touch version
collector = PyDataCollector.new_capacitive(ctx, motor_buffer, touch_buffer)
"""
@staticmethod
def new_force3d(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, touch_buffer: Force3DTouchDataBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, touch_frequency: builtins.int = 10, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Force3D touch version (帕西尼: 4 fingers × FxFyFz)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
touch_buffer: Force3DTouchDataBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
touch_frequency: Touch collection frequency in Hz (default 10)
enable_stats: Whether to print statistics (default True)
Examples:
collector = DataCollector.new_force3d(ctx, motor_buffer, touch_buffer)
"""
@staticmethod
def new_pressure_detailed(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, pressure_detailed_buffer: PressureDetailedBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, touch_frequency: builtins.int = 10, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Pressure touch version (Detailed mode)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
pressure_detailed_buffer: PressureDetailedBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
touch_frequency: Touch collection frequency in Hz (default 10)
enable_stats: Whether to print statistics (default True)
Examples:
# Pressure touch Detailed mode
collector = PyDataCollector.new_pressure_detailed(ctx, motor_buffer, pressure_detailed_buffer, touch_frequency=10)
"""
@staticmethod
def new_pressure_hybrid(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, pressure_summary_buffer: PressureSummaryBuffer, pressure_detailed_buffer: PressureDetailedBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, summary_frequency: builtins.int = 100, detailed_frequency: builtins.int = 10, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Pressure touch version (Hybrid mode: Summary + Detailed)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
pressure_summary_buffer: PressureSummaryBuffer
pressure_detailed_buffer: PressureDetailedBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
summary_frequency: Summary collection frequency in Hz (default 100)
detailed_frequency: Detailed collection frequency in Hz (default 10)
enable_stats: Whether to print statistics (default True)
Examples:
# Pressure touch Hybrid mode: Summary 100Hz + Detailed 10Hz
collector = PyDataCollector.new_pressure_hybrid(
ctx, motor_buffer, pressure_summary_buffer, pressure_detailed_buffer,
summary_frequency=100, detailed_frequency=10
)
"""
@staticmethod
def new_pressure_summary(ctx: DeviceContext, motor_buffer: MotorStatusBuffer, pressure_summary_buffer: PressureSummaryBuffer, slave_id: builtins.int = 1, motor_frequency: builtins.int = 1000, touch_frequency: builtins.int = 100, enable_stats: builtins.bool = True) -> DataCollector:
r"""
Create a new data collector - Pressure touch version (Summary mode)
Args:
ctx: DeviceContext (from PyDeviceContext)
motor_buffer: MotorStatusBuffer
pressure_summary_buffer: PressureSummaryBuffer
slave_id: Slave ID (default 1)
motor_frequency: Motor collection frequency in Hz (default 1000)
touch_frequency: Touch collection frequency in Hz (default 100)
enable_stats: Whether to print statistics (default True)
Examples:
# Pressure touch Summary mode
collector = PyDataCollector.new_pressure_summary(ctx, motor_buffer, pressure_summary_buffer)
"""
def start(self) -> None:
r"""
Start data collection
Runs in a separate SDK thread, does not block Python
"""
def stop(self) -> None:
r"""
Stop data collection (non-blocking)
Sends stop signal to the collection thread but returns immediately.
The thread will finish its current operation and exit gracefully.
Use wait() if you need to ensure the thread has finished.
"""
def update_motor_frequency(self, frequency: builtins.int) -> None:
r"""
Update motor frequency at runtime (thread-safe)
Args:
frequency: New motor frequency in Hz (0 to disable)
"""
def update_touch_frequency(self, frequency: builtins.int) -> None:
r"""
Update touch frequency at runtime (thread-safe)
Args:
frequency: New touch frequency in Hz (0 to disable)
"""
def wait(self) -> None:
r"""
Wait for data collection thread to finish
Blocks until the collection thread exits (with 500ms timeout).
Should be called after stop() if you need to ensure cleanup is complete.
"""
@typing.final
class DetectedDevice:
r"""
Detected device information
Contains information about a detected Stark device including protocol,
port, slave ID, and optional device details.
"""
@property
def baudrate(self) -> Baudrate:
r"""
Baudrate (for Modbus/serial protocols, or CAN arbitration baudrate)
"""
@property
def data_baudrate(self) -> builtins.int:
r"""
Data baudrate (for CANFD only, 0 for other protocols)
"""
@property
def firmware_version(self) -> typing.Optional[builtins.str]:
r"""
Firmware version (if detected)
"""
@property
def hardware_type(self) -> typing.Optional[StarkHardwareType]:
r"""
Hardware type (if detected)
"""
@property
def port_name(self) -> builtins.str:
r"""
Port name (serial port or CAN adapter port)
"""
@property
def protocol_type(self) -> StarkProtocolType:
r"""
Protocol type
"""
@property
def serial_number(self) -> typing.Optional[builtins.str]:
r"""
Serial number (if detected)
"""
@property
def sku_type(self) -> typing.Optional[SkuType]:
r"""
SKU type (if detected)
"""
@property
def slave_id(self) -> builtins.int:
r"""
Slave ID on the bus
"""
@typing.final
class DeviceContext:
r"""
Device context for Python API.
This class wraps the internal device context and provides async methods
for communicating with Stark devices. Create instances using:
- `modbus_open()` for Modbus/RS485 connections
- `init_device_handler()` for CAN/CANFD connections
- `init_from_detected()` after auto-detection
All methods are async and should be awaited.
"""
def __new__(cls) -> DeviceContext: ...
def calibrate_position(self, slave_id: builtins.int) -> typing.Any:
r"""
Trigger manual position calibration.
Args:
slave_id: The slave ID of the device
"""
def clear_action_sequence(self, slave_id: builtins.int, action_id: ActionSequenceId) -> typing.Any:
r"""
Clear a stored action sequence.
Args:
slave_id: The slave ID of the device
action_id: ActionSequenceId (Action1-Action6)
"""
def close(self) -> typing.Any:
r"""
Close the device connection and release resources.
For Modbus: closes the serial port.
For CAN/CANFD: use `close_device_handler()` instead which also closes ZQWL.
"""
def ec_reserve_master(self) -> typing.Any: ...
def ec_setup_sdo(self, slave_id: builtins.int) -> typing.Any: ...
def ec_start_dfu(self, slave_pos: builtins.int, dfu_type: EtherCATFoeType, file_path: builtins.str) -> typing.Any: ...
def ec_start_loop(self, slave_positions: typing.Sequence[builtins.int], dc_assign_activate: builtins.int, sync0_cycle_time: builtins.int, sync0_shift_time: builtins.int, sync1_cycle_time: builtins.int, sync1_shift_time: builtins.int) -> typing.Any: ...
def ec_stop_loop(self) -> typing.Any: ...
def factory_backlash_self_check(self, slave_id: builtins.int, finger_id: builtins.int) -> typing.Any:
r"""
[Factory] Trigger finger backlash self-check.
Requires factory key to be set first.
Args:
slave_id: Device slave ID
finger_id: 0=thumb_tip, 1=thumb_root, 2=index, 3=middle, 4=ring, 5=pinky
"""
def factory_get_backlash(self, slave_id: builtins.int) -> typing.Any:
r"""
[Factory] Get finger backlash compensation values.
Returns:
list: 6 values in unit °×10 [thumb_tip, thumb_root, index, middle, ring, pinky]
"""
def factory_get_finger_pwms(self, slave_id: builtins.int, level: ForceLevel) -> typing.Any:
r"""
[Factory] Get finger PWM values for a force level.
Args:
slave_id: Device slave ID
level: ForceLevel enum value
Returns:
list: PWM array (length 6)
"""
def factory_get_stall_currents(self, slave_id: builtins.int, level: ForceLevel) -> typing.Any:
r"""
[Factory] Get stall detection currents for a force level.
Args:
slave_id: Device slave ID
level: ForceLevel enum value
Returns:
list: Current array (length 6)
"""
def factory_get_stall_durations(self, slave_id: builtins.int) -> typing.Any:
r"""
[Factory] Get stall detection durations.
Args:
slave_id: Device slave ID
Returns:
list: Duration array (length 6)
"""
def factory_set_backlash(self, slave_id: builtins.int, values: typing.Sequence[builtins.int]) -> typing.Any:
r"""
[Factory] Set finger backlash compensation values.
Requires factory key to be set first.
Args:
slave_id: Device slave ID
values: list of 6 values in unit °×10
"""
def factory_set_device_sn(self, slave_id: builtins.int, sn: builtins.str) -> typing.Any:
r"""
[Factory] Set device serial number.
Args:
slave_id: Device slave ID
sn: Serial number string
"""
def factory_set_finger_pwms(self, slave_id: builtins.int, level: ForceLevel, pwms: typing.Sequence[builtins.int]) -> typing.Any:
r"""
[Factory] Set finger PWM values for a force level.
Args:
slave_id: Device slave ID
level: ForceLevel enum value
pwms: PWM array (length 6)
"""
def factory_set_key(self, slave_id: builtins.int, key: builtins.str) -> typing.Any:
r"""
[Factory] Set factory key for unlocking factory functions.
Args:
slave_id: Device slave ID
key: Factory key string
"""
def factory_set_sku_type(self, slave_id: builtins.int, sku_type: SkuType) -> typing.Any:
r"""
[Factory] Set device SKU type.
Args:
slave_id: Device slave ID
sku_type: SkuType enum value
"""
def factory_set_stall_currents(self, slave_id: builtins.int, level: ForceLevel, currents: typing.Sequence[builtins.int]) -> typing.Any:
r"""
[Factory] Set stall detection currents for a force level.
Args:
slave_id: Device slave ID
level: ForceLevel enum value
currents: Current array (length 6)
"""
def factory_set_stall_durations(self, slave_id: builtins.int, durations: typing.Sequence[builtins.int]) -> typing.Any:
r"""
[Factory] Set stall detection durations.
Args:
slave_id: Device slave ID
durations: Duration array (length 6)
"""
def get_action_sequence(self, slave_id: builtins.int, action_id: ActionSequenceId) -> typing.Any:
r"""
Get action sequence by ID.
Args:
slave_id: The slave ID of the device
action_id: ActionSequenceId (Action1-Action6)
Returns:
ActionSequence: The stored action sequence
"""
def get_all_finger_settings(self, slave_id: builtins.int) -> typing.Any:
r"""
Get motor settings for all fingers (Revo2 only).
Args:
slave_id: Device slave ID
Returns:
list: MotorSettings for all fingers
"""
def get_array_pressure_touch_data(self, slave_id: builtins.int) -> typing.Any:
r"""
[ArrayPressure] Get touch data (status + 25 registers).
Returns:
dict: {status: {sensor_status, warmup_complete}, data: list[int]}
"""
def get_auto_calibration_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Check if auto calibration is enabled.
Args:
slave_id: The slave ID of the device
Returns:
bool: True if auto calibration is enabled
"""
def get_button_event(self, slave_id: builtins.int) -> typing.Any:
r"""
Get button press event.
Args:
slave_id: The slave ID of the device
Returns:
ButtonPressEvent: Button press event data
"""
def get_buzzer_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Check if buzzer is enabled.
Args:
slave_id: The slave ID of the device
Returns:
bool: True if buzzer is enabled
"""
def get_canfd_baudrate(self, slave_id: builtins.int) -> typing.Any:
r"""
Get CANFD data baudrate.
Args:
slave_id: The slave ID of the device
Returns:
BaudrateCAN: CANFD data baudrate (1M, 2M, 4M, or 5M)
"""
def get_device_fw_version(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device firmware version.
Args:
slave_id: The slave ID of the device
Returns:
str: Firmware version string
"""
def get_device_info(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device information (serial number, firmware version, hardware type)
IMPORTANT: This method should be called after connecting to the device.
It automatically sets the hardware type (hw_type) internally based on the
device's serial number. This is required for touch-related APIs to work
correctly, especially for CAN/CANFD protocols.
NOTE: If the SN is not recognized, hardware_type defaults to Revo2Basic.
Use `set_hardware_type()` to manually override if needed.
Args:
slave_id: The slave ID of the device
Returns:
DeviceInfo object containing serial_number, firmware_version, hardware_type
"""
def get_device_sn(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device serial number.
Args:
slave_id: The slave ID of the device
Returns:
str: Device serial number
"""
def get_finger_currents(self, slave_id: builtins.int) -> typing.Any:
r"""
Get finger currents
Args:
slave_id: Device slave ID
Returns:
Current array (length 6), unified range **-1000~+1000** (all devices, all protocols)
Note:
SDK automatically converts internal values to unified external range.
"""
def get_finger_max_current(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get maximum current limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
int: Maximum current value
"""
def get_finger_max_position(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get maximum position limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
int: Maximum position value
"""
def get_finger_max_speed(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get maximum speed limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
int: Maximum speed value
"""
def get_finger_min_position(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get minimum position limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
int: Minimum position value
"""
def get_finger_positions(self, slave_id: builtins.int) -> typing.Any:
r"""
Get finger positions
Args:
slave_id: Device slave ID
Returns:
Position array (length 6), unified range **0~1000** (all devices, all protocols)
Note:
SDK automatically converts internal values to unified external range.
"""
def get_finger_protected_current(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get protected current for a single finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
int: Protected current value
"""
def get_finger_protected_currents(self, slave_id: builtins.int) -> typing.Any:
r"""
Get protected currents for all fingers (Revo2 only).
Args:
slave_id: Device slave ID
Returns:
list: Protected current array (length 6)
"""
def get_finger_settings(self, slave_id: builtins.int, finger_id: FingerId) -> typing.Any:
r"""
Get motor settings for a single finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
Returns:
MotorSettings: Settings for the specified finger
"""
def get_finger_speeds(self, slave_id: builtins.int) -> typing.Any:
r"""
Get finger speeds
Args:
slave_id: Device slave ID
Returns:
Speed array (length 6), unified range **-1000~+1000** (all devices, all protocols)
Note:
SDK automatically converts internal values to unified external range.
"""
def get_finger_unit_mode(self, slave_id: builtins.int) -> typing.Any:
r"""
Get finger unit mode (Revo2 only).
Args:
slave_id: Device slave ID
Returns:
FingerUnitMode: Current finger unit mode
"""
def get_force3d_finger_array(self, slave_id: builtins.int, finger: builtins.int) -> typing.Any:
r"""
[Force3D] Get finger array data (31 measurement points).
Args:
slave_id: Device slave ID
finger: Finger index (0=index, 1=middle, 2=ring, 3=pinky)
Returns:
list[dict]: List of {fx, fy, fz} dicts (31 points)
"""
def get_force3d_touch_summary(self, slave_id: builtins.int) -> typing.Any:
r"""
[Force3D] Get touch summary data (4 fingers, no thumb).
Returns:
dict: {index, middle, ring, pinky} each with {fx, fy, fz}
"""
def get_force_level(self, slave_id: builtins.int) -> typing.Any:
r"""
Get force level (Revo1 Basic only).
@deprecated Use get_motor_status() for current values instead.
Args:
slave_id: The slave ID of the device
Returns:
ForceLevel: Current force level
"""
def get_hand_type(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device hand type (simplified left/right).
Args:
slave_id: The slave ID of the device
Returns:
HandType enum (Left = 0, Right = 1)
"""
def get_led_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Check if LED is enabled.
Args:
slave_id: The slave ID of the device
Returns:
bool: True if LED is enabled
"""
def get_led_info(self, slave_id: builtins.int) -> typing.Any:
r"""
Get LED information (color, mode, brightness).
Args:
slave_id: The slave ID of the device
Returns:
LedInfo: LED configuration
"""
def get_max_current(self, slave_id: builtins.int) -> typing.Any:
r"""
Get maximum current limit (Protobuf only).
Note: This API is only available for Protobuf protocol.
For Modbus/CAN protocols, use get_finger_max_current instead.
Args:
slave_id: The slave ID of the device
Returns:
int: Maximum current in mA (0-2000000)
"""
def get_modulus_touch_data(self, slave_id: builtins.int) -> typing.Any:
r"""
Get modulus touch detailed data for all fingers (pressure sensors).
Args:
slave_id: The slave ID of the device
Returns:
list: Detailed pressure data for all fingers
"""
def get_modulus_touch_data_type(self, slave_id: builtins.int) -> typing.Any:
r"""
Get modulus touch data type (pressure sensors).
Args:
slave_id: The slave ID of the device
Returns:
ModulusTouchDataType: Current data type setting
"""
def get_modulus_touch_summary(self, slave_id: builtins.int) -> typing.Any:
r"""
Get modulus touch summary data for all fingers (pressure sensors).
Args:
slave_id: The slave ID of the device
Returns:
list: Summary data for all fingers
"""
def get_motor_state(self, slave_id: builtins.int) -> typing.Any:
r"""
Get motor state (running, idle, stalled, etc.).
Args:
slave_id: The slave ID of the device
Returns:
list: Motor state array for each finger
"""
def get_motor_status(self, slave_id: builtins.int) -> typing.Any:
r"""
Get motor status
Args:
slave_id: Device slave ID
Returns:
MotorStatusData containing:
- positions: Position array, unified range **0~1000** (all devices, all protocols)
- speeds: Speed array, unified range **-1000~+1000** (all devices, all protocols)
- currents: Current array, unified range **-1000~+1000** (all devices, all protocols)
- states: Motor state array
Note:
SDK automatically converts internal values to unified external range.
"""
def get_serialport_baudrate(self, slave_id: builtins.int) -> typing.Any:
r"""
Get RS485 serial baudrate.
Args:
slave_id: The slave ID of the device
Returns:
Baudrate: Serial baudrate
"""
def get_serialport_cfg(self, slave_id: builtins.int) -> typing.Any:
r"""
Get serial port configuration.
Args:
slave_id: The slave ID of the device
Returns:
SerialPortCfg: Serial port configuration
"""
def get_single_modulus_touch_data(self, slave_id: builtins.int, index: builtins.int) -> typing.Any:
r"""
Get modulus touch detailed data for a single finger (pressure sensors).
Args:
slave_id: The slave ID of the device
index: Finger index (0-4)
Returns:
Detailed pressure data for the specified finger
"""
def get_single_modulus_touch_summary(self, slave_id: builtins.int, index: builtins.int) -> typing.Any:
r"""
Get modulus touch summary data for a single finger (pressure sensors).
Args:
slave_id: The slave ID of the device
index: Finger index (0-4)
Returns:
Summary data for the specified finger
"""
def get_single_touch_sensor_status(self, slave_id: builtins.int, index: builtins.int) -> typing.Any:
r"""
Get touch sensor status for a single finger (capacitive sensors).
Args:
slave_id: The slave ID of the device
index: Finger index (0-4)
Returns:
TouchFingerData: Touch status for the specified finger
"""
def get_sku_type(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device SKU type (hand side: left/right).
Args:
slave_id: The slave ID of the device
Returns:
SkuType: Device SKU type
"""
def get_thumb_aux_lock_current(self, slave_id: builtins.int) -> typing.Any:
r"""
Get thumb auxiliary motor lock current (Revo2 only).
Args:
slave_id: Device slave ID
Returns:
int: Lock current value
"""
def get_touch_sensor_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Get which touch sensors are enabled.
Args:
slave_id: The slave ID of the device
Returns:
int: Bitmask of enabled sensors (bit 0-4 for each finger)
"""
def get_touch_sensor_fw_versions(self, slave_id: builtins.int) -> typing.Any:
r"""
Get touch sensor firmware versions.
Args:
slave_id: The slave ID of the device
Returns:
list: Firmware versions for each touch sensor
"""
def get_touch_sensor_raw_data(self, slave_id: builtins.int) -> typing.Any:
r"""
Get touch sensor raw data (capacitive sensors).
Args:
slave_id: The slave ID of the device
Returns:
TouchRawData: Raw capacitive sensor data
"""
def get_touch_sensor_status(self, slave_id: builtins.int) -> typing.Any:
r"""
Get touch sensor status for all fingers (capacitive sensors).
Args:
slave_id: The slave ID of the device
Returns:
list: TouchFingerData for all fingers
"""
def get_turbo_config(self, slave_id: builtins.int) -> typing.Any:
r"""
Get turbo mode configuration (Revo1 Basic only).
Args:
slave_id: The slave ID of the device
Returns:
TurboConfig: Turbo mode configuration
"""
def get_turbo_mode_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Check if turbo mode is enabled (Revo1 Basic only).
Args:
slave_id: The slave ID of the device
Returns:
bool: True if turbo mode is enabled
"""
def get_vibration_enabled(self, slave_id: builtins.int) -> typing.Any:
r"""
Check if vibration motor is enabled.
Args:
slave_id: The slave ID of the device
Returns:
bool: True if vibration motor is enabled
"""
def get_voltage(self, slave_id: builtins.int) -> typing.Any:
r"""
Get device supply voltage in millivolts.
Args:
slave_id: The slave ID of the device
Returns:
int: Voltage in mV
"""
def is_revo1_advanced_touch(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device is Revo1 Advanced Touch.
"""
def is_touch_hand(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device has touch sensors.
Args:
slave_id: Device slave ID
Returns:
bool: True if device has touch sensors
"""
def reboot(self, slave_id: builtins.int) -> typing.Any:
r"""
Reboot the device.
Args:
slave_id: The slave ID of the device
"""
def reset_default_gesture(self, slave_id: builtins.int) -> typing.Any:
r"""
Reset action sequences to factory defaults.
Args:
slave_id: Device slave ID
"""
def reset_default_settings(self, slave_id: builtins.int) -> typing.Any:
r"""
Reset all settings to factory defaults.
Args:
slave_id: Device slave ID
"""
def reset_dfu_state(self, slave_id: builtins.int) -> typing.Any:
r"""
Reset DFU state to Idle (for recovery from stuck states).
Use this if DFU gets stuck and you see "dfu is not available" error.
Args:
slave_id: Device slave ID
"""
def reset_finger_positions(self, slave_id: builtins.int) -> typing.Any:
r"""
Reset finger positions to packing position (Protobuf only).
Packing position is [60, 50, 2, 2, 2, 2] (thumb bent, other fingers open).
Note: This API is only available for Protobuf protocol.
Args:
slave_id: The slave ID of the device
"""
def run_action_sequence(self, slave_id: builtins.int, action_id: ActionSequenceId) -> typing.Any:
r"""
Run a stored action sequence.
Args:
slave_id: The slave ID of the device
action_id: ActionSequenceId (Action1-Action6)
"""
def save_action_sequence(self, slave_id: builtins.int, action_id: ActionSequenceId) -> typing.Any:
r"""
Save action sequence to device flash (Revo2 only).
Note: Not supported on Revo1 devices.
Args:
slave_id: The slave ID of the device
action_id: ActionSequenceId (Action1-Action6)
"""
def set_array_pressure_sleep(self, slave_id: builtins.int, enable: builtins.bool) -> typing.Any:
r"""
[ArrayPressure] Set device sleep mode.
Args:
slave_id: Device slave ID
enable: True to sleep, False to wake
"""
def set_auto_calibration(self, slave_id: builtins.int, enabled: builtins.bool) -> typing.Any:
r"""
Enable or disable auto calibration.
Args:
slave_id: The slave ID of the device
enabled: True to enable, False to disable
"""
def set_buzzer_enabled(self, slave_id: builtins.int, enabled: builtins.bool) -> typing.Any:
r"""
Enable or disable buzzer.
Args:
slave_id: The slave ID of the device
enabled: True to enable, False to disable
"""
def set_canfd_baudrate(self, slave_id: builtins.int, baudrate: BaudrateCAN) -> typing.Any:
r"""
Set CANFD data baudrate.
Args:
slave_id: The slave ID of the device
baudrate: BaudrateCAN enum value (1M, 2M, 4M, or 5M)
"""
def set_finger_current(self, slave_id: builtins.int, finger_id: FingerId, current: builtins.int) -> typing.Any:
r"""
Set finger current
Args:
slave_id: Device slave ID
finger_id: Finger ID
current: Current value, unified range **-1000~+1000** (all devices, all protocols)
Positive = close, Negative = open
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_currents(self, slave_id: builtins.int, currents: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger currents
Args:
slave_id: Device slave ID
currents: Current array (length 6), unified range **-1000~+1000** (all devices, all protocols)
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_max_current(self, slave_id: builtins.int, finger_id: FingerId, current: builtins.int) -> typing.Any:
r"""
Set maximum current limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
current: Maximum current value
"""
def set_finger_max_position(self, slave_id: builtins.int, finger_id: FingerId, position: builtins.int) -> typing.Any:
r"""
Set maximum position limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
position: Maximum position value
"""
def set_finger_max_speed(self, slave_id: builtins.int, finger_id: FingerId, speed: builtins.int) -> typing.Any:
r"""
Set maximum speed limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
speed: Maximum speed value
"""
def set_finger_min_position(self, slave_id: builtins.int, finger_id: FingerId, position: builtins.int) -> typing.Any:
r"""
Set minimum position limit for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
position: Minimum position value
"""
def set_finger_position(self, slave_id: builtins.int, finger_id: FingerId, position: builtins.int) -> typing.Any:
r"""
Set finger position
Args:
slave_id: Device slave ID
finger_id: Finger ID
position: Position value, unified range **0~1000** (all devices, all protocols)
0 = fully open, 1000 = fully closed
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_position_with_millis(self, slave_id: builtins.int, finger_id: FingerId, position: builtins.int, milliseconds: builtins.int) -> typing.Any:
r"""
Set finger position with duration
Args:
slave_id: Device slave ID
finger_id: Finger ID
position: Position value, unified range **0~1000** (all protocols)
milliseconds: Duration in milliseconds (1~2000ms)
Note:
Only supported on Revo2 devices.
"""
def set_finger_position_with_speed(self, slave_id: builtins.int, finger_id: FingerId, position: builtins.int, speed: builtins.int) -> typing.Any:
r"""
Set finger position with speed
Args:
slave_id: Device slave ID
finger_id: Finger ID
position: Position value, unified range **0~1000** (all protocols)
speed: Speed value (1~1000)
Note:
Only supported on Revo2 devices.
"""
def set_finger_positions(self, slave_id: builtins.int, positions: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger positions
Args:
slave_id: Device slave ID
positions: Position array (length 6), unified range **0~1000** (all devices, all protocols)
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_positions_and_durations(self, slave_id: builtins.int, positions: typing.Sequence[builtins.int], durations: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger positions with durations (Revo2 only).
Args:
slave_id: Device slave ID
positions: Position array (length 6), unified range 0~1000
durations: Duration array (length 6), in milliseconds (1~2000ms)
"""
def set_finger_positions_and_speeds(self, slave_id: builtins.int, positions: typing.Sequence[builtins.int], speeds: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger positions with speeds (Revo2 only).
Args:
slave_id: Device slave ID
positions: Position array (length 6), unified range 0~1000
speeds: Speed array (length 6), range 1~1000
"""
def set_finger_protected_current(self, slave_id: builtins.int, finger_id: FingerId, current: builtins.int) -> typing.Any:
r"""
Set protected current for a single finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
current: Protected current value
"""
def set_finger_protected_currents(self, slave_id: builtins.int, protected_currents: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set protected currents for all fingers (Revo2 only).
Protected current is the threshold for stall detection.
Args:
slave_id: Device slave ID
protected_currents: Current array (length 6)
"""
def set_finger_pwm(self, slave_id: builtins.int, finger_id: FingerId, pwm: builtins.int) -> typing.Any:
r"""
Set finger PWM
Args:
slave_id: Device slave ID
finger_id: Finger ID
pwm: PWM value, unified range **-1000~+1000** (all protocols)
Positive = close, Negative = open
Note:
Only supported on Revo2 devices.
"""
def set_finger_pwms(self, slave_id: builtins.int, pwms: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger PWM values (Revo2 only).
Args:
slave_id: Device slave ID
pwms: PWM array (length 6), unified range -1000~+1000
"""
def set_finger_settings(self, slave_id: builtins.int, finger_id: FingerId, settings: MotorSettings) -> typing.Any:
r"""
Set motor settings for a finger (Revo2 only).
Args:
slave_id: Device slave ID
finger_id: Finger ID
settings: MotorSettings object
"""
def set_finger_speed(self, slave_id: builtins.int, finger_id: FingerId, speed: builtins.int) -> typing.Any:
r"""
Set finger speed
Args:
slave_id: Device slave ID
finger_id: Finger ID
speed: Speed value, unified range **-1000~+1000** (all devices, all protocols)
Positive = close, Negative = open, 0 = stop
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_speeds(self, slave_id: builtins.int, speeds: typing.Sequence[builtins.int]) -> typing.Any:
r"""
Set multiple finger speeds
Args:
slave_id: Device slave ID
speeds: Speed array (length 6), unified range **-1000~+1000** (all devices, all protocols)
Note:
SDK automatically converts to internal range based on device type and protocol.
"""
def set_finger_unit_mode(self, slave_id: builtins.int, mode: FingerUnitMode) -> typing.Any:
r"""
Set finger unit mode (Revo2 only).
Args:
slave_id: Device slave ID
mode: FingerUnitMode (FiveFingers or SixFingers)
"""
def set_force_level(self, slave_id: builtins.int, force_level: ForceLevel) -> typing.Any:
r"""
Set force level (Revo1 Basic only).
@deprecated Use set_finger_protected_currents() for Revo2 devices.
Args:
slave_id: The slave ID of the device
force_level: ForceLevel enum value
"""
def set_hardware_type(self, slave_id: builtins.int, hw_type: StarkHardwareType) -> typing.Any:
r"""
Set hardware type for a specific slave.
Use this to manually override the hardware type when SN-based auto-detection
in `get_device_info()` fails or returns an incorrect result
(e.g. device SN not yet programmed, defaults to Revo2Basic).
Call this after `get_device_info()` if the detected `hardware_type` is wrong.
This is also needed for CAN protocol where hardware type may not be auto-detected.
Args:
slave_id: The slave ID
hw_type: StarkHardwareType enum value
Example:
# Override hardware type after get_device_info
info = await ctx.get_device_info(slave_id)
if info.hardware_type != expected_type:
await ctx.set_hardware_type(slave_id, StarkHardwareType.Revo2TouchPressure)
"""
def set_led_enabled(self, slave_id: builtins.int, enabled: builtins.bool) -> typing.Any:
r"""
Enable or disable LED.
Args:
slave_id: The slave ID of the device
enabled: True to enable, False to disable
"""
def set_led_info(self, slave_id: builtins.int, led_info: LedInfo) -> typing.Any:
r"""
Set LED information (color, mode, brightness).
Args:
slave_id: The slave ID of the device
led_info: LedInfo object
"""
def set_max_current(self, slave_id: builtins.int, max_current: builtins.int) -> typing.Any:
r"""
Set maximum current limit (Protobuf only).
Note: This API is only available for Protobuf protocol.
For Modbus/CAN protocols, use set_finger_max_current instead.
Args:
slave_id: The slave ID of the device
max_current: Maximum current in mA (0-2000000)
"""
def set_modulus_touch_data_type(self, slave_id: builtins.int, data_type: ModulusTouchDataType) -> typing.Any:
r"""
Set modulus touch data type (pressure sensors).
Args:
slave_id: The slave ID of the device
data_type: ModulusTouchDataType (Summary or Detailed)
"""
def set_rs485_baudrate(self, slave_id: builtins.int, baudrate: Baudrate) -> typing.Any:
r"""
Alias for set_serialport_baudrate.
"""
def set_serialport_baudrate(self, slave_id: builtins.int, baudrate: Baudrate) -> typing.Any:
r"""
Set RS485 serial baudrate.
Args:
slave_id: The slave ID of the device
baudrate: Baudrate enum value
"""
def set_slave_id(self, slave_id: builtins.int, new_id: builtins.int) -> typing.Any:
r"""
Set device slave ID.
Args:
slave_id: Current slave ID
new_id: New slave ID to set
"""
def set_thumb_aux_lock_current(self, slave_id: builtins.int, lock_current: builtins.int) -> typing.Any:
r"""
Set thumb auxiliary motor lock current (Revo2 only).
Args:
slave_id: Device slave ID
lock_current: Lock current value
"""
def set_turbo_config(self, slave_id: builtins.int, turbo_config: TurboConfig) -> typing.Any:
r"""
Set turbo mode configuration (Revo1 Basic only).
Args:
slave_id: The slave ID of the device
turbo_config: TurboConfig object
"""
def set_turbo_mode_enabled(self, slave_id: builtins.int, enabled: builtins.bool) -> typing.Any:
r"""
Enable or disable turbo mode (Revo1 Basic only).
Args:
slave_id: The slave ID of the device
enabled: True to enable, False to disable
"""
def set_vibration_enabled(self, slave_id: builtins.int, enabled: builtins.bool) -> typing.Any:
r"""
Enable or disable vibration motor.
Args:
slave_id: The slave ID of the device
enabled: True to enable, False to disable
"""
def start_dfu(self, slave_id: builtins.int, dfu_file_path: builtins.str, wait_secs: builtins.int, dfu_state_cb: typing.Any, dfu_progress_cb: typing.Any) -> typing.Any:
r"""
Start DFU (Device Firmware Update) process.
Args:
slave_id: Device slave ID
dfu_file_path: Path to the firmware file
wait_secs: Timeout in seconds to wait for DFU completion
dfu_state_cb: Callback function for DFU state changes (slave_id, state)
dfu_progress_cb: Callback function for DFU progress (slave_id, progress)
Returns:
bool: True if DFU completed successfully
"""
def touch_sensor_calibrate(self, slave_id: builtins.int, bits: builtins.int) -> typing.Any:
r"""
Calibrate touch sensors.
Args:
slave_id: Device slave ID
bits: Bitmask of sensors to calibrate (bit 0-4 for each finger)
"""
def touch_sensor_reset(self, slave_id: builtins.int, bits: builtins.int) -> typing.Any:
r"""
Reset touch sensors.
Args:
slave_id: Device slave ID
bits: Bitmask of sensors to reset (bit 0-4 for each finger)
"""
def touch_sensor_setup(self, slave_id: builtins.int, bits: builtins.int) -> typing.Any:
r"""
Setup touch sensors (enable/disable specific fingers).
Args:
slave_id: Device slave ID
bits: Bitmask of sensors to enable (bit 0-4 for each finger)
"""
def transfer_action_sequence(self, slave_id: builtins.int, action_id: ActionSequenceId, sequences: typing.Sequence[typing.Sequence[builtins.int]]) -> typing.Any:
r"""
Transfer action sequence data to device.
Args:
slave_id: The slave ID of the device
action_id: ActionSequenceId (Action1-Action6)
sequences: List of position arrays, each array has 6 values (0-1000)
"""
def uses_array_pressure_touch_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses ArrayPressure Touch API.
"""
def uses_force3d_touch_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses Force3D Touch API.
"""
def uses_pressure_touch_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses Pressure/Modulus Touch API.
"""
def uses_revo1_motor_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses Revo1 Motor API.
Revo1 Basic/Touch use Revo1 Motor API.
Revo1 Advanced/AdvancedTouch and all Revo2 use Revo2 Motor API.
Returns:
True if uses Revo1 Motor API, False if uses Revo2 Motor API.
"""
def uses_revo1_touch_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses Revo1 Touch API.
Revo1Touch and Revo1AdvancedTouch use Revo1 Touch API.
"""
def uses_revo2_motor_api(self, slave_id: builtins.int) -> builtins.bool:
r"""
Check if device uses Revo2 Motor API.
Revo1 Advanced/AdvancedTouch and all Revo2 use Revo2 Motor API.
Revo1 Basic/Touch use Revo1 Motor API.
Returns:
True if uses Revo2 Motor API, False if uses Revo1 Motor API.
"""
@typing.final
class DeviceInfo:
def __new__(cls, sku_type: SkuType, hand_type: HandType, hardware_type: StarkHardwareType, serial_number: builtins.str, firmware_version: builtins.str, hardware_version: builtins.str) -> DeviceInfo: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def firmware_version(self) -> builtins.str:
r"""
Firmware version
"""
def get_hardware_type(self) -> StarkHardwareType: ...
@property
def hand_type(self) -> HandType:
r"""
Hand type (Left/Right)
"""
@property
def hardware_type(self) -> StarkHardwareType:
r"""
Hardware type
"""
@property
def hardware_version(self) -> builtins.str:
r"""
Hardware version (reserved; empty for current legacy devices)
"""
def is_touch(self) -> builtins.bool:
r"""
Check if device has any touch sensor.
"""
def new(self, sku_type: SkuType, hand_type: HandType, hardware_type: StarkHardwareType, serial_number: builtins.str, firmware_version: builtins.str, hardware_version: builtins.str) -> DeviceInfo: ...
@property
def serial_number(self) -> builtins.str:
r"""
Serial number
"""
@typing_extensions.deprecated("Use hand_type instead")
@property
def sku_type(self) -> SkuType:
r"""
Hand SKU (Deprecated, use hand_type instead)
"""
def uses_revo1_motor_api(self) -> builtins.bool:
r"""
Check if device uses Revo1 Motor API.
Revo1 Basic/Touch use Revo1 Motor API.
Revo1 Advanced/AdvancedTouch and all Revo2 use Revo2 Motor API.
"""
def uses_revo1_touch_api(self) -> builtins.bool:
r"""
Check if device uses Revo1 Touch API.
Revo1 Touch API has different sensor counts per finger (4 sensors per finger).
Includes Revo1Touch and Revo1AdvancedTouch.
"""
def uses_revo2_motor_api(self) -> builtins.bool:
r"""
Check if device uses Revo2 Motor API.
Revo1 Advanced/AdvancedTouch and all Revo2 use Revo2 Motor API.
Revo1 Basic/Touch use Revo1 Motor API.
"""
def uses_revo2_touch_api(self) -> builtins.bool:
r"""
Check if device uses Revo2 Touch API.
Includes all Revo2 touch variants (Capacitive, Pressure, Force3D, ArrayPressure).
"""
@typing.final
class Force3DFingerData:
r"""
3D force data for a single finger
"""
...
@typing.final
class Force3DPoint:
r"""
3D force data for a single measurement point
"""
...
@typing.final
class Force3DTouchData:
r"""
Complete Force3D touch data (4 fingers, no thumb)
"""
...
@typing.final
class Force3DTouchDataBuffer:
r"""
Force3D touch data shared buffer.
"""
def __new__(cls, max_size: builtins.int) -> Force3DTouchDataBuffer: ...
def clear(self) -> None: ...
def is_empty(self) -> builtins.bool: ...
def len(self) -> builtins.int: ...
def peek_latest(self) -> typing.Optional[Force3DTouchData]: ...
def pop_all(self) -> builtins.list[Force3DTouchData]: ...
@typing.final
class LedInfo:
def __new__(cls, color: LedColor, mode: LedMode) -> LedInfo: ...
@property
def color(self) -> LedColor: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def mode(self) -> LedMode: ...
def new(self, color: LedColor, mode: LedMode) -> LedInfo: ...
@typing.final
class MotorSettings:
def __new__(cls, min_position: builtins.int, max_position: builtins.int, max_speed: builtins.int, max_current: builtins.int) -> MotorSettings: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def max_current(self) -> builtins.int: ...
@property
def max_position(self) -> builtins.int: ...
@property
def max_speed(self) -> builtins.int: ...
@property
def min_position(self) -> builtins.int: ...
def new(self, min_position: builtins.int, max_position: builtins.int, max_speed: builtins.int, max_current: builtins.int) -> MotorSettings: ...
@typing.final
class MotorStatusBuffer:
r"""
Motor status shared buffer
Uses shared memory + polling mode to avoid GIL overhead from callbacks
SDK side writes quickly, Python/C side reads on demand
"""
def __new__(cls, max_size: builtins.int) -> MotorStatusBuffer: ...
def clear(self) -> None:
r"""
Clear the buffer
"""
def is_empty(self) -> builtins.bool:
r"""
Check if the buffer is empty
"""
def len(self) -> builtins.int:
r"""
Check the number of items in the buffer
"""
def peek_all(self) -> builtins.list[MotorStatusData]:
r"""
Peek at all data without removing it
"""
def peek_latest(self) -> typing.Optional[MotorStatusData]:
r"""
Peek at the latest data without removing it
"""
def pop_all(self) -> builtins.list[MotorStatusData]:
r"""
Get all pending motor status data
"""
def pop_latest(self, count: builtins.int) -> builtins.list[MotorStatusData]:
r"""
Get the latest N motor status data items
"""
@typing.final
class MotorStatusData:
def __new__(cls, positions: typing.Sequence[builtins.int], speeds: typing.Sequence[builtins.int], currents: typing.Sequence[builtins.int], states: typing.Sequence[builtins.int]) -> MotorStatusData: ...
@property
def currents(self) -> builtins.list[builtins.int]: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
def is_closed(self, uses_revo1_motor_api: builtins.bool) -> builtins.bool:
r"""
Check if hand is closed.
Args:
uses_revo1_motor_api: Whether device uses Revo1 Motor API
"""
def is_idle(self) -> builtins.bool: ...
def is_opened(self) -> builtins.bool: ...
def new(self, positions: typing.Sequence[builtins.int], speeds: typing.Sequence[builtins.int], currents: typing.Sequence[builtins.int], states: typing.Sequence[builtins.int]) -> MotorStatusData: ...
@property
def positions(self) -> builtins.list[builtins.int]: ...
@property
def speeds(self) -> builtins.list[builtins.int]: ...
@property
def states(self) -> builtins.list[MotorState]: ...
@typing.final
class PressureDetailedBuffer:
r"""
Pressure detailed data buffer (Detailed mode)
For Modulus pressure touch sensor detailed sensor point data
One buffer per part, storing PressureDetailedItem
"""
def __new__(cls, max_size: builtins.int) -> PressureDetailedBuffer: ...
def clear(self) -> None: ...
def is_empty(self) -> builtins.bool: ...
def len_all(self) -> builtins.list[builtins.int]: ...
def pop_all(self) -> builtins.list[builtins.list[PressureDetailedItem]]: ...
def pop_finger(self, finger_index: builtins.int) -> builtins.list[PressureDetailedItem]: ...
def pop_latest_all(self) -> builtins.list[typing.Optional[PressureDetailedItem]]: ...
@typing.final
class PressureDetailedItem:
r"""
Pressure sensor detailed data (Detailed mode)
For Modulus pressure touch sensor detailed sensor point data
- Fingers: 9 sensor points
- Palm: 46 sensor points
"""
@staticmethod
def new_finger(sensors: typing.Sequence[builtins.int]) -> PressureDetailedItem:
r"""
Create finger data (9 sensor points)
"""
@staticmethod
def new_palm(sensors: typing.Sequence[builtins.int]) -> PressureDetailedItem:
r"""
Create palm data (46 sensor points)
"""
@property
def sensors(self) -> builtins.list[builtins.int]:
r"""
Get valid sensor point data (returns only valid sensors based on sensor_count)
"""
@typing.final
class PressureSummaryBuffer:
r"""
Pressure summary buffer (Summary mode)
For Modulus pressure touch sensor summary data
One buffer per part, storing u16 pressure values
"""
def __new__(cls, max_size: builtins.int) -> PressureSummaryBuffer: ...
def clear(self) -> None: ...
def is_empty(self) -> builtins.bool: ...
def len_all(self) -> builtins.list[builtins.int]: ...
def pop_all(self) -> builtins.list[builtins.list[builtins.int]]: ...
def pop_finger(self, finger_index: builtins.int) -> builtins.list[builtins.int]: ...
def pop_latest_all(self) -> builtins.list[typing.Optional[builtins.int]]: ...
@typing.final
class SerialPortCfg:
def __new__(cls, slave_id: builtins.int, baudrate: Baudrate) -> SerialPortCfg: ...
@property
def baudrate(self) -> Baudrate:
r"""
Baud rate for the serial communication
"""
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
def new(self, slave_id: builtins.int, baudrate: Baudrate) -> SerialPortCfg: ...
@property
def slave_id(self) -> builtins.int:
r"""
Slave ID for the protocol
- For Protobuf protocol: range 10~254, default is 10, 254 is the broadcast address
- For Modbus protocol: range 0~254, default is 1, 0 is the broadcast address (broadcast is only for control commands)
"""
@typing.final
class TouchFingerData:
@property
def items(self) -> builtins.list[TouchFingerItem]: ...
@typing.final
class TouchFingerItem:
def __new__(cls, normal_force1: builtins.int, normal_force2: builtins.int, normal_force3: builtins.int, tangential_force1: builtins.int, tangential_force2: builtins.int, tangential_force3: builtins.int, tangential_direction1: builtins.int, tangential_direction2: builtins.int, tangential_direction3: builtins.int, self_proximity1: builtins.int, self_proximity2: builtins.int, mutual_proximity: builtins.int, status: builtins.int) -> TouchFingerItem: ...
def desc(self) -> builtins.str:
r"""
Display description - shows all fields (Revo1 style with full sensor data)
"""
@property
def description(self) -> builtins.str: ...
def is_abnormal(self) -> builtins.bool: ...
def is_normal(self) -> builtins.bool: ...
@property
def mutual_proximity(self) -> builtins.int: ...
def new(self, normal_force1: builtins.int, normal_force2: builtins.int, normal_force3: builtins.int, tangential_force1: builtins.int, tangential_force2: builtins.int, tangential_force3: builtins.int, tangential_direction1: builtins.int, tangential_direction2: builtins.int, tangential_direction3: builtins.int, self_proximity1: builtins.int, self_proximity2: builtins.int, mutual_proximity: builtins.int, status: builtins.int) -> TouchFingerItem: ...
@property
def normal_force1(self) -> builtins.int: ...
@property
def normal_force2(self) -> builtins.int: ...
@property
def normal_force3(self) -> builtins.int: ...
@property
def self_proximity1(self) -> builtins.int: ...
@property
def self_proximity2(self) -> builtins.int: ...
@property
def status(self) -> builtins.int: ...
@property
def tangential_direction1(self) -> builtins.int: ...
@property
def tangential_direction2(self) -> builtins.int: ...
@property
def tangential_direction3(self) -> builtins.int: ...
@property
def tangential_force1(self) -> builtins.int: ...
@property
def tangential_force2(self) -> builtins.int: ...
@property
def tangential_force3(self) -> builtins.int: ...
@typing.final
class TouchRawData:
def __new__(cls, thumb: typing.Sequence[builtins.int], index: typing.Sequence[builtins.int], middle: typing.Sequence[builtins.int], ring: typing.Sequence[builtins.int], pinky: typing.Sequence[builtins.int]) -> TouchRawData: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def index(self) -> builtins.list[builtins.int]: ...
@property
def middle(self) -> builtins.list[builtins.int]: ...
def new(self, thumb: typing.Sequence[builtins.int], index: typing.Sequence[builtins.int], middle: typing.Sequence[builtins.int], ring: typing.Sequence[builtins.int], pinky: typing.Sequence[builtins.int]) -> TouchRawData: ...
@property
def pinky(self) -> builtins.list[builtins.int]: ...
@property
def ring(self) -> builtins.list[builtins.int]: ...
@property
def thumb(self) -> builtins.list[builtins.int]: ...
@typing.final
class TouchSensorData:
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def items(self) -> builtins.list[TouchSensorItem]: ...
@property
def slave_id(self) -> builtins.int: ...
@typing.final
class TouchSensorItem:
r"""
ALGO OUTPUT
"""
@property
def force(self) -> builtins.float: ...
@property
def sliding_mag(self) -> builtins.float: ...
@property
def state(self) -> ContactState: ...
@typing.final
class TouchStatusBuffer:
r"""
Touch sensor status shared buffer
Uses shared memory + polling mode to avoid GIL overhead from callbacks
"""
def __new__(cls, max_size: builtins.int) -> TouchStatusBuffer: ...
def clear(self) -> None:
r"""
Clear all buffers
"""
def len_all(self) -> builtins.list[builtins.int]:
r"""
Check the number of items in each finger's buffer
"""
def pop_all(self) -> builtins.list[builtins.list[TouchFingerItem]]:
r"""
Get touch data for all fingers
"""
def pop_finger(self, finger_index: builtins.int) -> builtins.list[TouchFingerItem]:
r"""
Get touch data for a single finger
"""
def pop_latest_all(self) -> builtins.list[typing.Optional[TouchFingerItem]]:
r"""
Get the latest data for all fingers
"""
@typing.final
class TurboConfig:
def __new__(cls, interval: builtins.int, duration: builtins.int) -> TurboConfig: ...
def desc(self) -> builtins.str: ...
@property
def description(self) -> builtins.str: ...
@property
def duration(self) -> builtins.int: ...
@property
def interval(self) -> builtins.int: ...
def new(self, interval: builtins.int, duration: builtins.int) -> TurboConfig: ...
@typing.final
class ZqwlDeviceInfo:
r"""
ZQWL Device Information
"""
@property
def channel_count(self) -> builtins.int:
r"""
Number of channels
"""
@property
def description(self) -> builtins.str:
r"""
Device description
"""
@property
def pid(self) -> builtins.int:
r"""
USB PID
"""
@property
def port_name(self) -> builtins.str:
r"""
Serial port name
"""
@property
def supports_canfd(self) -> builtins.bool:
r"""
Whether CANFD is supported
"""
@property
def vid(self) -> builtins.int:
r"""
USB VID
"""
@typing.final
class ActionCmd(enum.Enum):
SetStart = ...
SetFinish = ...
ReadStart = ...
ReadFinish = ...
Save = ...
Run = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ActionCmd: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class ActionSequenceId(enum.Enum):
DefaultGestureOpen = ...
DefaultGestureFist = ...
DefaultGesturePinchTwo = ...
DefaultGesturePinchThree = ...
DefaultGesturePinchSide = ...
DefaultGesturePoint = ...
CustomGesture1 = ...
CustomGesture2 = ...
CustomGesture3 = ...
CustomGesture4 = ...
CustomGesture5 = ...
CustomGesture6 = ...
CustomGesture7 = ...
CustomGesture8 = ...
CustomGesture9 = ...
CustomGesture10 = ...
CustomGesture11 = ...
CustomGesture12 = ...
CustomGesture13 = ...
CustomGesture14 = ...
CustomGesture15 = ...
CustomGesture16 = ...
CustomGesture17 = ...
CustomGesture18 = ...
CustomGesture19 = ...
CustomGesture20 = ...
CustomGesture21 = ...
CustomGesture22 = ...
CustomGesture23 = ...
CustomGesture24 = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ActionSequenceId: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class ActionStatus(enum.Enum):
Idle = ...
Running = ...
Completed = ...
Error = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ActionStatus: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class Baudrate(enum.Enum):
Baud115200 = ...
Baud57600 = ...
Baud19200 = ...
Baud460800 = ...
Baud1Mbps = ...
Baud2Mbps = ...
Baud3Mbps = ...
Baud5Mbps = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> Baudrate: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class BaudrateCAN(enum.Enum):
Baud100Kbps = ...
Baud125Kbps = ...
Baud200Kbps = ...
Baud250Kbps = ...
Baud400Kbps = ...
Baud500Kbps = ...
Baud800Kbps = ...
Baud1Mbps = ...
Baud2Mbps = ...
Baud4Mbps = ...
Baud5Mbps = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> BaudrateCAN: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class CanChannel(enum.Enum):
Thumb = ...
ThumbAux = ...
Index = ...
Middle = ...
Ring = ...
Pinky = ...
All = ...
Reserved = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> CanChannel: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class CanCmd(enum.Enum):
Position = ...
Speed = ...
Current = ...
Pwm = ...
PositionRead = ...
SpeedRead = ...
CurrentRead = ...
StateRead = ...
ParamConfig = ...
ParamRead = ...
MultiRead = ...
PositionWithDuration = ...
TouchSensorRead = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> CanCmd: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class CanFrameMultiRead(enum.Enum):
FirmwareVersion = ...
SerialNumber = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> CanFrameMultiRead: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class CanParamAddress(enum.Enum):
Unknown = ...
SkuType = ...
DeviceId = ...
TurboSwitch = ...
TurboParam = ...
AutoCalibration = ...
ManualCalibration = ...
StoreAndReboot = ...
LedSwitch = ...
BuzzerSwitch = ...
VibrationSwitch = ...
ResetSettings = ...
LockCurrentThumbAux = ...
UnitMode = ...
EnterOta = ...
ProtectedCurrentThumbBase = ...
ProtectedCurrentThumbAux = ...
ProtectedCurrentIndex = ...
ProtectedCurrentMiddle = ...
ProtectedCurrentRing = ...
ProtectedCurrentPinky = ...
DefaultGesture = ...
TouchCalibration = ...
TouchSwitch = ...
TouchReset = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> CanParamAddress: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class ContactState(enum.Enum):
NoContact = ...
Contact = ...
ContactSliding = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ContactState: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class DfuCommandType(enum.Enum):
RequestDeviceInfo = ...
StartUpgrade = ...
TransferData = ...
TransferDone = ...
ExitUpgrade = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> DfuCommandType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class DfuExitReason(enum.Enum):
FirmwareVersionMismatch = ...
HardwareVersionMismatch = ...
FirmwareFileCorrupted = ...
Unknown = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> DfuExitReason: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class DfuState(enum.Enum):
Idle = ...
Starting = ...
Started = ...
Transfer = ...
Completed = ...
Aborted = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> DfuState: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EcModulusSdoSubIdx(enum.Enum):
CalibrationThumb = ...
CalibrationIndex = ...
CalibrationMiddle = ...
CalibrationRing = ...
CalibrationPinky = ...
CalibrationPalm = ...
SwitchThumb = ...
SwitchIndex = ...
SwitchMiddle = ...
SwitchRing = ...
SwitchPinky = ...
SwitchPalm = ...
Vendor = ...
DataType = ...
DeviceSnThumb = ...
DeviceSnIndex = ...
DeviceSnMiddle = ...
DeviceSnRing = ...
DeviceSnPinky = ...
DeviceSnPalm = ...
FwVersionThumb = ...
FwVersionIndex = ...
FwVersionMiddle = ...
FwVersionRing = ...
FwVersionPinky = ...
FwVersionPalm = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EcModulusSdoSubIdx: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EcTashanSdoSubIdx(enum.Enum):
ThumbCalibration = ...
IndexCalibration = ...
MidCalibration = ...
RingCalibration = ...
PinkyCalibration = ...
TouchVendor = ...
ThumbAcqParamUpdate = ...
IndexAcqParamUpdate = ...
MidAcqParamUpdate = ...
RingAcqParamUpdate = ...
PinkyAcqParamUpdate = ...
Reserved1 = ...
ThumbTouchFwVersion = ...
IndexTouchFwVersion = ...
MidTouchFwVersion = ...
RingTouchFwVersion = ...
PinkyTouchFwVersion = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EcTashanSdoSubIdx: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATAddress(enum.Enum):
TX = ...
RX = ...
Config = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATAddress: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATConfigIndex(enum.Enum):
SkuType = ...
LedSwitch = ...
BuzzerSwitch = ...
VibrationSwitch = ...
UnitMode = ...
CalibratePosition = ...
AutoCalibration = ...
TurboMode = ...
TurboParam = ...
ProtectedCurrentThumbBase = ...
ProtectedCurrentThumbAux = ...
ProtectedCurrentIndex = ...
ProtectedCurrentMiddle = ...
ProtectedCurrentRing = ...
ProtectedCurrentPinky = ...
LockCurrentThumbAux = ...
CtrlFirmwareVersion = ...
CtrlSerialNumber = ...
WristFirmwareVersion = ...
WristSerialNumber = ...
FoeFileType = ...
FoeAuthCode = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATConfigIndex: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATCtrlAddress(enum.Enum):
Multi = ...
Single = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATCtrlAddress: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATCtrlSubAddressMulti(enum.Enum):
Mode = ...
Param1 = ...
Param2 = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATCtrlSubAddressMulti: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATCtrlSubAddressSingle(enum.Enum):
Mode = ...
Id = ...
Param1 = ...
Param2 = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATCtrlSubAddressSingle: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class EtherCATFoeType(enum.Enum):
Wrist = ...
Control = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> EtherCATFoeType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class FingerCtrlMode(enum.Enum):
PositionWithDuration = ...
PositionWithSpeed = ...
Speed = ...
Current = ...
Pwm = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> FingerCtrlMode: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class FingerId(enum.Enum):
Thumb = ...
ThumbAux = ...
Index = ...
Middle = ...
Ring = ...
Pinky = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> FingerId: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class FingerUnitMode(enum.Enum):
Normalized = ...
Physical = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> FingerUnitMode: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class ForceLevel(enum.Enum):
Small = ...
Normal = ...
Full = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ForceLevel: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class HandType(enum.Enum):
Left = ...
Right = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> HandType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class LedColor(enum.Enum):
Unchanged = ...
R = ...
G = ...
RG = ...
B = ...
RB = ...
GB = ...
RGB = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> LedColor: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class LedMode(enum.Enum):
Unknown = ...
Shutdown = ...
Keep = ...
Blink = ...
OneShot = ...
Blink0_5Hz = ...
Blink2Hz = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> LedMode: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class LogLevel(enum.Enum):
Error = ...
Warn = ...
Info = ...
Debug = ...
Trace = ...
@typing.final
class ModulusTouchDataType(enum.Enum):
Raw = ...
Calibrated = ...
Force = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> ModulusTouchDataType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class MotorState(enum.Enum):
Unknown = ...
Idle = ...
Running = ...
Stall = ...
Turbo = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> MotorState: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class MsgType(enum.Enum):
Crimson = ...
OxyZen = ...
Mobius = ...
MobiusV1_5 = ...
Almond = ...
AlmondV2 = ...
Morpheus = ...
Luna = ...
REN = ...
Breeze = ...
Stark = ...
EEGCap = ...
Edu = ...
Clear = ...
Melody = ...
Aura = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> MsgType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class PressState(enum.Enum):
Unknown = ...
Down = ...
Up = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> PressState: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class RegAddrArrayPressure(enum.Enum):
TouchSwitchAll = ...
ZeroAll = ...
ZeroThumb = ...
ZeroIndex = ...
ZeroMiddle = ...
ZeroRing = ...
ZeroPinky = ...
DeviceSleep = ...
SensorStatus = ...
WarmupStatus = ...
TouchDataBase = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> RegAddrArrayPressure: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class RegAddrForce3D(enum.Enum):
TouchSwitchAll = ...
TouchSwitchIndex = ...
TouchSwitchMiddle = ...
TouchSwitchRing = ...
TouchSwitchPinky = ...
CalibrationAll = ...
CalibrationIndex = ...
CalibrationMiddle = ...
CalibrationRing = ...
CalibrationPinky = ...
SummaryIndexFxFy = ...
SummaryIndexFz = ...
SummaryMiddleFxFy = ...
SummaryMiddleFz = ...
SummaryRingFxFy = ...
SummaryRingFz = ...
SummaryPinkyFxFy = ...
SummaryPinkyFz = ...
ArrayIndexBase = ...
ArrayMiddleBase = ...
ArrayRingBase = ...
ArrayPinkyBase = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> RegAddrForce3D: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class RegAddrRevo1(enum.Enum):
EnterOta = ...
SkuType = ...
SetFactoryKey = ...
SetSn = ...
StallDuration = ...
PwmSmall = ...
PwmNormal = ...
PwmFull = ...
StallCurrentSmall = ...
StallCurrentNormal = ...
StallCurrentFull = ...
SlaveId = ...
Baudrate = ...
Force = ...
SetReboot = ...
Position = ...
Speed = ...
Led = ...
Current = ...
Turbo = ...
TurboInterval = ...
TurboDuration = ...
AutoCalibration = ...
ManualCalibration = ...
ActionCmd = ...
ActionNum = ...
ActionData = ...
GetNowPosition = ...
GetNowSpeed = ...
GetNowCurrent = ...
GetMotorState = ...
GetVoltage = ...
GetButtonStatus = ...
GetFwVersion = ...
GetSn = ...
GetThumbNormalForce1 = ...
GetThumbTangentialForce1 = ...
GetThumbTangentialDirection1 = ...
GetThumbNormalForce2 = ...
GetThumbTangentialForce2 = ...
GetThumbTangentialDirection2 = ...
GetThumbSelfProximity1 = ...
GetThumbStatus = ...
GetIndexNormalForce1 = ...
GetIndexTangentialForce1 = ...
GetIndexTangentialDirection1 = ...
GetIndexNormalForce2 = ...
GetIndexTangentialForce2 = ...
GetIndexTangentialDirection2 = ...
GetIndexNormalForce3 = ...
GetIndexTangentialForce3 = ...
GetIndexTangentialDirection3 = ...
GetIndexSelfProximity1 = ...
GetIndexSelfProximity2 = ...
GetIndexMutualProximity = ...
GetIndexStatus = ...
GetMiddleNormalForce1 = ...
GetMiddleTangentialForce1 = ...
GetMiddleTangentialDirection1 = ...
GetMiddleNormalForce2 = ...
GetMiddleTangentialForce2 = ...
GetMiddleTangentialDirection2 = ...
GetMiddleNormalForce3 = ...
GetMiddleTangentialForce3 = ...
GetMiddleTangentialDirection3 = ...
GetMiddleSelfProximity1 = ...
GetMiddleSelfProximity2 = ...
GetMiddleMutualProximity = ...
GetMiddleStatus = ...
GetRingNormalForce1 = ...
GetRingTangentialForce1 = ...
GetRingTangentialDirection1 = ...
GetRingNormalForce2 = ...
GetRingTangentialForce2 = ...
GetRingTangentialDirection2 = ...
GetRingNormalForce3 = ...
GetRingTangentialForce3 = ...
GetRingTangentialDirection3 = ...
GetRingSelfProximity1 = ...
GetRingSelfProximity2 = ...
GetRingMutualProximity = ...
GetRingStatus = ...
GetPinkyNormalForce1 = ...
GetPinkyTangentialForce1 = ...
GetPinkyTangentialDirection1 = ...
GetPinkyNormalForce2 = ...
GetPinkyTangentialForce2 = ...
GetPinkyTangentialDirection2 = ...
GetPinkySelfProximity1 = ...
GetPinkyMutualProximity1 = ...
GetPinkyStatus = ...
SetThumbReset = ...
SetIndexReset = ...
SetMiddleReset = ...
SetRingReset = ...
SetPinkyReset = ...
SetThumbCalibration = ...
SetIndexCalibration = ...
SetMiddleCalibration = ...
SetRingCalibration = ...
SetPinkyCalibration = ...
TouchEnabledThumb = ...
TouchEnabledIndex = ...
TouchEnabledMiddle = ...
TouchEnabledRing = ...
TouchEnabledPinky = ...
GetTouchFwVersion = ...
GetTouchRawDataThumb = ...
GetTouchRawDataIndex = ...
GetTouchRawDataMiddle = ...
GetTouchRawDataRing = ...
GetTouchRawDataPinky = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> RegAddrRevo1: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class RegAddrRevo2(enum.Enum):
EnterOta = ...
SkuType = ...
ResetGesture = ...
ResetSettings = ...
LEDSwitch = ...
BuzzerSwitch = ...
VibrationSwitch = ...
SetFactoryKey = ...
SetSn = ...
ProtectedCurrentThumbBase = ...
ProtectedCurrentThumbAux = ...
ProtectedCurrentIndex = ...
ProtectedCurrentMiddle = ...
ProtectedCurrentRing = ...
ProtectedCurrentPinky = ...
LockCurrentThumbAux = ...
UnitMode = ...
SetFingerMinPosition = ...
SetFingerMaxPosition = ...
SetFingerMaxSpeed = ...
SetFingerMaxCurrent = ...
GetFingerMinPosition = ...
GetFingerMaxPosition = ...
GetFingerMaxSpeed = ...
GetFingerMaxCurrent = ...
TouchVendor = ...
BacklashThumbTip = ...
BacklashThumbRoot = ...
BacklashIndex = ...
BacklashMiddle = ...
BacklashRing = ...
BacklashPinky = ...
BacklashSelfCheck = ...
SlaveId = ...
Baudrate = ...
BaudrateCAN = ...
CanFdAbitSamplingRate = ...
SetReboot = ...
PositionWithDuration = ...
PositionWithSpeed = ...
Speed = ...
Current = ...
Pwm = ...
PositionWithDurationSingle = ...
PositionWithSpeedSingle = ...
SpeedSingle = ...
CurrentSingle = ...
PwmSingle = ...
Led = ...
Turbo = ...
TurboInterval = ...
AutoCalibration = ...
ManualCalibration = ...
PositionByPercent = ...
ActionCmd = ...
ActionNum = ...
ActionData = ...
GetNowPosition = ...
GetNowSpeed = ...
GetNowCurrent = ...
GetMotorState = ...
GetButtonStatus = ...
GetFwVersion = ...
GetSn = ...
TouchEnabledThumb = ...
TouchEnabledIndex = ...
TouchEnabledMiddle = ...
TouchEnabledRing = ...
TouchEnabledPinky = ...
SetThumbReset = ...
SetIndexReset = ...
SetMiddleReset = ...
SetRingReset = ...
SetPinkyReset = ...
SetThumbCalibration = ...
SetIndexCalibration = ...
SetMiddleCalibration = ...
SetRingCalibration = ...
SetPinkyCalibration = ...
GetTouchFwVersion = ...
GetMultiFinger3DForce = ...
GetMultiFingerProximity = ...
GetMultiFingerTouchStatus = ...
GetSingleFinger3DForce = ...
GetTouchRawDataThumb = ...
GetTouchRawDataIndex = ...
GetTouchRawDataMiddle = ...
GetTouchRawDataRing = ...
GetTouchRawDataPinky = ...
GetModulusSensorDataType = ...
GetModulusTouchSummaryThumb = ...
GetModulusTouchSummaryIndex = ...
GetModulusTouchSummaryMiddle = ...
GetModulusTouchSummaryRing = ...
GetModulusTouchSummaryPinky = ...
GetModulusTouchSummaryPalm = ...
GetModulusTouchDataThumb = ...
GetModulusTouchDataIndex = ...
GetModulusTouchDataMiddle = ...
GetModulusTouchDataRing = ...
GetModulusTouchDataPinky = ...
GetModulusTouchDataPalm = ...
GetModulusFirmwareThumb = ...
GetModulusFirmwareIndex = ...
GetModulusFirmwareMiddle = ...
GetModulusFirmwareRing = ...
GetModulusFirmwarePinky = ...
GetModulusFirmwarePalm = ...
ModulusSwitchThumb = ...
ModulusSwitchIndex = ...
ModulusSwitchMiddle = ...
ModulusSwitchRing = ...
ModulusSwitchPinky = ...
ModulusSwitchPalm = ...
GetModulusSerialThumb = ...
GetModulusSerialIndex = ...
GetModulusSerialMiddle = ...
GetModulusSerialRing = ...
GetModulusSerialPinky = ...
GetModulusSerialPalm = ...
SetModulusCalibrationThumb = ...
SetModulusCalibrationIndex = ...
SetModulusCalibrationMiddle = ...
SetModulusCalibrationRing = ...
SetModulusCalibrationPinky = ...
SetModulusCalibrationPalm = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> RegAddrRevo2: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class SkuType(enum.Enum):
MediumRight = ...
MediumLeft = ...
SmallRight = ...
SmallLeft = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> SkuType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class StarkError(enum.Enum):
Success = ...
Unknown = ...
InvalidParams = ...
InvalidData = ...
ParseFailed = ...
AllocFailed = ...
ReadFailed = ...
OperationFailed = ...
SystemIsBusy = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> StarkError: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class StarkHardwareType(enum.Enum):
Revo2Basic = ...
Revo1Protobuf = ...
Revo1Basic = ...
Revo1Touch = ...
Revo1Advanced = ...
Revo1AdvancedTouch = ...
Revo2Touch = ...
Revo2TouchPressure = ...
Revo2TouchForce3D = ...
Revo2TouchArrayPressure = ...
Revo2VisionTouch = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> StarkHardwareType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class StarkModuleId(enum.Enum):
MCU = ...
MTR = ...
APP = ...
SERIAL = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> StarkModuleId: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class StarkProtocolType(enum.Enum):
Auto = ...
Modbus = ...
Can = ...
CanFd = ...
EtherCAT = ...
Protobuf = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> StarkProtocolType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class TouchDataType(enum.Enum):
Force = ...
Proximity = ...
Status = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> TouchDataType: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class TouchSensorStatus(enum.Enum):
Unknown = ...
Normal = ...
Abnormal = ...
SensorCommError = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> TouchSensorStatus: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
@typing.final
class TouchVendor(enum.Enum):
Unknown = ...
Capacitive = ...
Pressure = ...
ArrayPressure = ...
Force3D = ...
def __int__(self) -> builtins.int:
r"""
Support int(enum) conversion
"""
def __new__(cls, value: builtins.int) -> TouchVendor: ...
@property
def int_value(self) -> builtins.int:
r"""
Get the integer value of the enum
"""
def auto_detect(scan_all: builtins.bool = False, port: typing.Optional[builtins.str] = None, protocol: typing.Optional[builtins.str] = None) -> typing.Any:
r"""
Auto-detect Stark devices
Scans for devices across all supported protocols in priority order:
1. ZQWL CANFD (Revo2: IDs 0x7E, 0x7F)
2. ZQWL CAN 2.0 (Revo1/Revo2: IDs 1, 2)
3. Modbus/RS485 (IDs 0x7E, 0x7F, 1, 2, 10)
Args:
scan_all: If True, scan for all devices. If False, stop at first found. Default False.
port: Optional port name to scan. If None, scans all available ports.
protocol: Optional protocol to use ("CanFd", "Can", "Modbus"). If None, tries all.
Returns:
List[DetectedDevice]: List of detected devices (empty if none found)
Examples:
# Auto-detect (simplest)
devices = await sdk.auto_detect()
# Scan all devices
devices = await sdk.auto_detect(scan_all=False)
# Scan specific port
devices = await sdk.auto_detect(port="/dev/ttyUSB0")
# Scan specific protocol
devices = await sdk.auto_detect(protocol="CanFd")
"""
def auto_detect_device(port_name: typing.Optional[builtins.str] = None, quick: typing.Optional[builtins.bool] = True) -> typing.Any: ...
def auto_detect_modbus_revo1(port_name: typing.Optional[builtins.str] = None, quick: typing.Optional[builtins.bool] = True) -> typing.Any: ...
def auto_detect_modbus_revo2(port_name: typing.Optional[builtins.str] = None, quick: typing.Optional[builtins.bool] = True) -> typing.Any: ...
def available_usb_ports(vid: builtins.int, pid: builtins.int) -> typing.Any: ...
def close_device_handler(client: DeviceContext) -> typing.Any:
r"""
Close device handler and release resources.
This is the counterpart to init_from_detected() and init_device_handler().
It automatically handles cleanup based on the protocol type:
- For CAN/CANFD: Closes ZQWL device
- For Modbus: Closes serial port
Args:
client: PyDeviceContext to close
Examples:
ctx = await sdk.init_from_detected(device)
# ... use ctx ...
await sdk.close_device_handler(ctx)
"""
def close_socketcan() -> None:
r"""
Close SocketCAN device (Linux only)
"""
def close_zqwl() -> None:
r"""
Close ZQWL CAN/CANFD device
"""
def get_sdk_version() -> builtins.str: ...
def init_device_handler(protocol_type: StarkProtocolType, master_id: builtins.int = 0, slave_id: typing.Optional[builtins.int] = None, hw_type: typing.Optional[StarkHardwareType] = None) -> DeviceContext: ...
def init_from_detected(device: DetectedDevice) -> typing.Any:
r"""
Initialize device handler from detected device info.
This function initializes the appropriate transport (Modbus, CAN, CANFD)
based on the detected device's protocol and returns a ready-to-use handler.
This is the recommended way to initialize after auto_detect() as it:
- Automatically initializes the correct transport (BrainCo/ZQWL/SocketCAN or Modbus)
- Sets hardware type from detected device info
- Simplifies the initialization process
Args:
device: DetectedDevice from auto_detect()
Returns:
PyDeviceContext: Ready-to-use device context
Raises:
RuntimeError: If initialization fails
Examples:
devices = await sdk.auto_detect()
if devices:
ctx = await sdk.init_from_detected(devices[0])
# ctx is ready to use, no need to call get_device_info
"""
def init_logging(level: typing.Optional[LogLevel] = LogLevel.Info) -> None: ...
def init_socketcan_can(iface: typing.Optional[builtins.str] = None) -> None:
r"""
Initialize SocketCAN CAN 2.0 device (Linux only)
Args:
iface: Interface name (e.g. "can0"). If None, uses STARK_SOCKETCAN_IFACE env var or "can0"
Raises:
RuntimeError: Initialization failed or not on Linux
"""
def init_socketcan_canfd(iface: typing.Optional[builtins.str] = None) -> None:
r"""
Initialize SocketCAN CANFD device (Linux only)
Args:
iface: Interface name (e.g. "can0"). If None, uses STARK_SOCKETCAN_IFACE env var or "can0"
Raises:
RuntimeError: Initialization failed or not on Linux
"""
def init_zqwl_can(port_name: builtins.str, arb_baudrate: builtins.int = 1000000) -> None:
r"""
Initialize ZQWL CAN device (CAN 2.0 mode)
For Revo1 devices, baudrate is typically 1Mbps
Args:
port_name: Serial port name, e.g. "/dev/cu.usbmodem*" (macOS) or "COM3" (Windows)
arb_baudrate: Arbitration baudrate (bps), default 1000000
Raises:
RuntimeError: Initialization failed
"""
def init_zqwl_canfd(port_name: builtins.str, arb_baudrate: builtins.int = 1000000, data_baudrate: builtins.int = 5000000) -> None:
r"""
Initialize ZQWL CANFD device
For Revo2 devices, arbitration baudrate is typically 1Mbps, data baudrate is typically 5Mbps
Args:
port_name: Serial port name
arb_baudrate: Arbitration baudrate (bps), default 1000000
data_baudrate: Data baudrate (bps), default 5000000
Raises:
RuntimeError: Initialization failed
"""
def is_socketcan_available(iface: builtins.str) -> builtins.bool:
r"""
Check if SocketCAN interface is available (Linux only)
Args:
iface: Interface name (e.g. "can0")
Returns:
bool: True if interface exists and is up
"""
def list_available_ports() -> typing.Any: ...
def list_zqwl_devices() -> builtins.list[ZqwlDeviceInfo]:
r"""
List all ZQWL USB CAN/CANFD devices
Returns:
List[ZqwlDeviceInfo]: List of devices
"""
def modbus_close(client: DeviceContext) -> typing.Any: ...
def modbus_open(port_name: builtins.str, baudrate: Baudrate) -> typing.Any: ...
def protobuf_open(port_name: builtins.str, slave_id: builtins.int = 10, baudrate: builtins.int = 115200) -> typing.Any:
r"""
Open a Protobuf protocol connection
Protobuf protocol uses default baudrate 115200 and default slave_id 10.
Position range is 0-100 (not 0-1000 like Modbus/CAN).
Args:
port_name: Serial port name (e.g., "/dev/ttyUSB0" or "COM3")
slave_id: Device slave ID (default is 10)
baudrate: Baudrate (default is 115200)
Returns:
DeviceContext: Ready-to-use device context for Protobuf protocol
Raises:
RuntimeError: If opening the port fails
Examples:
ctx = await sdk.protobuf_open("/dev/ttyUSB0")
# or with custom slave_id
ctx = await sdk.protobuf_open("/dev/ttyUSB0", slave_id=10)
# or with custom baudrate
ctx = await sdk.protobuf_open("/dev/ttyUSB0", slave_id=10, baudrate=115200)
"""
def scan_can_devices(candidate_ids: typing.Optional[typing.Sequence[builtins.int]] = None, timeout_ms: builtins.int = 500) -> typing.Any:
r"""
Scan CAN bus for devices
Uses get_can_params to read SkuType to detect devices
Args:
candidate_ids: Candidate device ID list, default [1, 2] (Revo1) or [0x7E, 0x7F] (Revo2)
timeout_ms: Timeout in milliseconds, default 500
Returns:
Optional[int]: Found device ID, None if not found
"""
def scan_canfd_devices(ctx: DeviceContext, candidate_ids: typing.Optional[typing.Sequence[builtins.int]] = None, timeout_ms: builtins.int = 500) -> typing.Any:
r"""
Scan CANFD bus for devices
Uses DeviceContext to read SkuType register to detect devices
Args:
ctx: PyDeviceContext
candidate_ids: Candidate device ID list, default [0x7E, 0x7F] (Revo2)
timeout_ms: Timeout in milliseconds, default 500
Returns:
Optional[int]: Found device ID, None if not found
"""
def set_can_rx_callback(func: typing.Any) -> None:
r"""
Set callback for receiving CAN FD frames.
Args:
func: Callback function to receive CAN FD frames.
Returns:
None
"""
def set_can_tx_callback(func: typing.Any) -> None:
r"""
Set callback for transmitting CAN FD frames.
Args:
func: Callback function to transmit CAN FD frames.
Returns:
None
"""
def set_modbus_read_holding_callback(func: typing.Any) -> None:
r"""
Set callback for reading Modbus holding registers (FC03).
Args:
func: Callback function for reading holding registers.
Returns:
None
"""
def set_modbus_read_input_callback(func: typing.Any) -> None:
r"""
Set callback for reading Modbus input registers (FC04).
Args:
func: Callback function for reading input registers.
Returns:
None
"""
def set_modbus_write_callback(func: typing.Any) -> None:
r"""
Set callback for writing Modbus holding registers (FC16).
Args:
func: Callback function for writing holding registers.
Returns:
None
"""API 快速参考
连接管理
| API | 说明 |
|---|---|
libstark.auto_detect() | 自动检测设备(推荐,支持所有协议) |
libstark.init_from_detected() | 从检测结果初始化设备 |
libstark.close_device_handler() | 关闭设备连接(推荐) |
libstark.list_available_ports() | 列出可用串口 |
libstark.list_zqwl_devices() | 列出 ZQWL CAN 适配器 |
libstark.modbus_open() | 打开 Modbus 连接 |
libstark.modbus_close() | 关闭 Modbus 连接 |
libstark.init_device_handler() | 创建设备处理器(CAN/CANFD) |
libstark.init_zqwl_can() | 初始化 ZQWL CAN 适配器 |
libstark.auto_detect_device() | 自动检测设备(已弃用) |
libstark.auto_detect_modbus_revo1() | 自动检测 Revo 1 设备(已弃用) |
设备信息
| API | 说明 |
|---|---|
ctx.get_device_info() | 获取设备完整信息 |
ctx.get_device_sn() | 获取设备序列号 |
ctx.get_device_fw_version() | 获取固件版本 |
ctx.get_sku_type() | 获取 SKU 类型 |
ctx.get_voltage() | 获取电池电压 |
ctx.get_serialport_cfg() | 获取串口配置 |
ctx.get_serialport_baudrate() | 获取波特率 |
ctx.set_serialport_baudrate() | 设置波特率 |
ctx.set_slave_id() | 设置从站 ID |
设备配置
| API | 说明 |
|---|---|
ctx.get_force_level() | 获取力度等级 |
ctx.set_force_level() | 设置力度等级 |
ctx.get_auto_calibration_enabled() | 获取自动校准状态 |
ctx.set_auto_calibration() | 设置自动校准 |
ctx.calibrate_position() | 手动校准位置 |
ctx.get_turbo_mode_enabled() | 获取 Turbo 模式状态 |
ctx.set_turbo_mode_enabled() | 设置 Turbo 模式 |
ctx.get_turbo_config() | 获取 Turbo 配置 |
ctx.set_turbo_config() | 设置 Turbo 配置 |
ctx.reset_default_gesture() | 恢复默认手势 |
ctx.reset_default_settings() | 恢复默认设置 |
ctx.reboot() | 重启设备 |
设备类型检查
| API | 说明 |
|---|---|
ctx.is_touch_hand() | 检查是否有触觉传感器 |
ctx.uses_revo1_motor_api() | 检查是否使用 Revo 1 电机 API |
ctx.uses_revo2_motor_api() | 检查是否使用 Revo 2 电机 API |
ctx.uses_pressure_touch_api() | 检查是否使用压力触觉 API |
电机控制 - 位置
| API | 说明 |
|---|---|
ctx.set_finger_position() | 设置单个手指位置(0~1000) |
ctx.set_finger_positions() | 设置所有手指位置 |
ctx.get_finger_positions() | 获取所有手指位置 |
电机控制 - 速度
| API | 说明 |
|---|---|
ctx.set_finger_speed() | 设置单个手指速度(-1000~+1000) |
ctx.set_finger_speeds() | 设置所有手指速度 |
ctx.get_finger_speeds() | 获取所有手指速度 |
电机控制 - 电流
| API | 说明 |
|---|---|
ctx.set_finger_current() | 设置单个手指电流(-1000~+1000) |
ctx.set_finger_currents() | 设置所有手指电流 |
ctx.get_finger_currents() | 获取所有手指电流 |
电机状态
| API | 说明 |
|---|---|
ctx.get_motor_status() | 获取电机综合状态 |
ctx.get_motor_state() | 获取电机运行状态 |
触觉传感器
| API | 说明 |
|---|---|
ctx.get_touch_sensor_enabled() | 获取触觉传感器启用状态 |
ctx.get_touch_sensor_fw_versions() | 获取触觉传感器固件版本 |
ctx.get_touch_sensor_raw_data() | 获取触觉原始数据 |
ctx.get_touch_sensor_status() | 获取触觉传感器状态 |
ctx.touch_sensor_setup() | 设置触觉传感器 |
ctx.touch_sensor_reset() | 重置触觉传感器 |
ctx.touch_sensor_calibrate() | 校准触觉传感器 |
LED 和按钮
| API | 说明 |
|---|---|
ctx.get_led_info() | 获取 LED 状态 |
ctx.set_led_info() | 设置 LED 状态 |
ctx.get_button_event() | 获取按钮事件 |
动作序列
| API | 说明 |
|---|---|
ctx.get_action_sequence() | 获取动作序列 |
ctx.transfer_action_sequence() | 上传动作序列 |
ctx.save_action_sequence() | 保存动作序列到闪存 |
ctx.run_action_sequence() | 执行动作序列 |
ctx.clear_action_sequence() | 清除自定义动作序列 |
固件升级
| API | 说明 |
|---|---|
ctx.start_dfu() | 启动固件升级 |