Openclaw 语音任务调用
我们视频里openclaw主要的作用是当作语音转任务的一个接口,所以我们写好基本的skills即可。
首先我们需要配置好openclaw的聊天软件,我们这里选择的是telegram。可以选择国内的微信、飞书,这里不做配置的赘述。
可以直接在对话框输入以下文本。但由于上下文记忆限制,openclaw可能会遗忘当前指令的触发条件。我们需要先配置好相关的--port和--policy.path,做好硬件设施的连接工作。让openclaw提前安装好语音识别模块,采用openai的whisper最低参数的模型就可以。
SQL
现在需要你记住一个事情,我给你发语音,内容大概是帮我抓水瓶,然后你就启动conda activate lerobot ,进入lerobot文件夹输入lerobot-record \
--robot.type=xlerobot \
--robot.disable_torque_on_disconnect=true \
--robot.port1=/dev/so101_follower_left \
--robot.port2=/dev/so101_follower_right \
--robot.id=joyandai_xlerobot \
--robot.cameras='{
left_wrist: {"type": "opencv", "index_or_path": 2, "width": 640, "height": 480, "fps": 30},
head: {"type": "opencv", "index_or_path": 0, "width": 640, "height": 360, "fps": 30},
right_wrist: {"type": "opencv", "index_or_path": 3, "width": 640, "height": 480, "fps": 30}
}' \
--display_data=false \
--dataset.push_to_hub=false \
--dataset.num_episodes=10 \
--dataset.single_task="Task description" \
--policy.path=outputs/pretrained_model \
--policy.device=cuda \
--dataset.repo_id=xlerobot/eval_biso101_test1 \
在输入之前需要检查一下.cache/huggingface/lerobot/xlerobot/eval_biso101_test1这个文件,如果有就要先删掉在启动代码。如果报错检测端口没有权限,自行给权限,摄像头的path有问题,则使用lerobot-find-cameras确定具体摄像头编号。代码结束标志为终端检测到没有推理输入的action,就开始停止代码运行。如果遇到硬件报错请告诉我也可以直接配置成skills,这样openclaw就不会遗忘
SQL
{
"name": "grab_water_bottle",
"description": "Skill to grab a water bottle using xLerobot, with automatic cache cleanup, port permissions, and camera detection.",
"triggers": [
{
"type": "voice_command",
"command": "帮我抓水瓶"
}
],
"steps": [
{
"name": "activate_conda",
"action": "shell",
"command": "conda activate lerobot"
},
{
"name": "enter_project_folder",
"action": "shell",
"command": "cd ~/lerobot"
},
{
"name": "check_and_remove_cache",
"action": "shell",
"command": "if [ -d ~/.cache/huggingface/lerobot/xlerobot/eval_biso101_test1 ]; then rm -rf ~/.cache/huggingface/lerobot/xlerobot/eval_biso101_test1; fi"
},
{
"name": "check_ports_and_permissions",
"action": "shell",
"command": "sudo chmod 666 /dev/so101_follower_left /dev/so101_follower_right"
},
{
"name": "verify_cameras",
"action": "shell",
"command": "lerobot-find-cameras"
},
{
"name": "start_lerobot_record",
"action": "shell",
"command": "lerobot-record \\\n --robot.type=xlerobot \\\n --robot.disable_torque_on_disconnect=true \\\n --robot.port1=/dev/so101_follower_left \\\n --robot.port2=/dev/so101_follower_right \\\n --robot.id=joyandai_xlerobot \\\n --robot.cameras='{\\\"left_wrist\\\": {\\\"type\\\": \\\"opencv\\\", \\\"index_or_path\\\": 2, \\\"width\\\": 640, \\\"height\\\": 480, \\\"fps\\\": 30}, \\\"head\\\": {\\\"type\\\": \\\"opencv\\\", \\\"index_or_path\\\": 0, \\\"width\\\": 640, \\\"height\\\": 360, \\\"fps\\\": 30}, \\\"right_wrist\\\": {\\\"type\\\": \\\"opencv\\\", \\\"index_or_path\\\": 3, \\\"width\\\": 640, \\\"height\\\": 480, \\\"fps\\\": 30}}' \\\n --display_data=false \\\n --dataset.push_to_hub=false \\\n --dataset.num_episodes=10 \\\n --dataset.single_task='抓水瓶' \\\n --policy.path=outputs/pretrained_model \\\n --policy.device=cuda \\\n --dataset.repo_id=xlerobot/eval_biso101_test1"
},
{
"name": "monitor_and_stop",
"action": "shell",
"command": "while true; do sleep 1; # 监控终端输出,检测没有推理输入的action时停止\n if grep -q 'No action input detected' /tmp/lerobot_record.log; then pkill -f lerobot-record; break; fi\n done"
},
{
"name": "handle_hardware_errors",
"action": "notification",
"message": "如果遇到硬件报错,请检查机器人连接和电源状态,并重新运行本技能。"
}
]
}