Files
chenlin 3ad29356c9
web-platform-ci / TypeScript, lint, unit, build (push) Has been cancelled
web-platform-ci / Playwright E2E (push) Has been cancelled
lekiwi-compatibility / cpu-compatibility (push) Has been cancelled
feat(lekiwi): release V0.10.1 初步集成 LeKiwi,优化碰撞模型
集成通用机器人数值接口、本机控制桥、LeRobot 插件和统一键盘遥操作。采用离线 CoACD 全臂碰撞配方 revision 4、局部装配区切分与结构自接触,限制直接关节位姿写入并保留安全看门狗。同步版本号、变更记录、来源许可证和兼容性验证。
2026-09-20 14:42:30 +08:00

36 lines
2.3 KiB
Markdown

# LeRobot 仿真插件
真实 LeRobot **0.6.1** 的 `Robot` 子类与 `RobotConfig`,注册名 `lekiwi_sim`,发行包名 **`lerobot_robot_mujoco`**。上游按发行包名前缀发现插件,因此不能随意改成连字符名称或只提供自定义 entry point。
```bash
source .venv/bin/activate # Python 3.12;只用它创建隔离环境
python examples/lekiwi/setup_lerobot.py
# 不要在原训练环境直接 pip install lerobot
build/venvs/lerobot/bin/python -m unittest discover -s integrations/lerobot/tests -v
```
安装脚本仅修改 `build/venvs/lerobot/`,先装官方 CPU torch/torchvision,再装 [固定兼容集](requirements-cpu.txt),最后 editable 安装桥接和本插件并执行 `pip check`。版本记录在 `build/lerobot-environment.json`;不会改上游或原 `.venv` 的训练依赖。
先按 [示例](../../examples/lekiwi/README.md) 准备模型、连接桥接并在浏览器授权。相同 token 放在 Python 的 `MUJOCO_CONTROL_TOKEN` 环境变量中:
```python
from lerobot.robots.config import RobotConfig
from lerobot.robots.utils import make_robot_from_config
from lerobot.utils.import_utils import register_third_party_plugins
register_third_party_plugins()
config_type = RobotConfig.get_choice_class('lekiwi_sim')
robot = make_robot_from_config(config_type(endpoint='http://127.0.0.1:8766', id='sim-demo'))
robot.connect()
try:
measured = robot.get_observation()
accepted = robot.send_action({'x.vel': 0.05})
diagnostic = robot.get_sim_observation()
finally:
robot.disconnect()
```
这是单步 API 演示;实际控制须持续刷新(示例为 30 Hz),不能在两条动作之间阻塞超过 500 ms。`send_action` 返回确认目标,`get_observation` 才是实测反馈。五个臂通道为度,夹爪 0–100,底盘平移 m/s、转动 deg/s。部分动作保持最后确认的臂/夹爪目标,省略的底盘速度为零。
仅接受 `use_degrees=True`、`cameras={}`;拒绝物理校准目录和校准文件 I/O。`is_calibrated=True` 表示固定仿真 profile 可用,不代表硬件标定。提供 `stop_base`、键盘辅助函数和完整 SI 诊断,但没有实体 leader、串口、ZMQ、相机、dataset 或训练实现。协议/来源/升级流程见 [机器人接口](../../docs/robot-interface.md),许可证和上游归属见 [NOTICE](NOTICE.md)。