إعداد البرامج
تثبيت SDK، وواجهة التحكم في الجسم بالكامل ROS2، وقراءة الحالة المشتركة والقيادة، وأساسيات API للحركة، ومحاكاة MuJoCo البشرية، وأهم 3 مشكلات لاستكشاف الأخطاء وإصلاحها.
انتقل إلى القسم:
تثبيت الداعم SDK
يتم توزيع Booster SDK كـ booster_robotics_sdk_python على باي بي آي. يوفر روابط Python لواجهة التحكم في الشبكة الخاصة بـ K1.
إنشاء بيئة افتراضية (مستحسن)
python3 -m venv ~/.venvs/booster-k1
source ~/.venvs/booster-k1/bin/activate
قم بتثبيت SDK
pip install booster_robotics_sdk_python
التحقق من التثبيت
python3 -c "import booster_robotics_sdk; print('SDK ready')"
تكوين الشبكة
يتصل K1 عبر شبكة إيثرنت سلكية. قم بتكوين واجهة شبكة الكمبيوتر المضيف الخاص بك قبل الاتصال:
# Set your PC's Ethernet interface to 192.168.10.10
sudo ip addr add 192.168.10.10/24 dev eth0
sudo ip link set eth0 up
# Verify connectivity to the K1
ping 192.168.10.102
واجهة التحكم لكامل الجسم ROS2
يأتي K1 مزودًا بعقدة جسر ROS2 التي تعرض جميع المفاصل كمعيار قياسي ros2_control واجهة الأجهزة. يتيح ذلك التكامل مع MoveIt2 ومخططي المسار ووحدات التحكم المخصصة.
تثبيت ROS2 المتواضع
sudo apt update && sudo apt install software-properties-common curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | \
sudo apt-key add -
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu jammy main" \
> /etc/apt/sources.list.d/ros2.list'
sudo apt update
sudo apt install ros-humble-desktop ros-humble-ros2-control \
ros-humble-ros2-controllers ros-humble-joint-state-publisher-gui -y
استنساخ وبناء حزمة K1 ROS2
mkdir -p ~/k1_ws/src && cd ~/k1_ws/src
git clone https://github.com/BoosterRobotics/booster_ros2.git
cd ~/k1_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-install
إطلاق جسر K1
source ~/k1_ws/install/setup.bash
ros2 launch booster_ros2 k1_bringup.launch.py \
robot_ip:=192.168.10.102
تفقد الدول المشتركة
# List all available topics
ros2 topic list
# Stream joint states (22 joints at 500 Hz)
ros2 topic echo /joint_states
قراءة وقيادة الدول المشتركة
يوفر Python SDK الوصول المباشر إلى جميع المفاصل الـ 22. ابدأ دائمًا في وضع DAMP قبل الأمر بالحركة.
ربط وقراءة الدول المشتركة
from booster_robotics_sdk import BoosterRobot, RobotMode
# Connect to the robot
robot = BoosterRobot(ip="192.168.10.102")
robot.connect()
# Enter DAMP mode (safe, low impedance)
robot.set_mode(RobotMode.DAMP)
# Read full joint state
state = robot.get_state()
print(f"Mode: {state.mode}")
print(f"Joint positions (rad): {state.joint_positions}")
print(f"Joint velocities (rad/s): {state.joint_velocities}")
print(f"Joint torques (Nm): {state.joint_torques}")
print(f"IMU euler (deg): {state.imu_euler}")
robot.disconnect()
مواضع مفصل ذراع القيادة (الوضع المخصص)
يسمح الوضع المخصص بالتحكم المباشر على مستوى المفصل في الذراع. يتطلب أداة رفع - يجب ألا يدعم الروبوت وزنه. انظر صفحة السلامة.
from booster_robotics_sdk import BoosterRobot, RobotMode, ArmCommand
import numpy as np
robot = BoosterRobot(ip="192.168.10.102")
robot.connect()
# Transition: DAMP -> PREP -> CUSTOM
robot.set_mode(RobotMode.DAMP)
robot.set_mode(RobotMode.PREP)
import time; time.sleep(3) # Wait for PREP stabilization
robot.set_mode(RobotMode.CUSTOM)
# Command right arm to a target configuration (7 DOF)
# Joints: shoulder_pitch, shoulder_roll, shoulder_yaw,
# elbow_pitch, wrist_pitch, wrist_roll, wrist_yaw
target = [0.0, -0.3, 0.0, 0.8, 0.0, 0.0, 0.0]
cmd = ArmCommand(side="right", joint_positions=target, kp=60, kd=2)
robot.send_arm_command(cmd)
robot.disconnect()
التحكم في وضعية الرأس
from booster_robotics_sdk import BoosterRobot, HeadCommand
robot = BoosterRobot(ip="192.168.10.102")
robot.connect()
robot.set_mode(RobotMode.PREP)
# Head: yaw in [-90, 90] deg, pitch in [-40, 30] deg
cmd = HeadCommand(yaw_deg=15.0, pitch_deg=-10.0)
robot.send_head_command(cmd)
robot.disconnect()
أساسيات واجهة برمجة تطبيقات الحركة
تدير وحدة التحكم في الحركة في K1 التوازن والمشية بشكل مستقل. أنت تتحكم في أهداف السرعة؛ تتعامل وحدة التحكم الموجودة على اللوحة مع الاستقرار. لديك دائما نصاب الحاضر.
تسلسل انتقال الوضع
from booster_robotics_sdk import BoosterRobot, RobotMode, LocomotionCommand
import time
robot = BoosterRobot(ip="192.168.10.102")
robot.connect()
# Step 1: Enter DAMP (zero torque, safe to handle)
robot.set_mode(RobotMode.DAMP)
time.sleep(1)
# Step 2: Enter PREP (stand up to PREP posture)
robot.set_mode(RobotMode.PREP)
time.sleep(5) # Wait for full PREP stabilization — do not skip
# Step 3: Enter WALK
robot.set_mode(RobotMode.WALK)
time.sleep(2)
حركة القيادة (وضع السرعة)
# Walk forward at 0.3 m/s
cmd = LocomotionCommand(
vx=0.3, # forward/back (m/s), range: [-0.5, 0.5]
vy=0.0, # lateral (m/s), range: [-0.3, 0.3]
vyaw=0.0 # rotation (rad/s), range: [-1.0, 1.0]
)
robot.send_locomotion_command(cmd)
time.sleep(2)
# Stop
robot.send_locomotion_command(LocomotionCommand(vx=0, vy=0, vyaw=0))
time.sleep(1)
# Return to PREP then DAMP
robot.set_mode(RobotMode.PREP)
time.sleep(3)
robot.set_mode(RobotMode.DAMP)
robot.disconnect()
توقف الطوارئ في البرمجيات
# Call from any thread — immediately enters DAMP mode
robot.emergency_stop()
تفضل دائمًا زر الإيقاف الإلكتروني للأجهزة في حالات الطوارئ. برنامج التوقف الإلكتروني هو نسخة احتياطية فقط.
MuJoCo محاكاة الإنسان
تم تضمين نموذج K1 URDF في SDK. استخدم MuJoCo لتطوير واختبار سياسات الحركة والمعالجة قبل نشر الأجهزة.
قم بتثبيت MuJoCo
pip install mujoco
استنساخ بيئة الصالة الرياضية K1
git clone https://github.com/BoosterRobotics/booster_gym.git
cd booster_gym
pip install -e .
قم بتشغيل محاكاة المشي
python examples/walk_sim.py --render
إسحاق سيم (متقدم)
يوفر NVIDIA Isaac Sim محاكاة متوازية تسريعها بواسطة GPU للتدريب على السياسات على نطاق واسع. يتم استيراد K1 URDF بشكل نظيف إلى Isaac Sim 4.x. يتطلب وحدة معالجة الرسومات NVIDIA (يوصى باستخدام ذاكرة فيديو بسعة 16 جيجابايت) وترخيص Isaac Sim. انظر مقالة مقارنة بين البشر لمعايير المحاكاة.
محاذاة Sim-to-Real — يشتمل نموذج K1 MuJoCo على معلمات القصور الذاتي المُعايرة وحدود المفاصل التي تتوافق مع الأجهزة الحقيقية. يمكن نشر السياسات التي تم تدريبها على المحاكاة بأقل قدر من ضبط الكسب.
أهم 3 مشكلات لإعداد Humanoid
Connection refused / ping timeout
القضية الأكثر شيوعا. دائمًا ما يكون هناك خطأ في تكوين الشبكة على جانب الكمبيوتر المضيف.
يصلح:
# 1. Verify your PC's interface is on the correct subnet
ip addr show eth0
# Should show 192.168.10.10/24
# 2. Set it if not configured
sudo ip addr flush dev eth0
sudo ip addr add 192.168.10.10/24 dev eth0
sudo ip link set eth0 up
# 3. Ping the robot
ping -c 4 192.168.10.102
# 4. If ping fails, verify the K1 is fully booted
# The K1 takes ~60 seconds to boot. Look for the LED sequence
# to complete before attempting connection.
يتطلب K1 3 ثوانٍ على الأقل في الإعدادية حتى تتم تهيئة وحدة التحكم في التوازن. يعد الانتقال السريع جدًا هو السبب الأكثر شيوعًا للسقوط أثناء الإعداد الأول.
يصلح:
# Always wait at least 5 seconds in PREP before WALK
robot.set_mode(RobotMode.PREP)
time.sleep(5) # Do not reduce this
# Verify PREP is fully active before proceeding
state = robot.get_state()
assert state.mode == RobotMode.PREP, "PREP not confirmed"
# Have your spotter positioned with the e-stop
robot.set_mode(RobotMode.WALK)
hardware interface not found
لا يمكن لجسر ROS2 العثور على واجهة جهاز K1. عادةً ما يكون السبب هو فقدان الحزم أو عنوان IP غير صحيح للروبوت في ملف التشغيل.
يصلح:
# 1. Install missing ros2_control packages
sudo apt install ros-humble-ros2-control \
ros-humble-ros2-controllers -y
# 2. Rebuild the workspace
cd ~/k1_ws && colcon build --symlink-install
# 3. Source both ROS2 and your workspace
source /opt/ros/humble/setup.bash
source ~/k1_ws/install/setup.bash
# 4. Verify robot_ip matches actual K1 IP
ros2 launch booster_ros2 k1_bringup.launch.py \
robot_ip:=192.168.10.102
# 5. Check the K1 is connected and responding
ping 192.168.10.102
لا تزال عالقة؟ مشاركة في منتدى SVRC مع إصدار Ubuntu الخاص بك ورسالة الخطأ الدقيقة وإصدار SDK (pip show booster_robotics_sdk_python).