Get SDK
This page targets Revo 2. The public example repository for Revo 1 and Revo 2 is brainco-hand-sdk, while the Python wheel package is bc-stark-sdk; this page uses wheel version 2.0.3. Device IDs, default baud rates, protocols, and capabilities differ by model, so confirm the device and connection settings before running an example.
System Requirements
- Python: 3.9 ~ 3.12
- Linux: Ubuntu 20.04/22.04 LTS (x86_64/aarch64), glibc ≥ 2.31
- macOS: 10.15+
- Windows: 10/11
Supported Communication Protocols
| Device | RS-485 | Protobuf | CAN | CAN FD | EtherCAT |
|---|---|---|---|---|---|
| Revo 1 | ✅ | ✅ | ✅ | ❌ | ❌ |
| Revo 2 | ✅ | ❌ | ✅ | ✅ | ✅ |
Download & Installation
Public example repository
Open the brainco-hand-sdk example repository
Python SDK Installation
# Install from PyPI
pip3 install bc-stark-sdk==2.0.3
# China mirror (Alibaba Cloud OSS)
bash install_whl.sh 2.0.3Example Code
Run an example
After cloning the repository and installing the Python or C++ dependencies, run read-only discovery first. Then select a control example that matches the Revo 2 protocol.
Linux device setup
When using CAN FD or Modbus RTU on Linux hosts, verify the required device permissions and latency settings:
- CAN Network Setup: Bring up the SocketCAN interface at 1M standard / 2M data baudrate:bash
sudo ip link set can0 up type can bitrate 1000000 dbitrate 2000000 fd on - FTDI Serial Latency: If using an RS-485 serial connection, enable low latency mode when shorter query cycles are required:bash
sudo setserial /dev/ttyUSB0 low_latency
1. Python Demos
Navigate into python/demo/ to execute baseline control and multidimensional sensor collection:
cd python/demo
# Run the automated protocol & baudrate sweep scanner
python auto_detect.py
# Run the Revo 1/2 comprehensive control demo
python hand_demo.py
python hand_demo.py -m /dev/ttyUSB0 460800 127 # Modbus
python hand_demo.py -c /dev/cu.usbmodem14201 1000000 1 # ZQWL CAN 2.0
python hand_demo.py -f /dev/cu.usbmodem14201 1000000 5000000 127 # ZQWL CANFD
python hand_demo.py -B can0 127 # SocketCAN CANFD (Linux, SDK built-in)
# Run the real-time data monitor
python hand_monitor.py
# Run the firmware upgrade tool
python hand_dfu.py /path/to/firmware.binPython Output Excerpt
The following is a sanitized excerpt from SDK runtime logs. Port names, IDs, serial numbers, firmware versions, and sensor values vary by device:
$ python auto_detect.py
2026-03-26T11:22:15.993405Z [INFO] 🔍 Auto-detect: scan_all=false, port=None, protocol=None
2026-03-26T11:22:16.006330Z [INFO] 🔍 Trying Modbus on /dev/tty.usbserial-21100...
2026-03-26T11:22:16.006417Z [INFO] 🔍 Trying Modbus on /dev/tty.usbserial-21100 at Baud460800...
2026-03-26T11:22:16.343617Z [INFO] TouchVendor for slave 127: ArrayPressure
2026-03-26T11:22:16.344213Z [INFO] DeviceInfo: "{\"sku_type\":\"MediumRight\",\"hardware_type\":\"Revo2TouchArrayPressure\",\"serial_number\":\"<device serial>\",\"firmware_version\":\"<firmware version>\"}"
2026-03-26T11:22:16.344343Z [INFO] ✅ Found Modbus device: port=/dev/tty.usbserial-21100, ID=0x7F, baudrate=Baud460800, hw=Revo2TouchArrayPressure
2026-03-26T11:22:16.848082Z [INFO] ✅ Auto-detect: Found 1 device(s)
2026-03-26T11:22:16.867287Z [INFO] Initialized context for Revo2TouchArrayPressure device (slave 0x7F)
Found 1 device(s)
----------------------------------------------------------------------
[Device 1] Revo2 Touch Array Pressure
Protocol: Modbus
Port: /dev/tty.usbserial-21100
Slave ID: 0x7F (127)
Baudrate: 460800
Serial: <device serial>
Firmware: <firmware version>
SKU: MediumRight$ python hand_demo.py
[Init] Revo2Touch
Protocol: StarkProtocolType.Modbus
Port: /dev/tty.usbserial-21100
Slave ID: 0x7F (127)
Serial: <device serial>
Firmware: <firmware version>
=== Demo 3: Advanced Control (Position + Time/Speed) ===
Position with duration (1000ms)...
Position with speed...
Final positions: [0, 0, 0, 0, 0, 0]2. C++ Demos
Compile and execute cross-platform C++ programs under c/:
cd c
make
# Run the target Modbus register scanner
./demo/auto_detect.exe
# Run the Revo 2 comprehensive control demo
./demo/hand_demo.exe
./demo/hand_demo.exe -m /dev/ttyUSB0 460800 127 # Modbus
./demo/hand_demo.exe -c /dev/cu.usbmodem14201 1000000 1 # ZQWL CAN 2.0
./demo/hand_demo.exe -f /dev/cu.usbmodem14201 1000000 5000000 127 # ZQWL CANFD
./demo/hand_demo.exe -B can0 127 # SocketCAN CANFD (Linux, SDK built-in)C++ Output Excerpt
The following reflects the output structure from the c/demo example source. Port names, IDs, serial numbers, firmware versions, and sensor values vary by device:
$ ./demo/auto_detect.exe
=== Stark Auto-Detect Example ===
[INFO] Auto-detecting devices...
[INFO] Found devices:
[1] Revo2Touch
Protocol: CANFD
Port: /dev/ttyUSB0
Slave ID: 0x7F (127)
Serial Number: <device serial>
Firmware: <firmware version>
[INFO] Using the only available device
Slave[127] Serial Number: <device serial>, FW: <firmware version>
Hardware Type: Revo2Touch (6)
Slave[127] Baudrate: 460800
=== Testing Finger Control ===
Closing pinky...
Opening pinky...
Final positions: 0, 0, 0, 0, 0, 0
=== Example completed ===$ ./demo/hand_demo.exe -f /dev/ttyUSB0 1000000 5000000 127 3
=== Universal Motor Control - Complete Demo ===
[Init] Mode: ZQWL CANFD
Port: /dev/ttyUSB0, Arb: 1000000, Data: 5000000, Slave ID: 127
Slave[127] Serial Number: <device serial>, FW: <firmware version>
Hardware Type: Revo2Touch (6)
[INFO] Motor API: Revo2
[INFO] Touch type: Revo2Touch
=== Demo 3: Advanced Control (Revo2 Only) ===
[Demo] Setting unit mode to Normalized...
Current mode: Normalized
[Demo] Position + time control (single finger)...
[Demo] Position + speed control (single finger)...
[Demo] Position + duration control (all fingers)...
[INFO] Done!Advanced Reference
Interface Definition Files
For API lookup and code completion, download the following interface definition files:
- Python type stub (.pyi): Download main_mod.pyi — type annotations for classes, enums, and functions in
bc_stark_sdk.main_mod. - C/C++ header (.h): Download stark-sdk.h — the C ABI export header from the
bc-stark-sdk(v2.x) package.
SDK Repository Notes
brainco-hand-sdk now targets Revo 1 / Revo 2 examples only. Revo 3 SDK support has moved to the dedicated brainco-revo3-sdk repository. The legacy linux/ and windows/ examples have been archived under archive/; new integrations should use the unified python/demo/ and c/demo/ entry points.
Release Notes
v2.0.3 (2026/07)
- Current public release on PyPI and the version used by the public
brainco-hand-sdkexamples. - Added 4 Mbps and 6 Mbps baud-rate support.
- Updated Python example packaging and installation instructions for
pip, Conda, anduvworkflows. - Updated ZQWL CAN/CAN FD initialization in the public examples to use the protocol-specific initialization APIs.
v2.0.2 (2026/05)
Repository Changes
- Revo 3 SDK has moved to the standalone
brainco-revo3-sdkrepository. brainco-hand-sdknow contains Revo 1 / Revo 2 examples and prebuilt libraries only.- Python wheels upgraded to
cp39-abi3stable ABI; Python 3.8 is no longer supported.
Fixes
- Added multi-channel, multi-protocol (CAN 2.0 / CANFD) auto-detection for BrainCo USBCANFD adapters.
- Fixed manual motor calibration failure on Revo 2.
- C/C++ ABI change (since 2.0.0):
Baudrateenum values reordered (e.g.,BAUD5MBPSchanged from 6 to 7).
v1.4.0 (2026/04/15)
New Tactile Device Types
- Added ArrayPressure Touch (
Revo2TouchArrayPressure) — 3D force & torque data collection (Fx, Fy, Fz, Mx, My) viaArrayPressureTouchDataBuffer - C++ demos:
hand_demoandhand_monitorwitharray_pressuremode - Python GUI: 2D vector compass visualization for force/torque data
- Touch type detection APIs:
is_capacitive_touch()— Capacitive touch (Revo1/Revo2 Touch)is_pressure_touch()— Piezoresistive pressure touchis_force3d_touch()— 3-axis force touchis_array_pressure_touch()— Array piezoresistive touch
Python GUI
- Touch panels: heatmap visualization with capacitive/piezoresistive/Force3D/ArrayPressure/VisionTouch support
- Timing test with Revo2 workers and dynamic frequency switching
- i18n support (EN/ZH)
SDK & API Changes
- New hardware types:
Revo2TouchForce3D,Revo2TouchArrayPressure - New APIs:
uses_array_pressure_touch_api()
🐛 Bug Fixes
- Fixed CAN error frame handling and auto-detect protocol dispatch
- Added
CAN_ERR_FLAGcheck in SocketCANrecv_can/recv_canfd
📚 Documentation & Project Structure
- Archived deprecated
linux/andwindows/folders toarchive/ - Added
install_whl.shscript for Python wheel installation
v1.1.9 (2026/03/03)
🔧 Improvements
- Added 150ms warm-up delay after port open to improve Modbus auto-detection reliability on first attempt
📚 New Examples
c/demo/debug_detect.cpp— C++ debug tool for Modbus register inspection and raw Protobuf auto-detection
v1.1.6 (2026/02/28)
🚀 New Features
- Auto-detection now supports BrainCo USBCANFD adapter
v1.1.5 (2026/02/09)
🐛 Bug Fixes
- Fixed CANFD boundary check issue
- SocketCAN scan now iterates all interfaces
🚀 New Features
- SocketCAN Python bindings (
init_socketcan_canfd,close_socketcan,socketcan_scan_devices) - Device context query APIs:
stark_get_protocol_type,stark_get_port_name,stark_get_baudrate, etc. - CAN device initialization:
init_device_handler_can()/init_device_handler_can_with_hw_type() StarkProtocolType::Auto = 0enum value for auto-detecting all protocols
🔧 Example Improvements
- Runtime CAN backend selection, new communication frequency test utilities
v1.1.3 (2026/02/06)
🚀 New Features
- Built-in SocketCAN Support (Linux) - No external code required
- Protobuf Protocol Support - Revo 1 serial protocol, baud rate 115200, Slave ID 10-254
v1.1.0 (2025/02/05)
🚀 New Features
- Built-in ZQWL CAN adapter support (Linux / macOS / Windows, no extra DLL needed)
- Unified device auto-detection API:
auto_detect()→init_from_detected()→close_device_handler() - Stark 1.8 tactile support (RS-485 / CAN protocols)
- Cross-platform C++ examples (
c/demo/) - Python GUI debugging tools (motor control, tactile data, waveform monitoring)
⚠️ Breaking Changes
- Hardware type enum refactored, added
Revo1Advanced/Revo1AdvancedTouch - API renamed:
is_revo1()→uses_revo1_motor_api(),is_revo2()→uses_revo2_motor_api() - Initialization split:
init_config()→init_logging()+init_device_handler() - C structs prefixed with
C(e.g.,MotorStatusData→CMotorStatusData) linux/andwindows/example directories deprecated, migrate toc/
📚 Migration Guide
See CHANGELOG.md
v1.0.6 (2025/01/26)
🚀 New Features
- New Hardware: Revo1Advanced (
BCMEL/BCMER), Revo1AdvancedTouch (BCMTL2/BCMTR2) - Auto Serial Detection: Hardware type auto-detection by serial number prefix
- Status Reading Optimization: Multi-threaded collection, passive reading, improved performance
- SocketCAN Support: New SocketCAN backend for Linux
- Auto-Detection Enhancement: Multi-port traversal, protocol auto-recognition, Quick/Full scan modes
🐛 Bug Fixes
- Fixed physical quantity mode 1000x scaling issue
- Fixed RS-485 firmware upgrade baud rate detection
📚 Examples
- Added
revo2_touch_collector.pymotor/tactile status example - Added
revo2_timing_test_gui.pytiming test GUI tool
⚠️ Note
- Revo1Advanced devices should use examples from
revo2directory
v1.0.1 (2025/12/23)
🚀 New Features
- Support for EtherCAT multi-slave communication
v1.0.0 (2025/12/08)
🎉 Official Release
- Detail optimizations and official upgrade to version 1.0
v0.9.9 (2025/11/19)
🚀 New Features
- Support for Revo 1 Advanced version devices ⭐
- Unified control parameter ranges: 0~1000 for position, -1000~+1000 for speed/current/PWM
- Applicable to all Modbus, CANFD, and CAN2.0 communication protocols
⚠️ Important Notice
- Revo 1 Advanced version requires SDK v0.9.9 or higher
v0.9.8 (2025/11/04)
🚀 New Features
- CAN/CANFD Protocol: Complete Revo 2 CAN2.0/CANFD communication stack
- ZLG CAN Support: Python interface (Windows/Linux) with driver library
- CANFD Chunked R/W: Support for large data transfer (>29 registers)
- EtherCAT Tactile: Tactile sensor data collection (PDO/SDO)
- Pressure Tactile: EtherCAT/CANFD/RS-485 multi-protocol support
- Protected Current: ProtectedCurrent R/W for CAN/EtherCAT
- Action Sequence:
run_action_sequencefor CAN 2.0 - Device Type Detection: Serial number based (
get_hardware_by_sn) - Multi-Device Support: Revo1/Revo2 mixed usage
⚡ High-Frequency Communication Optimization
- C/C++ Async Calls:
setcommands now async, non-blocking - High-Freq No Retry:
get/set_finger_*, tactile reads - prevents command queue buildup - Low-Freq Retry Reduced: Device info reads reduced to 2 retries
🐛 Bug Fixes
- Fixed TurboConfig byte order, Modbus C API async calls, OTA package size handling
v0.9.0 (2025/09/20)
🚀 New Features
- Added CAN2.0 protocol support for second-generation dexterous hand
- Added EtherCAT protocol support for second-generation dexterous hand tactile version
🐛 Bug Fixes
- Fixed known issues and improved stability
v0.8.8 (2025/09/02)
🚀 New Features
- Added CAN2.0 protocol support for second-generation dexterous hand
v0.8.6 (2025/08/20)
🚀 New Features
- Added CAN2.0 protocol support for first-generation dexterous hand
🔧 API Improvements
- Function naming optimization:
modbus_→stark_(more universal prefix for CANFD and EtherCAT)create_device_handler()updated naming to avoid ambiguitycanfd_init(uint8_t master_id)updated naming to avoid ambiguityinit_cfgno longer requires firmware type, automatically obtained viaget_device_infointerface
📚 Example Code
- ROS 2 examples added CAN/CANFD support
- New CAN/CANFD C++ examples
v0.7.8 (2025/07/31)
🚀 New Features
- EtherCAT firmware added DC synchronization functionality
v0.7.3 (2025/07/28)
🐛 Bug Fixes
- Fixed protocol MasterID configuration in CANFD communication
- Fixed PDO reading position issue in EtherCAT communication
- Fixed error in MotorStatusData description field
v0.7.0 (2025/07/18)
🚀 New Features
- Auto-detection of Modbus slave baud rate and device ID
- Second-generation dexterous hand tactile version interface support
🐛 Bug Fixes
- Fixed DFU firmware upgrade issues
v0.6.2 (2025/07/14)
🚀 New Features
- EtherCAT Protocol Support: Second-generation dexterous hand supports EtherCAT high-speed communication
- Extended RS485 Baud Rates: Added 1M, 2M, and 5M baud rate options for high-performance applications
- Linux Serial Port Optimization: LOW_LATENCY mode enabled by default, 400% communication frequency improvement at 460800 baud
🔧 API Improvements
- Refactored device context naming:
ModbusContext→DeviceContext(more universal device context)ModbusHandler→DeviceHandler(unified device operation interface)
🛠 Development Tools
- Integrated
python-stub-gentoolchain for automatic type stub file (.pyi) generation, enhancing IDE intellisense and type checking
⚠️ Compatibility Notice
- Please note API naming changes when migrating from older versions
v0.5.3 (2025/06/12)
🚀 New Features
- Custom Modbus read/write interfaces
- Action sequence control
- LED, buzzer, vibration motor control
🐛 Bug Fixes
- Fixed real-time position/speed/current return value errors
v0.4.5 (2025/05/14)
🚀 New Features
- Added
get_single_touch_statusfor single-finger touch detection
🔧 Improvements
- Simplified
modbus_openfunction, removed redundant parameters
v0.4.4 (2025/05/06)
🚀 New Features
- Added CANFD protocol support
🐛 Bug Fixes
- Fixed multiple known issues, improved stability
v0.3.6 (2025/04/16)
🎉 Milestone
- First support for Gen 2 dexterous hand
- Established basic communication framework
v0.1.9 (2025/03/17)
📌 Initial Release
- Modbus communication protocol
- Python / C code integration
- SDK architecture