LeRobot-SO100双臂入门教程-校准机械臂
说明:
介绍如何校准LeRobot-SO100双臂
校准时,先校准其中一套主臂和从臂,然后保存校准文件,修改文件名:left_follower.json , left_leader.json
然后,再校准另一套主臂和从臂,保存标准文件,修改文件名:right_follower.json , right_leader.json
修改配置文件configs.py
步骤:
- 加载lerobot环境
conda activate lerobot
- 注意:校准机械臂前,确保删除之前的校准文件main_follower.json,main_leader.json,以防止旧数据干扰新的校准过程
cd ~/lerobot/.cache/calibration/so100
rm right_follower.json right_leader.json
rm left_follower.json left_leader.json
- 注意:在校准机械臂的时候,需要确保校准每个姿势之间,保持更长的时间,以便它捕捉到正确的位置
校准左侧主从机械臂:
校准从臂:
- 进入lerobot目录
cd ~/lerobot
- 校准从臂(follower arm),每做好一个姿势,就按回车键。将从臂按顺序移动到以下位置
python3 ~/lerobot/lerobot/scripts/control_robot.py \
--robot.type=so100 \
--robot.cameras='{}' \
--control.type=calibrate \
--control.arms='["main_follower"]'
- 校准完成后的文件保存在当前目录
~/lerobot/.cache/calibration/so100/main_follower.json
- 生成的校准文件main_follower.json的内容如下,修改文件名为left_follower.json:
{"homing_offset": [-2153, -1056, 2141, -2075, 929, -1112], "drive_mode": [0, 0, 1, 0, 1, 0], "start_pos": [2135, 891, 2177, 2875, 925, 947], "end_pos": [3177, 2080, -1117, 3099, 95, 2136], "calib_mode": ["DEGREE", "DEGREE", "DEGREE", "DEGREE", "DEGREE", "LINEAR"], "motor_names": ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]}
- 生成的校准文件main_leader.json的内容如下,修改文件名为left_leader.json:
{"homing_offset": [-2072, -2115, 2218, -2187, 3008, -1531], "drive_mode": [0, 0, 1, 0, 1, 0], "start_pos": [2062, 1964, 2244, 2658, 3038, 1428], "end_pos": [3096, 3139, -1194, 3211, -1984, 2555], "calib_mode": ["DEGREE", "DEGREE", "DEGREE", "DEGREE", "DEGREE", "LINEAR"], "motor_names": ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]}
- 校准过程如下:
Calibration file not found '.cache/calibration/so100/main_follower.json'
Connecting main follower arm.
Connecting main leader arm.
Missing calibration file '.cache/calibration/so100/main_follower.json'
Running calibration of so100 main follower...
Move arm to zero position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_zero.webp
Press Enter to continue...
Move arm to rotated target position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_rotated.webp
Press Enter to continue...
Move arm to rest position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_rest.webp
Press Enter to continue...
Calibration is done! Saving calibration file '.cache/calibration/so100/main_follower.json'
Missing calibration file '.cache/calibration/so100/main_leader.json'
Running calibration of so100 main leader...
Move arm to zero position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_zero.webp
Press Enter to continue...
Move arm to rotated target position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_rotated.webp
Press Enter to continue...
Move arm to rest position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_rest.webp
Press Enter to continue...
Calibration is done! Saving calibration file '.cache/calibration/so100/main_leader.json'
Activating torque on main follower arm.
Calibration is done! You can now teleoperate and record datasets!
- 以上执行程序的参数含义:
--robot.type=so100 : 指定机器人类型so100
--robot.cameras='{}' : 用于配置机器人所搭载的摄像头
--control.type=calibrate : 表明要对机器人进行校准操作
--control.arms='["main_follower"]' : 指定要控制的从臂
校准右侧主从机械臂:
校准从臂:
- 进入lerobot目录
cd ~/lerobot
- 校准从臂(follower arm),每做好一个姿势,就按回车键。将从臂按顺序移动到以下位置
python3 ~/lerobot/lerobot/scripts/control_robot.py \
--robot.type=so100 \
--robot.cameras='{}' \
--control.type=calibrate \
--control.arms='["main_follower"]'
- 校准完成后的文件保存在当前目录
~/lerobot/.cache/calibration/so100/main_follower.json
- 生成的校准文件main_follower.json的内容如下,修改文件名为right_follower.json:
{"homing_offset": [-2161, -2097, 2174, -2111, 1169, -1230], "drive_mode": [0, 0, 1, 0, 1, 0], "start_pos": [2131, 1966, 2140, 2921, 1121, 940], "end_pos": [3185, 3121, -1150, 3135, -145, 2254], "calib_mode": ["DEGREE", "DEGREE", "DEGREE", "DEGREE", "DEGREE", "LINEAR"], "motor_names": ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]}
- 生成的校准文件main_leader.json的内容如下,修改文件名为right_leader.json:
{"homing_offset": [-1928, -2019, 2111, -2088, 1982, -1482], "drive_mode": [0, 0, 1, 0, 1, 0], "start_pos": [1953, 1881, 2105, 2630, 1944, 1336], "end_pos": [2952, 3043, -1087, 3112, -958, 2506], "calib_mode": ["DEGREE", "DEGREE", "DEGREE", "DEGREE", "DEGREE", "LINEAR"], "motor_names": ["shoulder_pan", "shoulder_lift", "elbow_flex", "wrist_flex", "wrist_roll", "gripper"]}
- 校准过程如下:
Calibration file not found '.cache/calibration/so100/main_follower.json'
Connecting main follower arm.
Connecting main leader arm.
Missing calibration file '.cache/calibration/so100/main_follower.json'
Running calibration of so100 main follower...
Move arm to zero position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_zero.webp
Press Enter to continue...
Move arm to rotated target position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_rotated.webp
Press Enter to continue...
Move arm to rest position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/follower_rest.webp
Press Enter to continue...
Calibration is done! Saving calibration file '.cache/calibration/so100/main_follower.json'
Missing calibration file '.cache/calibration/so100/main_leader.json'
Running calibration of so100 main leader...
Move arm to zero position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_zero.webp
Press Enter to continue...
Move arm to rotated target position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_rotated.webp
Press Enter to continue...
Move arm to rest position
See: https://raw.githubusercontent.com/huggingface/lerobot/main/media/so100/leader_rest.webp
Press Enter to continue...
Calibration is done! Saving calibration file '.cache/calibration/so100/main_leader.json'
Activating torque on main follower arm.
Calibration is done! You can now teleoperate and record datasets!
- 以上执行程序的参数含义:
--robot.type=so100 : 指定机器人类型so100
--robot.cameras='{}' : 用于配置机器人所搭载的摄像头
--control.type=calibrate : 表明要对机器人进行校准操作
--control.arms='["main_follower"]' : 指定要控制的从臂
- 修改config.py配置文件
/home/ubuntu/lerobot/lerobot/common/robot_devices/robots/configs.py
@RobotConfig.register_subclass("so100")
@dataclass
class So100RobotConfig(ManipulatorRobotConfig):
calibration_dir: str = ".cache/calibration/so100"
# `max_relative_target` limits the magnitude of the relative positional target vector for safety purposes.
# Set this to a positive scalar to have the same value for all motors, or a list that is the same length as
# the number of motors in your follower arms.
max_relative_target: int | None = None
leader_arms: dict[str, MotorsBusConfig] = field(
default_factory=lambda: {
"left": FeetechMotorsBusConfig(
port="/dev/ttyACM3",
motors={
# name: (index, model)
"shoulder_pan": [1, "sts3215"],
"shoulder_lift": [2, "sts3215"],
"elbow_flex": [3, "sts3215"],
"wrist_flex": [4, "sts3215"],
"wrist_roll": [5, "sts3215"],
"gripper": [6, "sts3215"],
},
),
"right": FeetechMotorsBusConfig(
port="/dev/ttyACM2",
motors={
# name: (index, model)
"shoulder_pan": [1, "sts3215"],
"shoulder_lift": [2, "sts3215"],
"elbow_flex": [3, "sts3215"],
"wrist_flex": [4, "sts3215"],
"wrist_roll": [5, "sts3215"],
"gripper": [6, "sts3215"],
},
),
}
)
follower_arms: dict[str, MotorsBusConfig] = field(
default_factory=lambda: {
"left": FeetechMotorsBusConfig(
port="/dev/ttyACM1",
motors={
# name: (index, model)
"shoulder_pan": [1, "sts3215"],
"shoulder_lift": [2, "sts3215"],
"elbow_flex": [3, "sts3215"],
"wrist_flex": [4, "sts3215"],
"wrist_roll": [5, "sts3215"],
"gripper": [6, "sts3215"],
},
),
"right": FeetechMotorsBusConfig(
port="/dev/ttyACM0",
motors={
# name: (index, model)
"shoulder_pan": [1, "sts3215"],
"shoulder_lift": [2, "sts3215"],
"elbow_flex": [3, "sts3215"],
"wrist_flex": [4, "sts3215"],
"wrist_roll": [5, "sts3215"],
"gripper": [6, "sts3215"],
},
),
}
)
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号