软件和SDK
安装和配置LinkerBot O6 SDK,ROS2控制器和LeRobot集成. 联合控制在Python中. 工作空间限制和扭矩管理. ~ 2 小时.
五个单元中的第二个 · 软件和SDK · ~2小时
设置完整的软件堆
步骤1:Python SDK和虚拟环境
# Create a dedicated venv for the O6
python3 -m venv ~/o6-env
source ~/o6-env/bin/activate
# Install the LinkerBot SDK and data dependencies
pip install roboticscenter lerobot numpy torch torchvision
# Verify the import works
python3 -c "from roboticscenter.o6 import O6Robot; print('SDK OK')"
步骤 2: ROS2 控制器设置
链接Bot ROS2 包将O6作为一个标准的
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
git clone https://github.com/roboticscenter/linkerbot_ros2.git
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source install/setup.bash
启动控制器,用连接的手臂:
ros2 launch linkerbot_bringup o6_bringup.launch.py \
can_interface:=can0
在第二个终端,确认联合国家主题发布:
source ~/ros2_ws/install/setup.bash
ros2 topic echo /joint_states --once
步骤3:共同限制的参考
| Joint | Min (rad) | Max (rad) | Max Vel (rad/s) |
|---|---|---|---|
| Joint 1 (base rotation) | -3.14 | +3.14 | 1.5 |
| Joint 2 (shoulder) | -2.09 | +2.09 | 1.5 |
| Joint 3 (elbow) | -2.62 | +2.62 | 1.5 |
| Joint 4 (forearm roll) | -3.14 | +3.14 | 2.0 |
| Joint 5 (wrist pitch) | -1.57 | +1.57 | 2.0 |
| Joint 6 (wrist roll) | -3.14 | +3.14 | 2.0 |
第四步: 运行一个脚本轨迹
这样验证了所有6个关节都响应了位置命令.
from roboticscenter.o6 import O6Robot
import time
robot = O6Robot(can_interface="can0")
robot.connect()
robot.enable_torque()
# Move to a pre-reach position
print("Moving to pre-reach...")
robot.move_joints(
positions=[0.0, -0.5, 1.0, 0.0, 0.5, 0.0], # radians
speed_fraction=0.2
)
time.sleep(3)
# Reach forward (extend joint 2 and 3)
print("Reaching forward...")
robot.move_joints(
positions=[0.0, -1.0, 1.5, 0.0, 0.5, 0.0],
speed_fraction=0.2
)
time.sleep(3)
# Return to home
print("Returning to home...")
robot.move_to_home(speed_fraction=0.2)
time.sleep(3)
robot.disable_torque()
robot.disconnect()
print("Trajectory complete")
步骤5: LeRobot SDK 集成
确认LeRobot可以使用提供的机器人配置与O6通信:
python3 -c "
from lerobot.common.robot_devices.robots.factory import make_robot
robot = make_robot('linker_bot_o6')
robot.connect()
obs = robot.capture_observation()
print('Observation keys:', list(obs.keys()))
robot.disconnect()
"
如果您看到一个T11
单元2完成,当...
编程轨迹通过两个路线点运行所有6个关节,然后返回家园.LeRobot的
[← 回到路径概述]







