dexcelbot_apexhand_sdk 提供了用于控制 DexcelBot ApexHand 机械手 的官方 Python 接口,封装了底层 C++/pybind11 SDK,并对常用的控制与回调做了高层封装,便于在科研、教学与工业应用中快速集成。
JointStates、电机状态 MotorStates 以及触觉传感图像 HandSensorImage。move_jointmove_j_position_followregister_servo_joint_control_callbackMaxJointSpeedMaxJointAccelMaxFingerTorqueregister_hardware_error_event_callback所有底层枚举与结构体(例如 LogLevel、ConnectionType、ErrorCode、JointId 等)都通过 pybind11 从原生 _dexcelbot_sdk 动态导出,可直接在 Python 中查看与使用。
典型的 ApexHand 控制流程如下:
from dexcelbot_apexhand_sdk import (
DexcelBot,
ConnectionType,
ErrorCode,
JointId,
create_joint_control_param,
)
bot = DexcelBot()
# 1. 连接机械手
result = bot.connect("192.168.0.102", ConnectionType.CONNECTION_TYPE_ETHERNET)
if result != ErrorCode.ERROR_CODE_OK:
raise RuntimeError(f"Connect failed: {result}")
# 2. 使能所有手指
bot.set_all_fingers_enabled()
# 3. 控制一个关节
cmd = create_joint_control_param(
joint_id=JointId.JOINT_ID_THUMB_MCP,
position=0.5,
velocity=0.1,
acceleration=0.0,
)
bot.move_joint([cmd])
# 4. 断开连接
bot.disconnect()
在接下来的章节中,你将看到: