3.7 단계별 실습
[SIM] 실습 1: FK와 DLS IK
상세 지시서는 실습 3-1: FK와 DLS IK에 있다.
cd ebook/book/03_so101_kinematics_teleop
python3 -m venv .venv
source .venv/bin/activate
python -m pip install numpy
python code/fk_dls_ik.py
예상 출력 예시
target position [m] : [0.2200 0.0600 0.1800]
converged : True
iterations : 7
position error [m] : 0.000640
solution [deg] : [ 15.3 10.6 63.0 -43.3 0.0]
수치는 NumPy 버전, 초기 자세, 교육용 파라미터에 따라 달라질 수 있다.
[SIM] [SAFETY] 실습 2: 안전 필터 dry-run
상세 지시서는 실습 3-2: Leader-Follower 안전 필터에 있다.
python code/safe_teleop_core.py
예상 출력 예시
frame=0 status=ALIGNING command=[0.01, -0.01, 0.01, -0.01, 0.02, 2.00]
frame=1 status=ALIGNING command=[0.02, -0.02, 0.02, -0.03, 0.04, 4.00]
frame=2 status=ALIGNING command=[0.03, -0.03, 0.04, -0.04, 0.06, 6.00]
frame=3 status=ALIGNING command=[0.04, -0.04, 0.05, -0.06, 0.08, 8.00]
watchdog status=HOLD reason=leader stream stale
[SIM→HW] [SAFETY] 실습 3: ROS 2 브리지
상세 지시서는 실습 3-3: ROS 2 JointState 안전 브리지에 있다.
cd code/ros2_ws
source /opt/ros/jazzy/setup.bash
colcon build --symlink-install
source install/setup.bash
ros2 run so101_training_bridge safe_joint_bridge
다른 터미널에서 교육용 Leader 상태를 한 번 발행한다.
ros2 topic pub --once /leader/joint_states sensor_msgs/msg/JointState \
"{header: {frame_id: 'leader'}, name: ['shoulder_pan','shoulder_lift','elbow_flex','wrist_flex','wrist_roll','gripper'], position: [0.1,-0.2,0.4,-0.1,0.0,50.0]}"
예상 출력 예시
[INFO] [safe_joint_bridge]: accepted first complete frame; entering TRACKING
[WARN] [safe_joint_bridge]: input timeout; publishing stopped and HOLD requested