Skip to main content

Bridge OpenClaw AI agents with physical servo robots — connecting the digital mind to the physical world

Project description

🦾 RobotClaw

Bridge OpenClaw AI agents with physical servo robots — connecting the digital mind to the physical world.

RobotClaw 是一个 Python 库,将 OpenClaw 自主 AI 代理平台与 LOBOT LX 总线舵机机器人深度集成。通过 pip install robotclaw,即可让 AI 获得控制物理机器人的能力。


✨ Features

  • 🔌 LOBOT LX Protocol Driver — Full implementation of the LX serial bus servo protocol
  • 🤖 High-Level Robot API — Joint-level control with direction/offset mapping
  • 🎬 Motion Teaching — Record, save, and playback robot movements with variable speed
  • 🧠 OpenClaw Integration — Skill adapter for AI agent → robot control
  • 🛠️ CLI Toolsrobotclaw-scan for diagnostics, robotclaw-teach for interactive teaching
  • Thread-Safe — All serial operations protected by mutex locks

📦 Installation

pip install robotclaw

For development:

pip install robotclaw[dev]

🚀 Quick Start

Basic Servo Control

from robotclaw import ServoBus

# Connect to servo bus
bus = ServoBus()
bus.connect("COM3", baudrate=115200)

# Move servo ID=1 to position 500 in 1 second
bus.move(servo_id=1, position=500, time_ms=1000)

# Read current position
pos = bus.read_position(servo_id=1)
print(f"Position: {pos}")

bus.disconnect()

High-Level Robot Control

from robotclaw import Robot, DEFAULT_CONFIG

with Robot(config=DEFAULT_CONFIG, port="COM3") as robot:
    # All joints to home position
    robot.go_home(time_ms=2000)

    # Move a single joint
    robot.set_joint("left_hip_pitch", position=350, time_ms=500)

    # Read all joint positions
    positions = robot.get_positions()
    print(positions)

Motion Teaching & Playback

from robotclaw import Robot, DEFAULT_CONFIG
from robotclaw.recorder import MotionRecorder, MotionPlayer

with Robot(config=DEFAULT_CONFIG, port="COM3") as robot:
    # Record a motion
    recorder = MotionRecorder(robot)
    recorder.start_recording("wave_hand")

    robot.unload_all()          # Let user pose the robot
    input("Press Enter to capture frame 1...")
    recorder.capture_frame()

    input("Press Enter to capture frame 2...")
    recorder.capture_frame()

    clip = recorder.finish_recording()
    recorder.save(clip, "motions/wave_hand.json")

    # Play it back at 1.5x speed
    robot.load_all()
    player = MotionPlayer(robot)
    player.play(clip, speed=1.5)

CLI Tools

# Scan for connected servos
robotclaw-scan --port COM3

# Interactive motion teaching
robotclaw-teach --port COM3

🧠 OpenClaw Integration

RobotClaw ships with a built-in OpenClaw skill that allows AI agents to control the robot through natural language commands:

You: "让机器人回到初始位置"
AI:  → robot.go_home(2000) ✅

You: "播放走路动作,2倍速"
AI:  → player.play(walk_clip, speed=2.0) ✅

You: "检查所有舵机的电压"
AI:  → robot.scan() → 报告电压状态 ✅

🔧 Hardware Requirements

Component Specification
Servos LOBOT LX-16A / LX-224 / LX-225 bus servos
Interface USB-to-TTL serial adapter
Baudrate 115200 (direct) or 9600 (controller board)
Power 6-8.4V DC, ≥5A for 10 servos
Default Config 10 servos, 5 per leg (biped)

📁 Project Structure

src/robotclaw/
├── __init__.py          # Public API exports
├── servo_bus.py         # LOBOT LX protocol driver
├── robot_config.py      # Hardware configuration
├── robot.py             # High-level robot controller
├── cli.py               # CLI entry points
├── openclaw_skill.py    # OpenClaw skill adapter
├── SKILL.md             # OpenClaw skill descriptor
└── recorder/            # Motion teaching subsystem
    ├── motion_data.py   # Keyframe & MotionClip models
    ├── recorder.py      # Motion recorder
    └── player.py        # Motion player

🤝 Contributing

Contributions are welcome! Please see the CHANGELOG for recent changes.

# Clone and install in development mode
git clone https://github.com/RobotBase/robotclaw.git
cd robotclaw
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

📄 License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotclaw-0.2.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotclaw-0.2.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file robotclaw-0.2.0.tar.gz.

File metadata

  • Download URL: robotclaw-0.2.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for robotclaw-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c730b05b8bf94c54f0aa25fae8776a91f3829b75826a377326fd52db4c1b76c
MD5 0f6f0c77e2107161c757b5f22c8f0770
BLAKE2b-256 7c2d71fad8e76f71fa21a1db5cd367afe99ffb957b95b1c0fab68873480db9f6

See more details on using hashes here.

File details

Details for the file robotclaw-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: robotclaw-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for robotclaw-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06b8242ac3ca18fffc3d3aeef794531563cdae03587ddc90f8234a54cce16bac
MD5 3915762ef8373d691c36849520bfac34
BLAKE2b-256 b4f93da8d979878f65441178fdd8dccf9c80c94fff3fce4fb35bb55e96288873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page