Skip to content

Python SDK - Revo 1 Dexterous Hand

System Requirements

  • Linux: Ubuntu 20.04/22.04 LTS
  • macOS: 10.15+
  • Windows: 10/11
  • Python: 3.9 ~ 3.12 (Conda recommended)

Quick Start

Clone Repository

shell
git clone https://github.com/BrainCoTech/brainco-hand-sdk.git
shell
git clone git@github.com:BrainCoTech/brainco-hand-sdk.git

Installation 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 revo1
python revo1_ctrl.py          # Single hand control
python revo1_touch.py         # Tactile sensor (tactile version)
python revo1_ctrl_multi.py    # Multi-hand control
python revo1_action_seq.py    # Action sequence
python revo1_cfg.py           # Device configuration
python revo1_dfu.py           # Firmware upgrade
shell
# Installation steps same as Ubuntu
# Note: macOS serial device names are typically /dev/tty.usbserial-xxx
shell
# 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.

Sample Code

SDK provides rich sample code covering different communication protocols and application scenarios.

Unified cross-platform examples with automatic device detection and multi-protocol support.

ExampleDescription
hand_demo.pyComprehensive demo
hand_monitor.pyReal-time data monitoring
hand_dfu.pyFirmware upgrade

Modbus-RTU Protocol

Single Hand/Dual Hand Control

Tactile Sensor

Action Sequence (Gestures)

API Reference

For API lookup and code completion, use the complete type stub generated for bc-stark-sdk (v2.x): Download main_mod.pyi. The quick reference below covers the most commonly used APIs.

API Quick Reference

Connection Management

APIDescription
libstark.auto_detect()Auto-detect devices (recommended, all protocols)
libstark.init_from_detected()Initialize device from detection result
libstark.close_device_handler()Close device connection (recommended)
libstark.list_available_ports()List available serial ports
libstark.list_zqwl_devices()List ZQWL CAN adapters
libstark.modbus_open()Open Modbus connection
libstark.modbus_close()Close Modbus connection
libstark.init_device_handler()Create device handler (CAN/CANFD)
libstark.init_zqwl_can()Initialize ZQWL CAN adapter
libstark.auto_detect_device()Auto-detect device (deprecated)
libstark.auto_detect_modbus_revo1()Auto-detect Revo 1 device (deprecated)

Device Information

APIDescription
ctx.get_device_info()Get complete device information
ctx.get_device_sn()Get device serial number
ctx.get_device_fw_version()Get firmware version
ctx.get_sku_type()Get SKU type
ctx.get_voltage()Get battery voltage
ctx.get_serialport_cfg()Get serial port configuration
ctx.get_serialport_baudrate()Get baud rate
ctx.set_serialport_baudrate()Set baud rate
ctx.set_slave_id()Set slave ID

Device Configuration

APIDescription
ctx.get_force_level()Get force level
ctx.set_force_level()Set force level
ctx.get_auto_calibration_enabled()Get auto-calibration status
ctx.set_auto_calibration()Set auto-calibration
ctx.calibrate_position()Manual position calibration
ctx.get_turbo_mode_enabled()Get turbo mode status
ctx.set_turbo_mode_enabled()Set turbo mode
ctx.get_turbo_config()Get turbo configuration
ctx.set_turbo_config()Set turbo configuration
ctx.reset_default_gesture()Reset to default gestures
ctx.reset_default_settings()Reset to default settings
ctx.reboot()Reboot device

Device Type Checking

APIDescription
ctx.is_touch_hand()Check if device has touch sensors
ctx.uses_revo1_motor_api()Check if uses Revo 1 Motor API
ctx.uses_revo2_motor_api()Check if uses Revo 2 Motor API
ctx.uses_pressure_touch_api()Check if uses Pressure Touch API

Motor Control - Position

APIDescription
ctx.set_finger_position()Set single finger position (0~1000)
ctx.set_finger_positions()Set all finger positions
ctx.get_finger_positions()Get all finger positions

Motor Control - Speed

APIDescription
ctx.set_finger_speed()Set single finger speed (-1000~+1000)
ctx.set_finger_speeds()Set all finger speeds
ctx.get_finger_speeds()Get all finger speeds

Motor Control - Current

APIDescription
ctx.set_finger_current()Set single finger current (-1000~+1000)
ctx.set_finger_currents()Set all finger currents
ctx.get_finger_currents()Get all finger currents

Motor Status

APIDescription
ctx.get_motor_status()Get comprehensive motor status
ctx.get_motor_state()Get motor running state

Touch Sensors

APIDescription
ctx.get_touch_sensor_enabled()Get touch sensor enabled status
ctx.get_touch_sensor_fw_versions()Get touch sensor firmware versions
ctx.get_touch_sensor_raw_data()Get touch raw data
ctx.get_touch_sensor_status()Get touch sensor status
ctx.touch_sensor_setup()Setup touch sensors
ctx.touch_sensor_reset()Reset touch sensors
ctx.touch_sensor_calibrate()Calibrate touch sensors

LED and Button

APIDescription
ctx.get_led_info()Get LED status
ctx.set_led_info()Set LED status
ctx.get_button_event()Get button event

Action Sequences

APIDescription
ctx.get_action_sequence()Get action sequence
ctx.transfer_action_sequence()Upload action sequence
ctx.save_action_sequence()Save action sequence to flash
ctx.run_action_sequence()Execute action sequence
ctx.clear_action_sequence()Clear custom action sequence

Firmware Upgrade

APIDescription
ctx.start_dfu()Start firmware upgrade
Help