lekiwi+Orin Nano环境搭建
环境准备
简要记录在Orin nano平台搭建lekiwi环境,可以远程遥控底盘移动和机械臂示教的过程,需要的硬件如下:
– NVIDIA Jetson Orin Nano开发板
– Lekiwi套件(底盘、主从机械臂)
– PC,预装好Ubuntu系统
组装硬件
将底盘、主从机械臂、Orin nano组装好,需要注意的是由于官方默认使用的计算平台是树莓派,所以默认提供的供电接口是USB 5V。我们这里使用的Orin Nano平台,使用的是DC5525电源接口,因此需要提前购买准备DC5521 to DC5525的转接线。
详细组装可以参考
(1)https://github.com/SIGRobotics-UIUC/LeKiwi/blob/main/Assembly.md
(2)https://huggingface.co/docs/lerobot/so101#step-by-step-assembly-instructions
Orin nano
首先,首次启动先接上键盘、鼠标、显示器登录配置好网络和VNC。
sudo apt update
sudo apt install vino
# 设置vino开机自启
mkdir -p ~/.config/autostart
cp /usr/share/applications/vino-server.desktop ~/.config/autostart/.
cd /usr/lib/systemd/user/graphical-session.target.wants
sudo ln -s ../vino-server.service ./.
# 调整共享/认证设置
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
# 设置密码,默认thepassword
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'thepassword'|base64)
# 然后重启就可以使用VNC viewer访问了
sudo reboot
其次,安装conda 环境,由于Jetson架构是aarch64,所以下载miniconda aarch64的版本。
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh
sh Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
PC ubunut
同理安装conda环境,与jetson不一样的是,PC是X86架构。
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
软件安装
代码下载
在Orin nano和PC ubuntu上各自从github上克隆开源代码。
git clone https://github.com/huggingface/lerobot.git
配置安装
首先,在Orin nano和PC ubuntu上各自创建lekiwi的环境。
conda create -n lekiwi python=3.10
conda activate lekiwi
其次,切到lerobot环境下进行安装
cd lerobot
pip install -e ".[feetech]"
conda install -c conda-forge ffmpeg=7.1.1
遥操作
标定
需要给主臂、从臂进行标定,以限制关节的最大运动范围。在标定前,可以先看看视频怎么操作机械臂https://huggingface.co/docs/lerobot/so101#calibrate
(1)从臂的运行命令如下
lerobot-calibrate \
--robot.type=lekiwi \
--robot.id=R1225280 \
--robot.cameras='{handeye: {type: opencv, index_or_path: 0, width: 640, height: 360, fps: 30}}'
标定的文件
(2)主臂的运行命令如下:
lerobot-calibrate \
--teleop.type=so101_leader \
--teleop.port=/dev/ttyACM0 \
--teleop.id=R07252801
(3)标定好后会在下面路径存储标定的参数
# orin nano平台
~/.cache/huggingface/lerobot/calibration/robots/lekiwi/R1225280.json
# ubuntu平台
~/.cache/huggingface/lerobot/calibration/teleoperators/so101_leader/R07252801.json
遥控
(1)由于PC和lekiwi之前的遥控使用的是gRPC,所以需要先安装zmq,否则会报错。
pip install zmq
(2)orin nano启动命令,host.connection_time_s设置的是时间(单位是秒),超过这个时间会自动断开。
python -m lerobot.robots.lekiwi.lekiwi_host \
--robot.id=R1225280 \
--robot.cameras='{handeye: {type: opencv, index_or_path: 0, width: 640, height: 360, fps: 30}}' \
--host.connection_time_s=300
(3)PC ubuntu需要修改示例代码,修改点如下:
diff --git a/examples/lekiwi/teleoperate.py b/examples/lekiwi/teleoperate.py
index 6b430df4..cb4ad415 100644
--- a/examples/lekiwi/teleoperate.py
+++ b/examples/lekiwi/teleoperate.py
@@ -18,20 +18,20 @@ import time
from lerobot.robots.lekiwi import LeKiwiClient, LeKiwiClientConfig
from lerobot.teleoperators.keyboard.teleop_keyboard import KeyboardTeleop, KeyboardTeleopConfig
-from lerobot.teleoperators.so100_leader import SO100Leader, SO100LeaderConfig
+from lerobot.teleoperators.so101_leader import SO101Leader, SO101LeaderConfig
from lerobot.utils.robot_utils import busy_wait
from lerobot.utils.visualization_utils import init_rerun, log_rerun_data
FPS = 30
# Create the robot and teleoperator configurations
-robot_config = LeKiwiClientConfig(remote_ip="172.18.134.136", id="my_lekiwi")
-teleop_arm_config = SO100LeaderConfig(port="/dev/tty.usbmodem585A0077581", id="my_awesome_leader_arm")
+robot_config = LeKiwiClientConfig(remote_ip="192.168.0.33", id="my_lekiwi")
+teleop_arm_config = SO101LeaderConfig(port="/dev/ttyACM0", id="R07252801")
keyboard_config = KeyboardTeleopConfig(id="my_laptop_keyboard")
# Initialize the robot and teleoperator
robot = LeKiwiClient(robot_config)
-leader_arm = SO100Leader(teleop_arm_config)
+leader_arm = SO101Leader(teleop_arm_config)
keyboard = KeyboardTeleop(keyboard_config)
- 将SO100改成SO101,因为我们的主臂使用的是SO101
- 将remote_ip改成jetson nano的ip
- 配置好SO101的uart端口和标定的文件
(4)PC ubunut执行命令
python examples/lekiwi/teleoperate.py
之后就可以使用键盘和主臂进行遥控操作了。
| Key | Action |
|---|---|
| W | 前进 |
| S | 后退 |
| A | 左移 |
| D | 右移 |
| Z | 左转(逆时针) |
| X | 右转(顺时针) |
| R | 加速一档 |
| F | 减速一档 |
