Skip to content

C++ SDK - Revo 1 Dexterous Hand

System Requirements

  • Linux: Ubuntu 20.04/22.04 LTS (x86_64/aarch64), glibc ≥ 2.31
  • macOS: 10.15+
  • Windows: 10/11

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 & Configuration

shell
# Install dependencies
# Required: build-essential, cmake, make, gcc, g++, etc.

# Install SDK dependencies
./download-lib.sh

# Configure device permissions
# In Linux, serial devices (e.g., /dev/ttyUSB0) typically belong to dialout or tty group
# Only group members can access the device, for example:
# crw-rw---- 1 root dialout 188, 0 Aug 14 12:00 /dev/ttyUSB0

# 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

# Build and run example (unified cross-platform directory)
cd c && make
cd demo && ./hand_demo.exe    # Auto-detect device and run
shell
# Install Xcode or Xcode Command Line Tools
xcode-select --install

# Install SDK dependencies
./download-lib.sh

# Build and run example (unified cross-platform directory)
cd c && make
cd demo && ./hand_demo.exe    # Auto-detect device and run
shell
# Requires MinGW or MSVC build environment

# Install SDK dependencies
./download-lib.sh

# Build and run example (unified cross-platform directory)
cd c && make
cd demo && hand_demo.exe      # Auto-detect device and run

Example Code

The SDK provides comprehensive example code covering different communication protocols and application scenarios.

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

shell
cd c
make
cd demo
./hand_demo.exe       # Auto-detect device and run demo
ExampleDescription
hand_demo.cppComprehensive demo (8 modes: position/speed/current control, action sequences, touch sensors, etc.)
hand_monitor.cppReal-time data monitor (motor status, touch data)
hand_dfu.cppFirmware upgrade
auto_detect.cppDevice auto-detection

Supported initialization methods:

shell
./hand_demo.exe                                          # Auto-detect (recommended)
./hand_demo.exe -m /dev/ttyUSB0 115200 1                 # Modbus
./hand_demo.exe -p /dev/ttyUSB0 10                       # Protobuf
./hand_demo.exe -c /dev/cu.usbmodem14201 1000000 1       # CAN 2.0 (ZQWL)
./hand_demo.exe -s can0 1                                # SocketCAN CAN 2.0 (external adapter)
./hand_demo.exe -b can0 1                                # SocketCAN CAN 2.0 (SDK built-in)

Legacy Protocol Examples (Archived)

⚠️ The following examples have been archived to archive/. We recommend using the Cross-Platform Examples (c/demo/) above, which support auto-detection of multiple protocols and devices.

Modbus-RTU Protocol

Tactile Sensor

CAN 2.0 Protocol

API Reference

For C/C++ API lookup, use the complete C ABI header bundled with the bc-stark-sdk (v2.x) package: Download stark-sdk.h. The quick reference below covers the most commonly used APIs.

API Quick Reference

Initialization and Configuration

APIDescription
init_logging()Initialize SDK logging

Connection Management

APIDescription
stark_auto_detect()Auto-detect devices (recommended, all protocols)
init_from_detected()Initialize device from detection result
close_device_handler()Close device connection (recommended)
list_zqwl_devices()List ZQWL CAN adapters
init_zqwl_can()Initialize ZQWL CAN adapter
close_zqwl()Close ZQWL adapter
modbus_open()Open Modbus connection
modbus_close()Close Modbus connection
init_device_handler()Create device handler (CAN/CANFD, manual adapter management)
init_device_handler_with_hw_type()Create device handler with pre-set hardware type (skip get_device_info) ⭐
auto_detect_device()Auto-detect device (deprecated)
auto_detect_modbus_revo1()Auto-detect Revo 1 device (deprecated)
list_available_ports()List available serial ports

Device Information

APIDescription
stark_get_device_info()Get complete device information
stark_get_device_sn()Get device serial number
stark_get_device_fw_version()Get firmware version
stark_get_sku_type()Get SKU type
stark_get_voltage()Get battery voltage
stark_get_serialport_cfg()Get serial port configuration
stark_set_serialport_baudrate()Set baud rate
stark_set_slave_id()Set slave ID

Device Configuration

APIDescription
stark_get_force_level()Get force level
stark_set_force_level()Set force level
stark_get_auto_calibration_enabled()Get auto-calibration status
stark_set_auto_calibration()Set auto-calibration
stark_calibrate_position()Manual position calibration
stark_get_turbo_mode_enabled()Get turbo mode status
stark_set_turbo_mode_enabled()Set turbo mode
stark_get_turbo_config()Get turbo configuration
stark_set_turbo_config()Set turbo configuration
stark_reboot()Reboot device

Device Type Checking

APIDescription
stark_is_touch_device()Check if device has touch sensors
stark_uses_revo1_motor_api()Check if uses Revo 1 Motor API
stark_uses_revo1_touch_api()Check if uses Revo 1 Touch API
stark_uses_revo2_touch_api()Check if uses Revo 2 Touch API
stark_uses_pressure_touch_api()Check if uses Pressure Touch API
stark_get_touch_sensor_type()Get touch sensor type

Motor Control - Position

APIDescription
stark_set_finger_position()Set single finger position (0~1000)
stark_set_finger_positions()Set all finger positions
stark_get_finger_positions()Get all finger positions

Motor Control - Speed

APIDescription
stark_set_finger_speed()Set single finger speed (-1000~+1000)
stark_set_finger_speeds()Set all finger speeds
stark_get_finger_speeds()Get all finger speeds

Motor Control - Current

APIDescription
stark_set_finger_current()Set single finger current (-1000~+1000)
stark_set_finger_currents()Set all finger currents
stark_get_finger_currents()Get all finger currents

Motor Status

APIDescription
stark_get_motor_status()Get comprehensive motor status
stark_get_motor_state()Get motor running state

Touch Sensors

APIDescription
stark_get_touch_sensor_enabled()Get touch sensor enabled status
stark_get_touch_sensor_fw_versions()Get touch sensor firmware versions
stark_get_touch_sensor_raw_data()Get touch raw data
stark_get_touch_sensor_status()Get touch sensor status
stark_touch_sensor_setup()Setup touch sensors
stark_touch_sensor_reset()Reset touch sensors
stark_touch_sensor_calibrate()Calibrate touch sensors

LED and Button

APIDescription
stark_get_led_info()Get LED status
stark_set_led_info()Set LED status
stark_get_button_event()Get button event

Action Sequences

APIDescription
stark_get_action_sequence()Get action sequence
stark_transfer_action_sequence()Upload action sequence
stark_run_action_sequence()Execute action sequence

Firmware Upgrade

APIDescription
stark_start_dfu()Start firmware upgrade
Help