@midscene/arm-kit
v0.1.1
Published
Keywords
Readme
Arm Kit
English / 简体中文
@midscene/arm-kit provides the controller and adapter API for integrating custom robot arms with Midscene. ArmController manages one physical arm and queues operations for touchscreen devices that share it.
Implement an adapter
Import RobotArmAdapter, RobotDriver, and RobotKinematics from @midscene/arm-kit/adapter-development. A RobotArmAdapter combines a vendor-specific driver with the identity, geometry, and readiness information the controller needs.
- Set
contractVersionto1and provide anid,name, andconnectionIdentity. Use a stable connection identity for the physical controller. Inkinematics, describe the joint order and units, Cartesian axes, and supported orientation (fixed,yaw, orfull). Supply afixedOrientationreference quaternion forfixedoryaw, and include joint and workspace limits where available. - Implement
connect(),disconnect(),getState(), andstop()ondriver. Report connection, enablement, motion, and faults from controller telemetry. Mark stale samples and preserve their original IDs and timestamps. UsereadinessPolicyto declare the maximum sample age and the status fields that must be known before motion. - For touchscreen control, implement
moveLinear()andreadPose(). Declare the accepted speed and acceleration ranges inmotionLimits.linear. Add optional methods for features the arm supports, such asmovePtp()withmotionLimits.ptp, orstartJog()andstopJog()together. Convert vendor units at the driver boundary. ACartesianPoseuses the robot base frame, millimetres, and a quaternion. Joint values use degrees for revolute joints and millimetres for prismatic joints. - Return a
MotionHandlefrom each move. UsecreateMotionHandle()with a promise that resolves once controller feedback confirms the terminal outcome. Confirm arrival before reportingcompleted. Implementstop()so it can stop a move in progress even if its waiter times out or is cancelled.
The DOBOT MG400 adapter shows pose conversion, telemetry, and completion checks. The fake adapter shows how to exercise the same contract with simulated hardware.
Connect the adapter
Create one ArmController per physical arm and share it across the devices that arm controls.
import { ArmController } from '@midscene/arm-kit';
import type { RobotArmAdapter } from '@midscene/arm-kit/adapter-development';
export async function checkConnection(adapter: RobotArmAdapter) {
const controller = new ArmController({ adapter });
try {
await controller.connect();
return await controller.getStatus();
} finally {
await controller.close();
}
}The MG400 service implementation shows how to use an adapter factory, keep the controller open, and serve its touchscreens over Midscene Connect.
To set up and calibrate a DOBOT MG400, see the MG400 device service README.
