rebot-mcp
OfficialControl a reBot arm and its reCamera vision system through MCP, covering state monitoring, snapshots/detection, motion, gripper operation, poses, pick-and-place, safety, and device configuration.
Read arm state, including joints, TCP pose, torque, fault, lease, gripper, and latest action.
Capture camera JPEG snapshots, annotated snapshots, and run YOLO/ArUco detections.
Move the end-effector absolutely or relatively in base/tool/camera frames, and home or park the arm.
Open, close, or position the gripper, including grasp/contact reporting.
Save, list, and move to named joint-space poses; execute place operations at a pose or XYZ target.
Stop motion, trigger an emergency stop, enable torque, recover recoverable faults, and describe safety behavior.
Read or change persistent keep-out boxes and collision-guard settings.
Take or release the control lease when available; some faults and E-stops require human clearing in the web cockpit.
Provides YOLO-based object detection on fresh reCamera frames, returning normalized 2D bounding boxes through the detection and annotated-snapshot tools.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@rebot-mcp Take a snapshot and report any detected ArUco markers."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
rebot-companion
π€ Robot Arm Vision Companion Toolkit & MCP Server for AI Agents
Control a reBot arm from AI agents over MCP, with reCamera snapshots, detections and hand-eye calibration
English | δΈζ
Python SDK and stdio MCP server bridging Seeed reCamera (SG2002 RISC-V edge vision) and rebot-armd (Rust arm daemon).
rebot(arm-control core): standard library only, Python >= 3.8. TheArmclass for short programs meant to run unchanged on a PC and on the reCamera (see Write your own program), plus the armd protocol client and detection access underneath it.rebot_companion(SDK): rebot-armd client (re-exported fromrebot) (REST reads, WebSocket control lease, joint and Cartesian actions), reCamera ArUco trigger client, JPEG snapshots from the camera H.264 stream, B601-DM kinematics, hand-eye calibration, and a deterministic pick-and-place pipeline.rebot-mcp: a stdio MCP server that exposes the arm, snapshots and detections as tools to AI agents.
Key Features
Stdio MCP server for AI agents (
rebot-mcp): 24 tools by default (state, snapshots, detection, motion, gripper, stop, named poses, place, keep-out boxes, fault recovery, collision guard, safety description). Works with MCP clients that support stdio servers; end-to-end tests used the Pythonmcpclient against a real arm. Fault clearing and cockpit takeover are off unless enabled at launch (see MCP server).Hand-eye calibration: eye-to-hand (closed-form Horn point registration) and eye-in-hand (Park & Martin $AX=XB$), cross-checked against OpenCV
CALIB_HAND_EYE_PARKin the tests. Accuracy is verified on synthetic data only; it has not been measured on a real arm yet.Two stages: Stage 1, an agent orchestrates the tools; Stage 2, a deterministic local pick-and-place pipeline that needs no LLM.
Kinematics: full URDF forward kinematics (within 0.1 mm of an independent URDF parser in the tests) and an analytic planar inverse kinematics solver for the B601-DM.
reCamera integration:
rebot_companionand the MCP server run on a host; therebotpackage (standard library only) is meant to run on the camera as well (not yet run on the device). On-demand detection triggers (6-DoF ArUco marker poses, YOLO 2D boxes) and JPEG snapshots decoded on the host from the camera's H.264 stream.
This software moves a real arm. Read Safety before running anything that moves.
Related MCP server: computer-use
Contents
Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Host PC: rebot-companion (Python) β
β Stage 1: agent / script orchestration (rebot-mcp, ex. 03) β
β Stage 2: deterministic pipeline (pipeline.py, ex. 04) β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β HTTP / WebSocket
βΌ
ββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β rebot-armd (arm daemon) β reCamera services β
β REST + WS lease :8765 β rebot-vision HTTP :8090 β
β actions, limits, watchdog β H.264 WebSocket :8001 β
β detection API /api/v1/... β RTSP /live0 :8554 β
ββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββThe SDK does not run on the camera. The camera and armd provide single-purpose endpoints:
POST /api/trigger(rebot-vision, :8090): one detection, returns marker poses (x, y, z, roll, pitch, yaw).ws://<host>:8001/: H.264 stream;rebot_companion.snapshotdecodes one IDR frame to JPEG.rtsp://<host>:8554/live0(1280x720): used by the intrinsics tool.There is no HTTP snapshot endpoint on the device (
:80/snapshot.jpgredirects to the supervisor UI).ReCameraClient.get_snapshot()works only whensnapshot_url=is passed./api/v1/detection/*on armd: object detection (detect/snapshot_annotatedtools).
Two stages:
Stage 1: an agent (through
rebot-mcp) or a host script calls these APIs and decides what to do next.Stage 2: once calibration, poses and pick parameters are fixed,
DeterministicPickPlacePipelineruns the cycle without an LLM: trigger, transform, workspace check, leased motion.
Requirements
Hardware:
reBot B601-DM arm (armd uses a 7-joint vector: J1..J6 plus the gripper as index 6).
Seeed reCamera. The defaults assume the USB network address
192.168.42.1.An ArUco marker on the gripper (eye-to-hand) or in the scene (eye-in-hand) for hand-eye calibration and the pick pipeline.
Software on the devices:
rebot-armd, reachable over HTTP/WebSocket (default port 8765). The Cartesian move, gripper and action-status features need an armd build that serves
/api/v1/action/*and reportsactionin the observation;home/parkalso work with older builds.rebot-visionon the reCamera for marker triggers (part of therebot-teleoppackage, which also carries rebot-armd; no separate camera app is needed). The camera's own aruco-detector also works: its trigger needs a JSON body (aruco-detector >= 0.1.3 answers415otherwise; the SDK sends one) and distortion keys need aruco-detector >= 0.1.1.The SenseCraft solution
rebot_agent_arminstallsrebot-teleop, this MCP server and the calibration verify step.reboton the reCamera (the package targets Python 3.8 there) does not come from this project's wheel, which requires Python >= 3.10. A rebot-teleop deb built withREBOT_SDK_DIR=<rebot-companion checkout>carries therebot/folder in/usr/share/rebot-teleop/python, and its app runner puts that directory onPYTHONPATH. Without it, copy therebot/folder next to the program'smain.py.
Host:
Python >= 3.10 and uv for
rebot_companionand the MCP server. Therebotpackage alone needs Python >= 3.8 and no third-party packages.Snapshots: PyAV (in the
agentextra) or theffmpegbinary onPATH.Optional: Node.js, only to regenerate the JS reference values for the tests.
Install
git clone https://github.com/Seeed-Solution/rebot-companion
cd rebot-companion
uv sync # SDK only
uv sync --extra agent # + MCP server: mcp 2.x, av, pillow
uv sync --extra calib # + OpenCV for tools/calibrate_intrinsics.py
uv sync --extra record # + PyAV, pyarrow for rebot-record
uv sync --extra policy # + PyAV, pyarrow for rebot-policy (learned policies: see Run a learned policy)
uv sync --extra onnx # + onnxruntime for ONNX policies without PyTorch/LeRobot
uv sync --all-extras # everything (development)Extra | Packages | Needed for |
|
|
|
|
| camera intrinsics tool |
|
|
|
|
|
|
|
|
|
The test suite runs against the versions pinned in uv.lock (for example mcp 2.3.0).
Quickstart
Connect to armd, read the state, grab a snapshot, make a small move and park. Run it with
uv run --extra agent python quickstart.py. Keep the arm's workspace clear.
from rebot_companion import ArmdClient
from rebot_companion.snapshot import snapshot_once
arm = ArmdClient("http://192.168.42.1:8765")
# 1. State (REST, no lease needed). The MCP tool get_state returns the same data plus the host FK pose.
obs = arm.get_observation()
print(obs.safety_state, obs.is_torqued, [round(q, 3) for q in obs.positions])
# 2. Snapshot: waits for the next IDR frame on the camera stream (timeout 6 s).
snap = snapshot_once("ws://192.168.42.1:8001/", max_width=800)
open("snapshot.jpg", "wb").write(snap.jpeg)
# 3. Small move and park, inside a control lease (heartbeat every 150 ms).
with arm.session() as s:
s.torque(True)
s.home_action()
s.move_relative("base", (0.0, 0.0, 0.02)) # 2 cm up in the base frame; needs the action API
s.park_action() # resting pose, then torque offThe arm part of this sequence is checked against the fake armd used by the tests
(tests/fake_armd.py), not on hardware. Without the action API, use the joint-space calls instead: s.home(), s.move_to(q, duration=2.0),
s.unload() (see Arm control).
Write your own program
rebot is the part of the SDK for your own scripts. It imports only the Python standard library,
so the same script runs on a PC (arm over the network) and on the reCamera (127.0.0.1).
from rebot import Arm
with Arm() as arm: # $REBOT_HOST, else 127.0.0.1; takes control, torque on
arm.home()
for obj in arm.detect("cup"): # detections, best first: label, score, box_norm
if arm.grasp(obj).holding:
arm.move_to((0.25, -0.15, 0.15)) # metres, arm base frame (x forward, y left, z up)
arm.gripper_open()
break
# Leaving the block parks the arm (torque off) and releases control,
# also after an error or Ctrl+C.Run on a PC (the rebot/ folder next to the script, or the package installed with uv sync):
REBOT_HOST=192.168.42.1 python3 main.pyRun on the reCamera: copy the rebot/ folder and the script to the device, then run it with the
device's python3:
scp -r rebot main.py <user>@192.168.42.1:~/arm/
ssh <user>@192.168.42.1 'cd ~/arm && python3 main.py'Method | What it does |
| connect, take the control lease, turn torque on |
| move home; move to the resting pose and turn torque off (the next motion turns torque on again) |
| straight-line move of the gripper; |
| relative move in the |
| joint-space move (7 values, radians) |
| gripper; |
| mechanical zero check; result has |
| read calibration (GET); write opening table and/or offset (WS) |
| one detector run through armd; list of detections (includes OBB fields |
| armd's grasp action; |
| check reachability of a detection without moving or lease; unsupported task gives |
| detect, dry-run in order, grasp first reachable target; |
| latest observation ( |
| named poses stored in armd |
| put the held object down: lift, approach, descend, open, retreat (capability |
| stop and hold; latched emergency stop |
| after a |
| switch the collision guard, set |
| clear a fault that armd marks recoverable, then torque on |
| release control when the main loop stops calling |
Starting points: examples/templates/sort_by_label.py (YOLO detection, grasp, place into bins chosen by
label) and examples/templates/demo_wave.py (tour of three taught poses). Building a program with an AI
assistant: see AGENTS.md (workflow, API cheat sheet, safety rules, error codes).
Behaviour:
Armturns SIGTERM intoSystemExitin the main thread (handle_sigterm=Falseopts out), so the device app runner's stop signal parks the arm and releases control.Errors are
rebot.RebotErrorsubclasses with.codeand.message, for exampleIK_BRANCH_FLIP: target (0.9, 0, 0.1) needs the arm to flip its elbow; choose a closer or higher target (...)(this text is from the integration test below).recover()clears only faults whose observationfault.recoverableis true (watchdog timeout, control deadline, unsettled handover). E-stops, other faults, and every fault on an armd without fault codes raiseArmFaultError; clear those in the web cockpit after checking the arm. Leaving thewithblock does not clear them either.guard(timeout_s): a background thread releases the lease whenfeed()has not been called fortimeout_sseconds (time inside anArmmethod counts as fed, up to that call's own timeout plus 15 s: motionstimeoutor 60 s, other calls 30 s); armd's lease watchdog then handles the arm, and every later call raisesGuardTimeout.Named poses,
move_to_pose,obs_hzand fault codes need an armd that reports capabilities version 6 (poses,obs_rate,fault_codes). Against older armd the pose methods raiseUnsupportedError(code == "UNSUPPORTED"),obs_hzis not sent (armd then sends every control tick), andrecover()does not clear faults.
What was checked:
import rebotloads no third-party module (numpy,httpx,websocketsstay out ofsys.modules). Therebotunit tests (WebSocket client, facade, protocol) pass on CPython 3.8.20 and 3.13 against the in-process fake armd; CI runs them on 3.8 (jobstdlib-core). The reCamera'spython3version was not checked; it has to be 3.8 or newer.tests/test_integration_armd.pydrivesArmagainst an armd binary built from rebot-armdad923dfwith--follower mockand the B601-DM profile: connect, enable,move_to,home,park, release, park on exit, readable errors. That armd reports capabilities version 5, so the version 6 features were checked only against the fake armd. Not run on hardware.
ARMD_BIN=/path/to/armd ARMD_PROFILE=/path/to/rebot-b601dm.json uv run pytest tests/test_integration_armd.py -sProject layout
rebot-companion/
βββ pyproject.toml # uv project; extras: [agent] = MCP server, [calib] = OpenCV
βββ rebot/ # arm-control core, standard library only (Python >= 3.8)
β βββ arm.py # Arm facade for user programs
β βββ client.py # rebot-armd client (REST reads + WebSocket lease session + actions)
β βββ detection.py # detections through armd's detector proxy
β βββ errors.py # RebotError and subclasses
β βββ _ws.py # minimal RFC 6455 WebSocket client
β βββ _http.py # JSON over urllib
βββ rebot_companion/ # SDK (numpy / scipy)
β βββ arm_client.py # re-export of rebot.client
β βββ camera_client.py # reCamera rebot-vision / aruco-detector client (trigger / latest result)
β βββ snapshot.py # JPEG snapshots from the H.264 stream + detection overlay
β βββ units.py # rad <-> so101_norm <-> deg bidirectional unit conversions
β βββ lerobot_recorder.py # LeRobot v3.0 dataset recorder (rebot-record)
β βββ policy_runner.py # LeRobot / scripted policy -> armd servo stream (rebot-policy)
β βββ leader_teleop.py # PC-side USB leader bridge -> armd servo (rebot-teleop-leader)
β βββ mcp_server.py # stdio MCP server (rebot-mcp)
β βββ kinematics.py # B601-DM FK (full URDF chain) and planar FK/IK (port of the Web cockpit)
β βββ ik.py # IK adapter: base-frame pose -> armd 7-joint vector (incl. gripper)
β βββ transforms.py # SE(3) transforms, Euler ZYX convention
β βββ calibration.py # hand-eye calibration: point registration + AX=XB
β βββ pipeline.py # Stage 2 deterministic pick & place
βββ examples/ # see "Examples"
βββ tools/
β βββ calibrate_intrinsics.py # camera intrinsics + distortion (OpenCV)
β βββ gen_web_fixtures.mjs # regenerates JS reference values for the tests
βββ tests/Topology
flowchart LR
subgraph Bench["Workcell"]
CAM["reCamera (SG2002)<br/>rebot-vision HTTP :8090<br/>H.264 WS :8001, RTSP :8554"]
ARMD["rebot-armd<br/>REST/WS :8765, Web cockpit"]
ARM["reBot B601-DM arm"]
end
PC["Host PC<br/>rebot-companion / rebot-mcp"]
ARMD -- "motor bus" --> ARM
CAM -. "views marker / scene" .-> ARM
PC -- "http://192.168.42.1:8090<br/>/api/trigger, /api/results/latest" --> CAM
PC -- "ws://192.168.42.1:8001/ (snapshots)<br/>rtsp://192.168.42.1:8554/live0 (intrinsics)" --> CAM
PC -- "http://<armd-host>:8765<br/>/api/v1/observation, WS lease, detection" --> ARMDDefault addresses:
Component |
| Examples default |
rebot-armd |
|
|
camera H.264 stream |
| β |
rebot-vision ( | β |
|
Arm control
rebot-armd accepts actuator commands only on the WebSocket connection that holds the control
lease; REST motion/*, torque and clear_fault return LEASE_REQUIRED.
Read state without a lease:
ArmdClient.get_observation()/ArmdClient.get_schema().Move inside
with arm.session() as s:(acquires the lease, heartbeats every 150 ms; armd's default lease timeout is 2500 ms):s.torque(True),s.home(),s.move_to(q, duration=2.0)(blocks until arrival),s.servo_stream(frames, rate_hz=50),s.unload().ArmdClient.e_stop()works without a lease.If the arm is still torqued when the lease expires, armd's watchdog acts. In the rebot-armd source checked for this README (commit
5aba3d5), it parks the arm and turns torque off when the arm is healthy and has a resting pose; otherwise it holds position with torque on and latchesFault(WatchdogTimeout). Older armd builds only hold and latch. Finish withs.unload(), or after a fault calls.clear_fault()thens.torque(True).Safe exit:
arm.session(safe_exit="error")(default) unloads a torqued arm when thewithblock raises (including Ctrl-C): clear a Fault, re-arm,unload(wait=True)bounded bysafe_exit_timeout(30 s), then release the lease.safe_exit="always"also does this on a normal exit;"off"only releases. The result is ins.safe_exit_outcome(unloaded,not_needed,unsupported,estop,no_lease,failed). A latched EStop is not cleared. When armd has no resting-pose profile,unloadanswersUNSUPPORTED; the outcome isunsupportedand the arm stays torqued.s.torque(False)is refused by armd (ARM_NOT_AT_RESTING_POSE) unless the arm is settled at the resting pose; uses.unload().s.unload()raisesUnloadFailedas soon as armd reportsArmedwith torque on after the unload motion (failed torque cut). Afters.unload(wait=False), closing the session waits for the unload, because a lease release cancels it in armd.Servo:
servo_stream()needsrate_hz >= 10(armd drops the stream 200 ms after the last frame). armd drops frames that jump more than 0.35 rad from its commanded position without a reply (gripper exempt);servo()raisesServoJumpErrorfor such a step instead of sending it.After a
force=Truepreemption, armd refuses motion withHANDOVER_SETTLINGfor a short settling period.Actions (armd with
/api/v1/action/*):s.move_pose(xyz, rpy=None | quat=None)(straight-line Cartesian move ofend_link;move_tostays the joint-space jog),s.move_relative(frame, d, dyaw=, dpitch=, droll=),s.gripper("open" | "close" | "move", fraction=),s.home_action(),s.park_action(), ors.action(path, body). Each blocks untilobservation.actionwith the ack'saction_idis terminal and returns anActionResult;failed/cancelledraiseActionFailed(code). The default timeout is2 * expected_duration_s + 5s, capped at 60 s; on timeoutstopis sent andMotionTimeoutraised.ArmStatus.commanded_positionsandArmStatus.actionare empty / None on an armd without these fields.SO-ARM101 follower: device serial
/dev/ttySC0(--follower so-arm101in armd), 6 DOF (5-DOF arm + 1 gripper). No gravity compensation, no mechanical zero-check, and no physical e-stop (software stop only); resting pose is foldedpark().5-DOF Cartesian motions (
orient_dof=2): pitch and roll are directly controllable while yaw is coupled to arm position. Passauto_yaw=Truetomove_to(xyz, rpy=..., auto_yaw=True)(or omityaw_deginrebot-mcp) to let armd solve the matching yaw angle automatically withoutIK_UNREACHABLE.PC USB Leader Bridge (
rebot-teleop-leader): streams 6-DOF STS3215 leader arm raw positions (USB/dev/ttyACM*,/dev/ttyUSB*, or macOS/dev/cu.usbmodem*) directly to armd's WebSocket servo interface with initial alignment guard, smooth quintic ramp-in, and clean parking on shutdown.
from rebot_companion import ArmdClient
arm = ArmdClient("http://127.0.0.1:8765")
with arm.session() as s:
s.torque(True)
target = list(s.home().positions) # keep home J6 (pi/2) and the gripper
target[0] += 0.2 # J1 +0.2 rad from home
s.move_to(target, duration=2.0)
s.unload() # park + torque off before the lease is releasedMarker trigger (ReCameraClient): trigger() posts a JSON body; a 415 raises CameraError.
It raises CameraTriggerTimeout on an HTTP timeout or a success: false reply; an empty list
means the frame had no marker. Markers without a pose are skipped.
MCP server (agent control)
rebot_companion/mcp_server.py is a stdio MCP server. It needs the agent extra.
uv run --directory /path/to/rebot-companion --extra agent rebot-mcp \
--armd http://192.168.42.1:8765 --camera-ws ws://192.168.42.1:8001/ \
[--client-id rebot-mcp] [--no-auto-lease] [--decoder auto|pyav|ffmpeg] \
[--allow-clear-fault] [--allow-preempt] [--log-level INFO]Agent Integration (MCP Clients)
Generic MCP configuration (clients that use mcpServers, e.g. Claude Desktop claude_desktop_config.json, Cursor, Windsurf)
Add rebot to the mcpServers object in your agent's MCP configuration:
{
"mcpServers": {
"rebot": {
"command": "uv",
"args": [
"run",
"--directory", "/path/to/rebot-companion",
"--extra", "agent",
"rebot-mcp",
"--armd", "http://192.168.42.1:8765"
]
}
}
}The camera stream defaults to ws://192.168.42.1:8001/; add "--camera-ws", "ws://<host>:8001/" when the reCamera has another address. Clients with a different config format (for example OpenCode) need the same command and arguments in their own format.
Claude Code CLI
claude mcp add rebot -- uv run --directory /path/to/rebot-companion --extra agent rebot-mcp \
--armd http://192.168.42.1:8765Logs go to stderr; stdout is the MCP channel.
Flag | Default | Effect |
|
| rebot-armd base URL (arm and detection API) |
|
| camera H.264 stream for snapshots |
|
| lease label shown to other clients |
| off | do not acquire the lease until |
|
|
|
| off | adds the |
| off | adds |
Tools:
Tool | Input | Result |
| β | safety state, fault, torque, lease, joints (positions / commanded / velocities / torques / temperatures), |
|
| JPEG image + JSON |
|
| JPEG with the latest detector boxes + JSON |
|
|
|
|
|
|
|
| same as |
|
|
|
| β | action result; |
| β |
|
| β |
|
| β | torque on |
| β |
|
|
| saves the current joint positions under |
|
| action result; joint-space move. Capability |
|
| action result; lift, approach, descend, open, retreat. Capability |
| β |
|
|
| replaces the runtime keep-out boxes ( |
| β | clears a fault armd marks recoverable ( |
| β |
|
| β | stops, faults (with |
|
| switches the collision guard and/or sets its sensitivity. Changes the device configuration. Capability |
| β | clear EStop or Fault; listed only with |
|
| acquire a free lease; with |
| β | release the lease; if the arm is torqued, armd's watchdog parks it |
save_pose and set_keepout write to the device (poses and keep-out files) and are registered by default.
Tools that need a capability return UNSUPPORTED with the message "Update rebot-armd" when armd is older.
recover never clears an E-stop or a fault armd marks not recoverable (including a COLLISION fault), so it does not need --allow-clear-fault.
save_pose, set_keepout and set_collision_guard write to the device; use them when the user asks.
Collision guard: with the guard on, contact makes armd stop the arm and hold it. Running actions fail with COLLISION, motion commands are refused with COLLISION_HOLD, and the arm resumes by itself when the contact is gone. After repeated trips within a minute armd latches a COLLISION fault that a person clears in the cockpit. The guard is off by default and its thresholds are uncalibrated placeholders (not measured on a real arm). Both example templates wait with wait_until_clear() and retry the step once.
The limits in the table (speed β€ 0.15 m/s, step β€ 0.30 m, rotation β€ 90 deg) are checked by the server's input schema before a call reaches armd; armd applies its own limits as well.
Lease and safety rules:
At startup the server tries a non-force lease. If the web cockpit or another client holds it, the server keeps running without it and actuator tools return
LEASE_BUSY; each actuator call retries a non-force acquire. The server never sendsforce=trueby itself.While the server holds the lease, its 150 ms heartbeat keeps it; the cockpit's non-force retry does not take it over.
If the cockpit preempts (its confirm button), tools return
LEASE_LOST. The server does not re-acquire; control comes back only throughtake_control.By default the agent cannot take control from the cockpit or clear faults:
take_controlhas noforceparameter andclear_faultis not listed. After an E-stop or fault, error hints tell the agent to ask a person to clear it in the web cockpit.--allow-preemptaddstake_control(force=true). The server instructions tell the agent to use it only after the user explicitly confirms. Inside armd's cooldown it returnsPREEMPT_COOLDOWNwithremaining_ms.--allow-clear-faultadds theclear_faulttool.
The cockpit takes the lease on its first control input, not when the page opens, and releases it after 30 s without input only while torque is off. With no cockpit holding the lease,
take_controlsucceeds withoutforce. A cockpit with torque on keeps the lease: the user turns torque off in the cockpit (the lease is released after 30 s idle), or the server runs with--allow-preempt. While the server holds the lease, the cockpit shows observer mode and names the holder (the--client-idlabel).After
release_control, or with--no-auto-lease, tools returnNO_LEASEuntiltake_control.One motion tool runs at a time; a second call returns
BUSY.stopande_stoprun at any time. If the MCP client cancels a motion call, the server sendsstop.On exit the session releases the lease; on an exception (including Ctrl-C)
safe_exit="error"parks the arm first. If the process is killed, armd's lease watchdog acts (see Arm control).
Errors come back as isError results whose text is JSON {code, message, hint, safety_state};
codes include LEASE_BUSY, LEASE_LOST, NO_LEASE, ESTOP_ACTIVE, FAULT_ACTIVE,
NOT_ARMED, WORKSPACE_VIOLATION, IK_UNREACHABLE, IK_BRANCH_FLIP, MOTION_BUSY,
MOTION_TIMEOUT (stop was sent), TRACKING_STALL, STOPPED, SUPERSEDED, BUSY,
CAMERA_UNAVAILABLE, SNAPSHOT_TIMEOUT, DETECTOR_UNAVAILABLE, UNSUPPORTED.
Snapshots wait for the next IDR frame on the camera stream (default timeout 6 s), decoded with
PyAV or, without it, the ffmpeg binary. Box positions are normalised to the image; they are
only correct when the detector input has the same aspect ratio as the stream (not verified on
the device).
Hand-eye calibration
Forward kinematics (B601-DM)
rebot_companion.kinematics has two models, both in the URDF base frame (x forward, y left,
z up, metres / radians):
Full FK,
tcp_pose(q)/tcp_pose_from_joints(positions)/calibration.gripper_pose(positions): the URDF chainbase_linkβjoint1..joint6βend_jointβend_linkofreBot-DevArm_gripper.urdf(rebot-armdassets/, copy intests/fixtures/). Returns the SE(3) TCP pose, x axis = tool axis. Hand-eye calibration uses this FK, so J5 and J6 may take any value in the samples. Tests compare it with an independent URDF parser: < 0.1 mm, < 0.01 deg.URDF joint5 = wrist swing (axis vertical at the park pose, motor J1..J5 = 0, J6 = pi/2; +0.2 rad moves the TCP ~36 mm in -y), joint6 = tool roll (about the tool axis; the TCP position does not change). The Web cockpit UI uses the same labels (J5 swing, J6 roll).
Motor β URDF mapping: armd index 0..3 β URDF joint1..joint4 with
model = (motor - offset) / sign(WebtoModel/CFG.cart.sign/CFG.cart.off, defaults sign1,1,1,1, offset0; same as the Web?iksign=/?ikoff=overrides; the wizard takes--iksign/--ikoff). Index 4 β joint5 1:1; index 5 β joint6 with URDF joint6 = motor β pi/2 (kinematics.JointMap, defaultB601DM_JOINT_MAP;JointMap.from_schemareads armd'smodel_joint_mapfromGET /api/v1/observation/schema, which the MCP server and the hand-eye wizard use). Evidence: photos of the arm at the rest pose (motor J6 = pi/2), 2026-11-12: the jaws open left-right and the camera holder (end_link +z) is on top, which the URDF FK gives at joint6 = 0. Index 6 (gripper) is not part of the FK.Planar FK/IK,
fk(q)/solve_ik(target, prev): line-by-line port of the rebot-armd Web cockpit (src/api/index.html,IK.fk/IK.solve), J1 yaw + J2/J3/J4 pitch chain, J5 = 0. Tests compare it against values computed by running the JS code with node (tools/gen_web_fixtures.mjs). With J5 = 0 its TCP position matches the full FK to < 0.2 mm (rounded Web constants, joint1 x offset of -0.084 mm ignored).solve_ik(target, prev)is the analytic position + pitch IK from the Web.ik.B601IkAdapterfills J1βJ4 from the analytic IK (tool pointing down by default), J5 = 0, J6 = armd home (pi/2) or the current value (j6=None), J7 = gripper. armd rejects targets with any other length.
Methods and assumptions
| Setup | Assumption | Uses | Result |
| eye_to_hand | marker centre coincides with the TCP | positions only |
|
| eye_to_hand | marker rigid on the gripper, offset unknown | full poses |
|
| eye_in_hand | camera on the gripper, marker fixed in the scene | full poses |
|
axxb= Park & Martin: rotation by least squares on rotation logarithms, translation by stacked linear least squares, over all sample pairs. Its result matchescv2.calibrateHandEye(..., CALIB_HAND_EYE_PARK)in the tests.axxbneeds relative rotations about at least two non-parallel axes. With this arm, change both J1 yaw and wrist pitch (>= 15 deg) between samples; J5 swing and J6 roll add further rotation axes. Rotation about one axis only, or < 5 deg, raisesCalibrationError.Residuals:
pointreports the 3D point error per sample;axxbreports per-sample marker position (m) and rotation (deg) prediction errors in the camera frame. RMSE and max error are printed and saved. The wizard warns when the RMSE is above 10 mm.Marker orientation from the device has 0.01 deg resolution (
r_deg, 2 decimals).pointdoes not use it.Accuracy depends on the camera intrinsics and
MARKER_SIZEon the device. Calibrate intrinsics first (Camera intrinsics).
Wizard
# eye-to-hand, marker centre on the TCP (default)
uv run python examples/02_hand_eye_calib.py --arm-url http://<armd-host>:8765 --marker-id 0
# marker anywhere on the gripper
uv run python examples/02_hand_eye_calib.py --method axxb --arm-url http://<armd-host>:8765
# re-solve samples exported from the Web cockpit
uv run python examples/02_hand_eye_calib.py --from-web-export rebot_hand_eye_2026-11-01T10-00-00.jsonPose the arm by hand (torque off) or with teleop, hold it still and press Enter. Each capture
checks that the arm is not moving (|v| <= 0.02 rad/s, --vel-threshold, re-checked after
detection), triggers one detection, picks the marker id, computes the TCP pose with FK, rejects
samples closer than 10 mm to an existing one and appends to calib_samples.json (--resume
continues a session). s solves and prints the residual table, d solves and writes
calibration.json.
Calibration file format
save_to_file() writes a superset of the Web cockpit export, so files from either side load
with HandEyeCalibration.load_result() (returns HandEyeResult(setup, transform)) and
HandEyeCalibration.load_samples() (returns samples to re-solve).
HandEyeResult.cam_to_base(joints): eye_to_hand returnsT_cam_to_base; eye_in_hand returnsT_base_gripper(joints) @ T_cam_to_gripper, withjointsthe armd positions when the image was taken. The pipeline reads them right before the trigger and fails the cycle if the arm moved during detection.HandEyeCalibration.load_from_file()returnsT_cam_to_basefor eye_to_hand files and raisesValueErrorfor eye_in_hand files (their transform isT_cam_to_gripper).Legacy SDK files without
mode/setupare rejected byload_result().
{
"version": 1, "kind": "hand_eye_calibration",
"setup": "eye_to_hand", // or "eye_in_hand"
"method": "point_registration_horn", // or "axxb_park_martin"
"assumption": "...", "units": {"length": "m", "angle": "deg"}, "created": "...", "marker_id": 0,
"result": {
"T_cam_to_base": [[...4x4...]], // "T_cam_to_gripper" for eye_in_hand; p_target = T @ p_cam
"translation_m": [x, y, z], "euler_rpy_deg": [roll, pitch, yaw],
"euler_convention": "R = Rz(yaw) Ry(pitch) Rx(roll)",
"rmse_m": 0.0012, "max_error_m": 0.0021, "residuals_m": [...], "samples": 9, "solved_at": "...",
"rot_residuals_deg": [...], "rot_rmse_deg": 0.3, // axxb only
"T_marker_to_gripper": [[...]] // axxb only ("T_marker_to_base" for eye_in_hand)
},
"samples": [{"joints": [...], "p_base": [...], "p_cam": [...], "R_cam": [[...]], "rpy_cam_deg": [...],
"marker_id": 0, "T_base_gripper": [[...]], "T_cam_marker": [[...]], "tcp_pitch": 0.5, "ts": "..."}],
"transform": {"translation": [...], "euler_deg": [...], "matrix": [[...]]} // legacy SDK block
}The numbers in this example are illustrative. Web samples without R_cam are position-only
and can be solved with method="point" only. Their gripper rotation is recomputed from
joints with the FK.
Gripper calibration
rebot-gripper-calib measures the gripper on the real arm for armd's grasp (needs rebot-armd with the gripper calibration
API). The arm body does not move; the gripper moves at low speed. Keep fingers out of the jaws; Ctrl+C stops; nothing is
stored without confirmation.
REBOT_HOST=192.168.42.1 rebot-gripper-calib # --points 6 (default), --dry-run measures without storingShows the stored calibration and
observation.gripper_zero.Zero check: the jaws close slowly to the mechanical stop; prints the offset from
closed_radand asks whether to store it.Opening table: the gripper stops at each position from open to closed; enter the caliper opening at the jaw tips in mm (
sskips a point,qaborts).Checks that the openings are monotonic, prints the fit residuals (warns above 2 mm), the full opening and a suggested
max_grasp_width_m(full opening β 0.015 m), and asks whether to store the table.
armd uses the stored table for the width-based pre-open (pre_open: auto) and to cap the TOO_WIDE limit.
Camera intrinsics
The detector's default intrinsics are placeholders (fx = fy = 600, cx = 320, cy = 180 at
640x360, no distortion). tools/calibrate_intrinsics.py estimates K and distortion with OpenCV:
uv sync --extra calib
# live: frames from rtsp://192.168.42.1:8554/live0, auto-capture when the board is still and the view is new
uv run python tools/calibrate_intrinsics.py --host 192.168.42.1 --board checkerboard --cols 9 --rows 6 --square 0.025
# ChArUco board
uv run python tools/calibrate_intrinsics.py --board charuco --cols 7 --rows 5 --square 0.04 --marker 0.03 --dict DICT_4X4_50
# offline: re-run on saved frames
uv run python tools/calibrate_intrinsics.py --images intrinsics_frames/20261109-101500Print the board flat; measure the square size.
--cols/--rowsare inner corners (checkerboard) or squares (ChArUco).Move the board across the whole image, near and far, tilted in all directions; the tool captures a frame after the board is still for 5 frames and differs from earlier views (default 20 views,
--target; frames are saved for offline re-runs).The tool prints the reprojection RMS and writes
aruco-intrinsics.confwithCAMERA_WIDTH CAMERA_HEIGHT FX FY CX CY K1 K2 P1 P2 K3(OpenCV order) at the inference resolution (--infer-size, default 640x360).With
rebot-vision: copy the values as lowercase keys (fx fy cx cy k1 k2 p1 p2 k3) into/userdata/rebot-teleop/vision.jsonand restart the app (/etc/init.d/K92rebot-teleop restart). With the camera's aruco-detector: merge the keys into/etc/aruco-detector.confand restart it; the distortion keys need aruco-detector >= 0.1.1 and the file is preserved across upgrades. JSON replies carry"undistorted": true/false.
Resolution assumption: calibration runs on the 1280x720 RTSP stream, the detector infers at 640x360 from the same sensor. The tool assumes the same field of view (no crop) and scales fx, fy, cx, cy by the width/height ratio (pixel-centre convention). This has not been verified on the device; check a measured marker distance against a tape measure.
Record a LeRobot dataset
rebot-record records teleoperation or scripted episodes from the host PC into a
LeRobot dataset (format codebase_version v3.0, as
written by lerobot 0.6.1; details in docs/lerobot_dataset.md).
It needs the record extra (PyAV, pyarrow), not lerobot.
uv sync --extra record
uv run rebot-record --armd 192.168.16.1 --camera 192.168.16.1 \
--repo-id user/pick_cup --task "pick the cup" --episodes 5 --episode-s 30Each episode: Enter starts it; Enter stops it early (otherwise it stops after --episode-s);
then Enter saves it, d discards it, q saves and quits. --no-prompt records back to back
(--reset-s pause between episodes). The dataset goes to
~/.cache/huggingface/lerobot/<repo-id> unless --root is given; the directory must be new.
Feature | Source |
| armd |
| armd |
|
|
| reCamera H.264 stream, decoded and re-encoded (libsvtav1 if PyAV has it, else h264; |
The recorder does not take the control lease: it reads the armd observation WebSocket
(/api/v1/ws?obs_hz=2*fps) while a teleop app or program holds the lease. Alignment uses the
host receive time of every message (time.monotonic()): row k is due at T0 + k/fps and takes
the newest observation and the newest decoded camera frame received by then. armd's own
timestamp and the camera's ms tail are other clocks; they are stored per episode in
meta/rebot_episodes.jsonl with the observation and camera sample ages. Camera pipeline and
network delay are not compensated.
Python API: LeRobotRecorder(root, repo_id, fps=30, camera_url=..., armd_host=..., task=..., unit_mode="rad")
with start_episode(), stop_episode(), save(), discard(); start_episode(sample=False)
plus add_frame(state, action, image) records scripted steps at a fixed fps.
Use --unit-mode {rad,so101_norm,deg} (default rad) to normalize arm joints to [-100, 100]
and gripper openness to [0, 100] (so101_norm), saving unit_mode, profile_id, arm_dof
and gripper_joint metadata to meta/info.json.
Verified (tests/test_lerobot_recorder.py, synthetic observations and libx264 Annex-B frames
fed through the same PyAV decode path): file layout, indices, timestamps, stats and task
metadata; one mp4 frame per row; a lease-free run against the fake armd; the Enter-driven CLI.
LeRobotDataset(repo_id, root=...) loads the result and returns frames, actions and the task with
lerobot 0.6.1 (PyAV decoder) and 0.7.0 (torchcodec decoder) on Linux aarch64; this test runs
when REBOT_LEROBOT_PYTHON names a Python with lerobot[dataset] installed, else it is skipped.
Not yet run against a real armd and reCamera.
In the simulator. armd's sim follower and the simulated wrist camera of rebot-sim (in
rebot-armd, docs/simulation.md) stand in for the
arm and the reCamera: the simulator streams H.264 in the reCamera format at ws://127.0.0.1:8001/,
armd listens on 127.0.0.1:8765. In the rebot-armd checkout:
cd sim/mujoco && uv run rebot-sim --camera --objects cube,cup --seed 3 # terminal 1
ARMD_DETECTOR_URL=http://127.0.0.1:8090 cargo run --bin armd -- --follower sim \
--config kits/recamera-b601dm/profile/rebot-b601dm.json --log-dir off --blackbox-dir off # terminal 2Set ARMD_POSES, ARMD_KEEPOUT and ARMD_GRASP_SETUP to writable paths when /userdata does
not exist. Then record with --armd 127.0.0.1 --camera 127.0.0.1. The simulated camera runs at
15 fps by default (rebot-sim --fps, 1..30); at the recorder's 30 fps every second row repeats a
camera frame. Run on spark (Linux aarch64, 2026-11-11, rebot-armd b3ff997): one 3 s episode with
--no-prompt gave 91 rows, a 1280x720 observation.images.recamera video, 0 late ticks and 45
camera repeats. The stream is also decoded with rebot-companion's snapshot decoder in
rebot-armd's sim/mujoco/tests/test_camera.py.
Run a learned policy
rebot-policy runs a policy on the host PC (GPU host for learned policies) and drives the arm
through armd's servo stream. armd's servo guard (speed cap, lead cap, blocked hold), collision
guard and faults apply as for any other client.
# scripted policies, no torch: replay a recorded episode, or a small sine on one joint
uv run --extra policy rebot-policy --armd 127.0.0.1 --policy replay:$HOME/.cache/huggingface/lerobot/user/pick_cup:0
uv run --extra policy rebot-policy --armd 127.0.0.1 --policy sine:1:0.05:4 --max-seconds 20
# a LeRobot policy (local directory saved by lerobot-train, or a Hub repo id), on the real arm;
# torch + lerobot are added for this run only, in a Python 3.12 environment
uv run --python 3.12 --extra policy --with 'lerobot[dataset]>=0.6.1,<0.8' rebot-policy \
--armd 192.168.16.1 --camera 192.168.16.1 --policy outputs/train/act/checkpoints/last/pretrained_model \
--fps 30 --max-seconds 60 --task "pick the cup" --i-am-at-the-arm --log run.jsonltorch and lerobot (0.6.1 or 0.7.0, Python >= 3.12, several GB) are not dependencies of
rebot-companion. Either add them per run with uv run --with as above (inside this repository
--python 3.12 makes the project environment use Python 3.12), or install rebot-companion into
the Python environment where lerobot is already installed (for example the training environment).
The runner imports them only for a learned policy.
Option | Meaning |
| LeRobot pretrained directory or Hub repo id; |
| policy steps per second. Default: the dataset fps for |
| servo frame rate (default 50, armd's control rate) |
| run length (default 60) |
| stop after this many policy steps (default: no limit) |
| units for policy actions / observations: |
| allow explicit |
| task text passed to the policy (language-conditioned policies) |
| torch device (default |
| hold position at the end instead of parking |
| stop when the policy gives no target for this long (default 1 s), the newest camera frame is older (default 0.5 s), or the newest armd observation is older (default max(0.1 s, 3 observation periods) at the rate armd sends: min of the requested 50 Hz, |
| per-step JSON lines (observation age, camera age, inference ms, step lag, action, state) and a summary line |
| required when armd's follower ( |
The run is refused before taking the lease when the schema does not give finite joint limits with
min < max or when policy action dimension does not match arm DOF (7 for B601-DM, 6 for SO-ARM101).
The dynamic gripper joint (schema.gripper_joint) is automatically exempted from the lead clip.
Observation, built like a rebot-record row: observation.state = armd positions (converted
to --state-units, float32);
observation.velocity / observation.effort = velocities / torques when the policy has these
inputs; the policy's single image input (for example observation.images.recamera) = the newest
decoded reCamera frame, RGB uint8, resized with PyAV to the policy's input height and width (the
recorder resizes with the same PyAV call before encoding). The action is the joint target, the
recorder's commanded_positions (converted from --action-units back to armd radians). Learned policies are loaded with lerobot's
PreTrainedConfig.from_pretrained, get_policy_class(type).from_pretrained and the saved
pre/post-processors (make_pre_post_processors), and stepped with predict_action (one action per
step; ACT-style policies return the next action of their chunk). Policies with more than one camera
or other inputs are refused.
Timing: policy steps run at --fps; inference runs on a worker thread and the main loop waits for it
at most until the deadline or --stall-s, then stops, parks and releases the lease (a call that never
returns is abandoned; the warm-up call may take up to 120 s). A sender thread streams servo frames at
--servo-hz: each new target is reached by linear interpolation from the last sent frame (after clipping;
the measured position before the first frame) over one policy period, then held. When the policy ends (end of a replay, --max-steps) the stream
continues until the last segment has reached its target, plus one policy period, before the stop.
During that hold the camera freshness check still applies (camera_stale), and a hold that reaches
--max-seconds ends as max_seconds.
Every frame is clipped per joint to the intersection of the joint limits and, for joints 1..6,
measured position Β± 0.95 Γ servo_max_lead_rad (armd schema, default 0.2 rad); the summary counts
clipped frames per joint and the observation.motion_limit reasons armd reported. A step that is
more than one period late is counted and the schedule restarts from it (no burst of catch-up steps).
Learned policies run one warm-up inference before the stream starts. --max-seconds is an absolute
deadline from the start of the stream, checked by the sender before every frame, so slow inference
does not extend the run. Timing options must be finite and > 0.
Stops: a joint measured so far beyond its limit that the intersection is empty, stale or malformed
armd observation (not 7 finite positions), E-stop, Fault, collision hold, servo blocked hold, torque off, lease loss, servo rejection
(for example MOTION_BUSY), connection loss, policy stall, stale camera frame, a non-finite or
wrong-sized action, policy exception, end of a replayed episode, --max-steps, --max-seconds, Ctrl+C or
SIGTERM. Then the stream ends, the arm holds (motion/stop) and parks (unload) unless
--no-park; no park after a Fault, E-stop, collision hold or lease loss (the summary says why).
No servo frame is sent once a stop is requested; each socket send is bounded to 1 s. If the
sender thread has not ended 2 s after a stop (sender_join_s, at least 1.5 Γ the send timeout), the runner sends the lease-free REST e-stop and does
not park. Ctrl+C during setup after torque-on was sent (arming, warm-up) also stops and parks the
arm; before that the lease is only released. Once a stop is in progress, further Ctrl+C / SIGTERM
are ignored (a note is printed) until stop, e-stop and park have finished. The runner never clears a fault. Exit code 0 after max_seconds, max_steps or the end of a replay, 130 after
Ctrl+C, else 1. Python API: PolicyRunner(ArmdClient(url), parse_policy(spec), camera).run()
returns a RunResult; a runner runs once, and a policy whose inference was abandoned by an earlier run
(stall or deadline) is refused until that call returns.
Verified (tests/test_policy_runner.py, fake armd): servo frames arrive in order at ~50 Hz without
dropped frames; interpolation between policy steps; lead clip (frames within the lead of the
measured position) and joint-limit clip; stop on fault, E-stop, collision hold, blocked hold, lease
preemption, servo rejection, policy stall, bad action and policy exception; park at the end and
--no-park; the operator flag for a non-mock follower; a replay round trip (recorder dataset ->
replay through the fake armd -> a second recorder run observes the same trajectory); the CLI over
HTTP. A randomly initialised ACT policy (lerobot 0.7.0, built for the recorder's synthetic features:
7-joint state and action, one 64x48 camera) runs 10 steps with images from an H.264 WebSocket
stream in the reCamera format; that test runs when lerobot imports or
REBOT_LEROBOT_PYTHON names a Python with lerobot[dataset], PyAV, pyarrow and scipy, else it is
skipped. The same lerobot calls exist in 0.6.1 (source read, not run).
In the simulator (setup as in Record a LeRobot dataset; armd reports
follower sim, so --i-am-at-the-arm is not needed; image policies take --camera 127.0.0.1):
on spark (2026-11-11, rebot-armd b3ff997) --policy replay:<dataset>:0 of a 3 s episode recorded
from the simulator ran 91 steps and 154 servo frames with 0 late, and parked;
--policy sine:1:0.05:4 --max-seconds 5 ran 150 steps and 250 servo frames with 0 late and
stopped with max_seconds. Not yet run against a real armd, with a learned policy in the
simulator, or with a trained policy.
Simulation scenes and custom tools (rebot-scene)
Simulation worlds and custom end-effectors live in rebot_companion/scenes/ and load on
demand into rebot-sim without embedding scene meshes or sim dependencies into rebot/ or the
reCamera firmware package:
Tier-0 / Tier-1 asset model: built-in scenes (such as
coffee_kiosk) work offline from native MuJoCo primitives (world.xml). Optional Tier-1 meshes, textures, or datasets download on demand into$REBOT_SCENE_CACHE(default~/.cache/rebot/scenes/<scene_id>/), followingsolution-assetsnaming (<stem>-<md5-first-8>.<ext>) with atomic.partwrites and SHA-256 verification.Custom end-effectors, ONNX policies & browser WASM sandbox: pass local directories (
scene.json+world.xml,tool.json+tool.xml) or raw MuJoCo XML files torebot-sim --scene ... --tool ..., or hot-swap them at runtime viarebot-scene load(POST /sim/scene). For Agent-driven zero-backend prototyping and RK/arm pre-flight, upload scene/tool/rebot-onnx-policy/v1packages viarebot-scene uploadand switch betweenmode="wasm"(?sim=wasm) andmode="sim"viarebot-scene activate. Virtual I/O tools (suctionviamjEQ_WELD,screwdriver) expose/sim/ioand/api/v1/sandbox/io. Seedocs/agent_sandbox_workflow.md.
rebot-scene list # built-in scenes (coffee_kiosk, pcb_suction) & tools
rebot-scene info pcb_suction # stages, suggested poses, keepout & assets
rebot-scene init ./my_scene --kind scene # starter scene.json + world.xml
rebot-scene init ./my_gripper --kind tool # starter tool.json + tool.xml
rebot-scene init ./my_policy --kind policy # starter rebot-onnx-policy/v1 (policy.json + model.onnx)
rebot-scene validate ./my_policy
rebot-scene upload ./my_policy --armd-url http://127.0.0.1:8080
rebot-scene activate --mode wasm --scene pcb_suction --tool suction --policy my_policy
rebot-scene status --armd-url http://127.0.0.1:8080
rebot-scene load --scene coffee_kiosk --tool wide_cup_gripper
rebot-scene io --set vacuum=true # drive virtual suction/IO on running rebot-sim
rebot-scene asset-hash mesh.stl --prefix rebot/scenesExamples
Script | What it does | Moves the arm |
| reCamera trigger and armd state; | only with |
| interactive hand-eye calibration wizard (see above) | no (you pose the arm) |
| Stage 1 tool-calling pattern: JSON-schema tool definitions and a dispatcher |
|
| 4-stage mobile coffee kiosk workflow using | yes (run against |
| multi-seed | yes, unless |
| 3-stage PCB suction pick/test/outfeed workflow over | yes (run against |
| Stage 2 pick & place cycles through | yes, unless |
uv run python examples/01_atomic_api_demo.py --url http://192.168.42.1:8090 --arm-url http://<armd-host>:8765
uv run python examples/03_agent_orchestrator.py --calib calibration.json # or --dry-run without a calibration
uv run python examples/04_hardened_pick_place.py --dry-run # detect + workspace check, arm does not move
uv run python examples/04_hardened_pick_place.py --calib calibration.json --cycles 1Calibration handling in examples 03 and 04: the file is loaded with
HandEyeCalibration.load_result(), so eye_to_hand and eye_in_hand files both work. Without a
calibration file, both examples use a placeholder transform that is not a calibration: example 03
marks its positions as not real and refuses plan_and_execute_pick unless --dry-run is set;
example 04 exits with an error unless --dry-run is set.
Pipeline results: a cycle without an IK solver (dry run) ends with success=False,
stage="dry_run"; stage="completed" means the arm ran the whole cycle. Cycle steps: open the
gripper in place, approach (+80 mm) and grasp with the gripper open, close the gripper, lift,
place, open the gripper, then finish_action (default unload). The gripper is joint index 6
of armd's 7-joint vector: ik.GRIPPER_OPEN = -5.7 (open) .. ik.GRIPPER_CLOSED = 0.0
(closed); armd's gripper joint limit is -5.75 .. 0.10. Before any motion the pipeline rejects
targets farther than PipelineConfig.max_allowed_distance (default 0.80 m) from the base or
below z = -0.05 m.
Safety
This SDK and the MCP server move a real arm. Software limits reduce risk; they do not make the arm safe to stand next to.
Keep people, hands and loose objects out of the arm's reach while it is torqued. Keep the web cockpit or another E-stop path at hand;
ArmdClient.e_stop()and the MCPe_stoptool work without a lease.rebot-armd is the component that enforces limits. In its source (commit
5aba3d5): joint position and velocity limits, a workspace check (floor, box and reach bounds) that rejects targets and Cartesian paths outside it withWORKSPACE_VIOLATION, Cartesian speed caps (linear β€ 0.15 m/s, angular β€ 1.0 rad/s), and a lease watchdog that parks the arm (or holds and latches a fault) when heartbeats stop while it is torqued. The values depend on the armd build and its configuration; check them on your armd.This SDK adds client-side checks: MCP input limits (see the tools table), the servo step check (0.35 rad), the pipeline distance check, and the session's safe exit on errors.
Start new code with low speeds, short moves and dry runs (
--dry-runin examples 03 and 04).Do not run motion with a placeholder or unverified hand-eye calibration.
--allow-preemptand--allow-clear-faultlet an agent take control from a person at the cockpit and clear faults. They are off by default.
Development
uv sync --all-extras
uv run ruff check && uv run ruff format --check
uv run pytest -q
node tools/gen_web_fixtures.mjs ../rebot-armd/src/api/index.html # regenerate JS reference valuesThe tests use in-process fakes (armd: tests/fake_armd.py) and recorded fixtures; they need no
hardware. CI (.github/workflows/ci.yml) runs ruff and pytest with all extras on Python 3.10,
3.11, 3.12 and 3.13, and the rebot tests on Python 3.8 with only pytest and websockets
installed. tests/test_integration_armd.py runs only when ARMD_BIN points to an armd binary. See CONTRIBUTING.md and SECURITY.md.
Acknowledgements
Model Context Protocol (MCP): Open standard for connecting AI agents to real-world tools;
rebot-armd: Rust arm daemon with LeRobot Parquet recording;
Seeed Studio: reCamera SG2002 smart sensor & reBot B601-DM arm platform;
OpenCV: Camera calibration and computer vision algorithms.
License
MIT, see LICENSE. Copyright (c) 2026 Seeed Studio & Contributors.
tests/fixtures/reBot-DevArm_gripper.urdf is derived from the
reBot-DevArm URDF, which is licensed under
the CERN Open Hardware Licence Version 2 - Weakly Reciprocal (CERN-OHL-W-2.0).
Available Tools
24 toolscollision_guard_statusA
Collision guard configuration: {enabled, sensitivity, thresholds_nm}. get_state.collision shows a trip in progress (active, joint, residual_nm, resume_in_s). The guard is off by default and its thresholds are uncalibrated placeholders. No lease needed. Needs capability 'collision_guard'.
Inputs: no named parameters.
describe_safetyA
What the arm's safety system does and does not do: stops, faults (with recoverable flags), speed and joint limits, timing, and hardware facts such as whether a physical e-stop exists. Plus a one-line 'summary'. Read it before planning motions. No lease needed. Needs capability 'safety_describe'.
Inputs: no named parameters.
detectB
Run one detector inference on a fresh frame. Boxes are normalised [x0, y0, x1, y1] in the image (0..1). pipelines: yolo (objects), aruco (markers) or both (default); honoured by rebot-vision >= 1.3, older detectors run their current mode. The result's pipelines lists what ran (null when the detector does not report it).
Inputs: wait_ms, min_score, pipelines.
enableA
Turn torque on (arm holds its pose). Rejected while E-stopped or faulted.
Inputs: no named parameters.
e_stopA
Emergency stop. Needs no lease; latches EStop until a person clears it in the web cockpit.
Inputs: no named parameters.
get_keepoutA
Keep-out boxes the arm must not enter: {boxes[{name, min_m, max_m}], source}. No lease needed. Needs capability 'keepout'.
Inputs: no named parameters.
get_stateB
Arm state: safety_state, fault, torque, lease, joints, end_link pose (host FK), gripper, latest action. No lease needed.
Inputs: no named parameters.
gripperA
Gripper: open, close (grasp=true by default: stops on contact and reports holding) or move to fraction (0 closed .. 1 open). Returns {holding, gap_rad, torque_nm, fraction, state}.
Inputs: command (required), grasp, fraction.
homeB
Move to the home pose. Blocks until done.
Inputs: no named parameters.
list_posesA
Saved poses: {count, poses[{name, positions, tcp}]}. No lease needed. Needs armd capability 'poses'.
Inputs: no named parameters.
move_relativeA
Relative move of end_link. frame: base (base axes), tool (end_link axes) or camera (x right, y down, z forward along the view; dpitch > 0 looks down, dyaw > 0 looks right; level keeps the image level, default true). Translations in m (each <= 0.30), rotations in degrees (each <= 90), centred on end_link. Blocks until done.
Inputs: frame (required), dx, dy, dz, +5 more.
move_toA
Straight-line move of end_link to (x, y, z) m in the base frame. Orientation: roll/pitch/yaw in degrees (URDF fixed-axis; missing angles keep the current value) or quat [w, x, y, z]; omit both to keep the current orientation. Blocks until done.
Inputs: x (required), y (required), z (required), quat, +5 more.
move_to_poseA
Joint-space move to a saved pose; speed_scale 0.1..1.0 of the planned speed. Blocks until done.
Inputs: name (required), speed_scale.
parkA
Park at the resting pose and turn torque off (ends Idle). Blocks until done.
Inputs: no named parameters.
placeA
Put the held object down: lift, move above the target, descend, open the gripper, retreat. Target: a saved pose name (its gripper position is the place point) or x, y, z in m (base frame). rpy_deg optionally sets the orientation [roll, pitch, yaw]. release=false keeps the object, retreat=false stays at the target. Fails with IK_UNREACHABLE / WORKSPACE_VIOLATION (also for keep-out boxes) / TRACKING_STALL / PLACE_TIMEOUT. Needs capability 'place'. Blocks until done.
Inputs: x, y, z, pose, +6 more.
recoverA
Clear a fault that armd marks recoverable (WATCHDOG_TIMEOUT, CONTROL_DEADLINE, HANDOVER_UNSETTLED) and turn torque on again. Any other fault or an E-stop returns NOT_RECOVERABLE and stays latched for a person to clear in the web cockpit. Needs capability 'fault_codes'.
Inputs: no named parameters.
release_controlA
Release the control lease (the web cockpit will acquire it automatically).
Inputs: no named parameters.
save_poseA
CONFIGURATION CHANGE: save the arm's current joint positions under a name (letters, digits, _ and -, max 64), replacing a pose with that name. Move the arm there first (the user can hand-guide it or use the cockpit). Persisted on the device. Needs capability 'poses'.
Inputs: name (required).
set_collision_guardA
CONFIGURATION CHANGE: switch the collision guard on or off and/or set its sensitivity (low, medium, high). Persisted on the device. With the guard on, contact stops the arm; it resumes by itself when the contact is gone and latches a COLLISION fault after repeated trips. Thresholds are uncalibrated placeholders. Use only when the user asks. Needs capability 'collision_guard'.
Inputs: enabled, sensitivity.
set_keepoutA
CONFIGURATION CHANGE: replace the runtime keep-out boxes (max 16; min_m < max_m per axis, metres, base frame). Motions into a box fail with WORKSPACE_VIOLATION. Pass [] to remove all. Persisted on the device. Show the user the boxes before setting them. Needs capability 'keepout'.
Inputs: boxes (required).
snapshotC
JPEG snapshot from the camera stream, plus JSON {width, height, device_ts_ms, age_ms}.
Inputs: quality, max_width.
snapshot_annotatedA
JPEG snapshot with the detector's latest boxes drawn, plus JSON {detections, det_frame_id, det_age_vs_frame_ms, note?}. Boxes come from the latest result and may lag the frame.
Inputs: quality, max_width, min_score.
stopA
Stop the current motion and hold position (torque stays on). Works while another tool runs.
Inputs: no named parameters.
take_controlA
Acquire the control lease when no other client holds it. Cannot take control from the web cockpit.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 24 tools
Each tool has a distinct, clearly bounded purpose: motion (move_to, move_relative, move_to_pose, home, park), vision (detect, snapshot, snapshot_annotated), configuration (set_keepout, set_collision_guard, save_pose), and safety/lease management are cleanly separated. The closest pairings (snapshot vs snapshot_annotated, collision_guard_status vs get_state) are distinguished explicitly in the descriptions.
The set is dominated by a consistent snake_case verb_noun pattern (set_keepout, save_pose, take_control, get_state). A handful of bare verbs (detect, grip per, stop, enable, recover, home, park, release_control) deviate, but they are conventional and readable rather than chaotic.
24 tools is slightly heavy but each one maps to a real capability of a robot-arm control server (motion, vision, safety, lease, configuration), so nothing feels redundant. It sits just above the comfortable 3-15 band but is justified by the domain's breadth.
The lifecycle is thoroughly covered: motion primitives, joint-space and saved-pose moves, home/park, gripper control, detection and snapshots, lease management, fault recovery, keep-out and collision-guard configuration, and safety introspection. Read-only observers (get_state, list_poses, describe_safety) plus a clear per-tool capability requirement leave no obvious dead ends.
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Human-input bridge for AI agents with voice-first answer links, MCP tools, and HTTP APIs.
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLM-based AI agents to control SO-ARM100 and SO-101 robots through natural language commands and camera feedback. It supports various transport protocols and provides tools for both autonomous robotic movement and manual keyboard operation.89Apache 2.0
- AlicenseBqualityDmaintenanceExposes Anthropic's computer-use action surface (screenshot, click, move, keyboard, clipboard, batch) against a persistent desktop display via MCP stdio protocol. Enables AI agents to control a virtual desktop environment through natural language instructions.24MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI systems to control the Reachy Mini robotβspeak, listen, see, and express emotions through physical movement. Compatible with Claude, GPT, Grok, and other MCP-compatible AIs.MIT
- AlicenseAqualityCmaintenanceEnables MCP-capable agents to see and control robots directly by listing tasks, starting and resetting episodes, observing camera feeds and robot state, and moving end effectors and grippers, including coordinating two arms. Supports LIBERO, RoboDojo, a simulator-free fake backend and remote backends over SSH or TCP, with configurable episode budgets, logs, live monitoring and frame-by-frame replay.744 PyPI5Apache 2.0