# install lerobot-joycon2 conda create -y -n lerobot python=3.10 conda activate lerobot conda install -y ffmpeg -c conda-forge conda install -y ffmpeg=7.1.1 -c conda-forge # cd lerobot-joycon2 pip install -e . pip install lerobot pip install 'lerobot[feetech]' # Feetech motor support # pip install transformers # pip install num2words -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package pip install -e ".[smolvla]" -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package # install joycon robotics # git clone https://github.com/box2ai-robotics/joycon-robotics.git cd joycon-robotics pip install -e . sudo apt-get update sudo apt-get install -y dkms libevdev-dev libudev-dev cmake make install cd .. # install lerobot-kinematics # git clone https://github.com/box2ai-robotics/lerobot-kinematics.git cd lerobot-kinematics pip install -e . cd .. pip uninstall -y numpy pynput datasets pip install numpy==1.24.4 pynput==1.7.7 datasets==3.4.1
插入您的机械臂的电源和TypeC-USB,运行下面的指令
# python -m lerobot.find_port # 默认是ACM0
sudo chmod 777 /dev/ttyACM0
python -m lerobot.calibrate --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=follower然后按照下面的操作执行:
- 将机械臂扳动到0位后,按下回车:
-
移动每个关节通过其全范围的运动得到其所有关节可达范围
-
观察最大最小值是否正常,然后按下回车即校准完毕,程序会自动保存校准文件到
~/.cache/huggingface/lerobot/calibration/robots/so101_follower/follower.json中.(下按【ctrl+h】打开隐藏文件)
python -m lerobot.teleoperate --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=follower --teleop.type=joycon
查找相机:您可以在【~/workspace/smolvla/lerobot/outputs/captured_images】找到你的相机所对应的序号
python -m lerobot.find_cameras opencv
带图像的遥操作
python -m lerobot.teleoperate --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=follower --robot.cameras="{ OBS_IMAGE_1: {type: opencv, index_or_path: 2, width: 640, height: 480, fps: 60}}" --teleop.type=joycon --display_data=truepython -m lerobot.record --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=follower --robot.cameras="{ OBS_IMAGE_1: {type: opencv, index_or_path: 2, width: 640, height: 480, fps: 60}}" --dataset.single_task="Grasp an orange block and put it in the box." --dataset.repo_id=Datasets/grasp_put --dataset.episode_time_s=30 --dataset.reset_time_s=10 --dataset.num_episodes=50 --teleop.type=joycon
加载HF官网镜像,为了更快地正确部署huggingface官网的smolvla_base模型
export HF_ENDPOINT=https://hf-mirror.compython lerobot/scripts/train.py --policy.path=lerobot/smolvla_base --dataset.repo_id=Datasets/grasp_put --batch_size=8 --steps=20000 --output_dir=outputs/train/smolvla --job_name=smolvla_training --policy.device=cuda
同时您也可以采集多个数据集协同训练,修改语言标签采集数据,最后一个模型根据不同的语言输入区分不同的任务:这才是真正体现它在作为VLA模型的优势所在(但是需要较多的数据集和较长时间的训练才能达到一个比较好的效果)
python lerobot/scripts/train.py --policy.path=lerobot/smolvla_base --dataset.repo_id={Datasets/grasp_put1,Datasets/grasp_put2} --batch_size=8 --steps=20000 --output_dir=outputs/train/smolvla --job_name=smolvla_training --policy.device=cudapython -m lerobot.record --robot.type=so101_follower --robot.port=/dev/ttyACM0 --robot.id=follower --robot.cameras="{ OBS_IMAGE_1: {type: opencv, index_or_path: 4, width: 640, height: 480, fps: 60}}" --dataset.single_task="Grasp an orange block and put it in the box." --dataset.repo_id=Datasets/eval_grasp_put_orange --dataset.episode_time_s=300 --dataset.reset_time_s=10 --dataset.num_episodes=50 --policy.path=/home/sml/workspace/SMOLVLA/lerobot/outputs/train/20kob_smolvla/checkpoints/last/pretrained_model
Written by BOX2AI SML 2025.7.28
