Python SDK - Revo 2 Dexterous Hand
System Requirements
- Linux: Ubuntu 20.04/22.04 LTS or above (supports x86_64 / aarch64 architectures. Note: The SDK dynamic library is compiled against a baseline of glibc 2.31, which is natively supported by the system without manual upgrades.)
- macOS: 10.15+
- Windows: 10/11
- Python: 3.9 ~ 3.12 (Conda recommended)
Quick Start
Clone Repository
shell
# Using HTTPS
git clone https://github.com/BrainCoTech/brainco-hand-sdk.git
# Or using SSH
git clone git@github.com:BrainCoTech/brainco-hand-sdk.gitInstallation and Configuration
shell
# Navigate to Python directory
cd brainco-hand-sdk/python
# Activate Conda environment (recommended)
conda activate py310
# Install SDK dependencies
pip install -r requirements.txt --index-url https://pypi.org/simple/
# If unable to install via PyPI, manually download and install the .whl file
# Download from: 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'
# Configure serial port device permissions
# In Linux systems, serial devices (e.g., /dev/ttyUSB0) typically belong to the dialout user group
# Add current user to dialout group
sudo usermod -aG dialout $USER
# Note: You need to log out and log back in for this to take effect
# Run examples
cd revo2
python revo2_ctrl.py # Single hand control
python revo2_touch.py # Tactile sensor (tactile version)
python revo2_ctrl_multi.py # Multi-hand control
python revo2_action_seq.py # Action sequence
python revo2_cfg.py # Device configuration
python revo2_dfu.py # Firmware upgrade
# CANFD communication protocol (recommended unified entry)
cd ../demo
python hand_demo.py -f /dev/ttyUSB0 1000000 5000000 127 # ZQWL CANFD
python hand_demo.py -B can0 127 # SocketCAN CANFD (Linux)
python hand_dfu.py /path/to/firmware.bin # Firmware OTA
# EtherCAT communication protocol
cd revo2_ethercat
python ec_sdo.py # SDO read/configure
python ec_pdo.py # PDO read joint status and control device
python ec_dfu.py # Firmware OTAshell
# Installation steps same as Ubuntu
# Note: macOS serial device names are typically /dev/tty.usbserial-xxx
# macOS does not support SocketCAN / EtherCAT; ZQWL CANFD can be used when supported by the adaptershell
# If USB driver is not recognized, check serial port name in Device Manager
# Serial driver download: https://app.brainco.cn/universal/stark-serialport-prebuild/driver/CH340-drivers.zip
# Other installation steps same as Ubuntu
# Note: Windows serial device names are typically COM3, COM4, etc.
# Windows does not support EtherCAT communication protocolSample Code
SDK provides rich sample code covering different communication protocols and application scenarios.
Cross-Platform Examples (Recommended) ⭐
Unified cross-platform examples with automatic device detection and multi-protocol support.
| Example | Description |
|---|---|
| hand_demo.py | Comprehensive demo |
| hand_monitor.py | Real-time data monitoring |
| hand_dfu.py | Firmware upgrade |
Modbus-RTU Protocol
Single Hand/Dual Hand Control
- Single Hand Control Example
- Dual Hand Control (Dual Serial Port) - Use two serial ports to connect left and right hands separately
- Dual Hand Control (Single Serial Port) - Use a single serial port to connect left and right hands, default left hand ID=126, right hand ID=127
Tactile Sensor
Action Sequence (Gestures)
EtherCAT Protocol
EtherCAT Command Line Examples
shell
# Check EtherCAT version
# Recommended: igH EtherCAT Master 1.6.x (latest stable version)
❯ ethercat version
IgH EtherCAT master 1.6.6 1.6.6-5-g64899015
# Note: If your EtherCAT version is 1.5.x, please contact technical support
# SDK is compiled for 1.6.x by default, 1.5.x may have compatibility issues
❯ ethercat version
IgH EtherCAT master 1.5.3 1.5.3
# Check master status
❯ systemctl status ethercat
# Check device
❯ ethercat slave
0 0:0 PREOP + BrainCo-Revo2Slave
# SDO - Read firmware version
❯ ethercat upload -t string -p 0 0x8000 0x11 # Wrist FW version
0.0.4
❯ ethercat upload -t string -p 0 0x8000 0x13 # CTRL FW version
0.0.4
# PDO - Read joint position
❯ ethercat upload -t raw -p 0 0x6000 0x01 | xxd -r -p | od -An -t u2 --endian=little -w2
# Set permissions for Python program
sudo setcap cap_sys_nice,cap_net_raw=eip /path/to/miniconda3/envs/py310/bin/python3.10About EtherCAT Version
- Recommended Version: igH EtherCAT Master 1.6.x (latest stable)
- SDK Compatibility: SDK is compiled for 1.6.x by default
- Version 1.5.x: If you're using 1.5.x, please contact technical support for compatible version
- Pure C++ Implementation: Recommended Pure C++ EtherCAT Examples (SDK-independent, uses EtherCAT library directly)
PDO Communication
SDO Communication
Firmware Upgrade
API Reference
For API lookup and code completion, use the complete type stub generated for SDK 2.x.
View Python type stub (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 Quick Reference
Connection Management (Recommended)
| API | Description |
|---|---|
libstark.auto_detect() | Auto-detect devices (all protocols) ⭐ |
libstark.init_from_detected() | Initialize from detected device ⭐ |
libstark.close_device_handler() | Close device connection (unified) ⭐ |
libstark.list_zqwl_devices() | List ZQWL CAN/CANFD devices ⭐ |
libstark.init_zqwl_canfd() | Initialize ZQWL CANFD device |
libstark.init_zqwl_can() | Initialize ZQWL CAN 2.0 device |
libstark.close_zqwl() | Close ZQWL device |
Connection Management (Legacy)
| API | Description |
|---|---|
libstark.get_sdk_version() | Get SDK version |
libstark.list_available_ports() | List available serial ports |
libstark.modbus_open() | Open Modbus connection |
libstark.modbus_close() | Close Modbus connection |
libstark.init_device_handler() | Create device handler |
device.close() | Close device connection |
libstark.auto_detect_device() | Auto-detect device (Modbus only) |
libstark.auto_detect_modbus_revo2() | Auto-detect Revo 2 device (Modbus only) |
Device Information
| API | Description |
|---|---|
device.get_device_info() | Get complete device information |
device.is_touch_hand() | Check if touch-enabled ⭐ |
device.uses_revo1_motor_api() | Check if uses Revo 1 Motor API ⭐ |
device.uses_revo2_motor_api() | Check if uses Revo 2 Motor API ⭐ |
device.uses_pressure_touch_api() | Check if uses Pressure Touch API ⭐ |
device.get_device_sn() | Get device serial number |
device.get_device_fw_version() | Get firmware version |
device.get_sku_type() | Get SKU type |
device.get_serialport_cfg() | Get serial port configuration |
device.get_canfd_baudrate() | Get CANFD baud rate |
device.set_serialport_baudrate() | Set baud rate |
device.set_slave_id() | Set slave ID |
Device Configuration
| API | Description |
|---|---|
device.get_force_level() | Get force level |
device.set_force_level() | Set force level |
device.get_auto_calibration_enabled() | Get auto-calibration status |
device.set_auto_calibration() | Set auto-calibration |
device.calibrate_position() | Manual position calibration |
device.get_turbo_mode_enabled() | Get turbo mode status |
device.set_turbo_mode_enabled() | Set turbo mode |
device.get_turbo_config() | Get turbo configuration |
device.set_turbo_config() | Set turbo configuration |
device.reset_default_gesture() | Reset to default gestures |
device.reset_default_settings() | Reset to default settings |
device.reboot() | Reboot device |
Motor Control - Position (Unified Range 0-1000)
| API | Description |
|---|---|
device.set_finger_position() | Set single finger position |
device.set_finger_position_with_millis() | Set position with duration ⭐ |
device.set_finger_position_with_speed() | Set position with speed ⭐ |
device.set_finger_positions() | Set all finger positions |
device.set_finger_positions_and_durations() | Set positions with durations ⭐ |
device.set_finger_positions_and_speeds() | Set positions with speeds ⭐ |
device.get_finger_positions() | Get all finger positions |
Motor Control - Speed (Unified Range -1000~+1000)
| API | Description |
|---|---|
device.set_finger_speed() | Set single finger speed |
device.set_finger_speeds() | Set all finger speeds |
device.get_finger_speeds() | Get all finger speeds |
Motor Control - Current (Unified Range -1000~+1000)
| API | Description |
|---|---|
device.set_finger_current() | Set single finger current |
device.set_finger_currents() | Set all finger currents |
device.get_finger_currents() | Get all finger currents |
Motor Control - PWM (Unified Range -1000~+1000) ⭐
| API | Description |
|---|---|
device.set_finger_pwm() | Set single finger PWM |
device.set_finger_pwms() | Set all finger PWMs |
Motor Status
| API | Description |
|---|---|
device.get_motor_status() | Get comprehensive motor status |
device.get_motor_state() | Get motor running state |
Motor Settings ⭐
| API | Description |
|---|---|
device.get_finger_unit_mode() | Get unit mode |
device.set_finger_unit_mode() | Set unit mode |
device.get_all_finger_settings() | Get all finger settings |
device.get_finger_settings() | Get single finger settings |
device.set_finger_settings() | Set single finger settings |
device.get_finger_min_position() | Get minimum position limit |
device.set_finger_min_position() | Set minimum position limit |
device.get_finger_max_position() | Get maximum position limit |
device.set_finger_max_position() | Set maximum position limit |
device.get_finger_max_speed() | Get maximum speed limit |
device.set_finger_max_speed() | Set maximum speed limit |
device.get_finger_max_current() | Get maximum current limit |
device.set_finger_max_current() | Set maximum current limit |
device.get_finger_protected_current() | Get protected current |
device.set_finger_protected_current() | Set protected current |
device.get_finger_protected_currents() | Get all protected currents |
device.set_finger_protected_currents() | Set all protected currents |
device.get_thumb_aux_lock_current() | Get thumb aux lock current |
device.set_thumb_aux_lock_current() | Set thumb aux lock current |
Touch Sensors
| API | Description |
|---|---|
device.get_touch_sensor_enabled() | Get touch sensor enabled status |
device.get_touch_sensor_fw_versions() | Get touch sensor firmware versions |
device.get_touch_sensor_raw_data() | Get touch raw data |
device.get_touch_sensor_status() | Get touch sensor status |
device.get_single_touch_sensor_status() | Get single sensor status |
device.touch_sensor_setup() | Setup touch sensors |
device.touch_sensor_reset() | Reset touch sensors |
device.touch_sensor_calibrate() | Calibrate touch sensors |
Modulus Touch Sensors ⭐
| API | Description |
|---|---|
device.set_modulus_touch_data_type() | Set data type |
device.get_modulus_touch_data_type() | Get data type |
device.get_modulus_touch_summary() | Get touch summary |
device.get_single_modulus_touch_summary() | Get single finger summary |
device.get_modulus_touch_data() | Get detailed touch data |
device.get_single_modulus_touch_data() | Get single finger data |
Force3D Touch Sensors ⭐
| API | Description |
|---|---|
device.get_force3d_touch_summary() | Get 4-finger force summary (FxFyFz) |
device.get_force3d_finger_array() | Get full array data for single finger (31 channels) |
ArrayPressure Sensors ⭐
| API | Description |
|---|---|
device.get_array_pressure_touch_data() | Get full array pressure data |
device.set_array_pressure_sleep() | Set array sensor sleep status |
High-Performance Data Collection ⭐
| API | Description |
|---|---|
DataCollector.new_basic() | Create basic collector (motor only) |
DataCollector.new_capacitive() | Create capacitive touch collector |
DataCollector.new_pressure_summary() | Create pressure summary collector |
DataCollector.new_pressure_detailed() | Create pressure detailed collector |
DataCollector.new_pressure_hybrid() | Create hybrid mode collector |
DataCollector.new_force3d() | Create Force3D collector |
DataCollector.new_array_pressure() | Create ArrayPressure collector |
DataCollector.new_v3_basic() | Create Revo3 collector (motor only) |
DataCollector.new_v3_full() | Create Revo3 full collector |
collector.start() | Start data collection |
collector.stop() | Stop data collection |
collector.wait() | Wait for collection thread |
collector.is_running() | Check if running |
MotorStatusBuffer | Basic motor status buffer |
TouchStatusBuffer | Capacitive touch status buffer |
PressureSummaryBuffer | Pressure summary buffer |
PressureDetailedBuffer | Pressure detailed buffer |
V3MotorStatusBuffer | Revo3 motor status buffer |
V3TouchDataBuffer | Revo3 touch data buffer |
Force3DTouchDataBuffer | Force3D properties buffer |
ArrayPressureTouchDataBuffer | ArrayPressure buffer |
LED, Buzzer, Vibration ⭐
| API | Description |
|---|---|
device.get_led_enabled() | Get LED enabled status |
device.set_led_enabled() | Set LED enabled status |
device.get_buzzer_enabled() | Get buzzer enabled status |
device.set_buzzer_enabled() | Set buzzer enabled status |
device.get_vibration_enabled() | Get vibration enabled status |
device.set_vibration_enabled() | Set vibration enabled status |
Action Sequences
| API | Description |
|---|---|
device.get_action_sequence() | Get action sequence |
device.transfer_action_sequence() | Upload action sequence |
device.save_action_sequence() | Save action sequence to flash |
device.run_action_sequence() | Execute action sequence |
device.clear_action_sequence() | Clear custom action sequence |
EtherCAT Specific ⭐
| API | Description |
|---|---|
device.ec_setup_sdo() | Setup SDO |
device.ec_reserve_master() | Reserve master |
device.ec_start_loop() | Start cyclic loop |
device.ec_stop_loop() | Stop cyclic loop |
device.ec_start_dfu() | Start firmware upgrade |
Firmware Upgrade
| API | Description |
|---|---|
device.start_dfu() | Start firmware upgrade |
Communication Callbacks
| API | Description |
|---|---|
libstark.set_modbus_read_holding_callback() | Set Modbus read holding callback |
libstark.set_modbus_read_input_callback() | Set Modbus read input callback |
libstark.set_modbus_write_callback() | Set Modbus write callback |
libstark.set_can_rx_callback() | Set CAN RX callback |
libstark.set_can_tx_callback() | Set CAN TX callback |
⭐ Indicates Revo2-specific or enhanced features