File dữ liệu đầu vào: ```text ../data.csv ``` Thống kê đã kiểm tra: ```text Số frame: 3977 Số cột: 284 Số cột teleop joint: 27 Thời gian bắt đầu: 0.120286 s Thời gian kết thúc: 83.270855 s Tổng thời lượng: 83.150569 s Median dt: 0.020887 s FPS xấp xỉ: 47.8769 ``` CSV có các nhóm dữ liệu quan trọng: - `time`: timestamp của mỗi frame. - `ts_teleop_pelvis:position_0/1/2`: vị trí pelvis/root. - `ts_teleop_pelvis:quaternion_0/1/2/3`: hướng pelvis/root. - `ts_teleop_*_joint:joint_angular_position`: góc joint để puppet robot. Mapping thân trên: ```text waist_yaw_joint -> ts_teleop_waist_yaw_joint:joint_angular_position left_shoulder_pitch_joint -> ts_teleop_left_shoulder_pitch_joint:joint_angular_position left_shoulder_roll_joint -> ts_teleop_left_shoulder_roll_joint:joint_angular_position left_shoulder_yaw_joint -> ts_teleop_left_shoulder_yaw_joint:joint_angular_position left_elbow_pitch_joint -> ts_teleop_left_elbow_pitch_joint:joint_angular_position left_wrist_yaw_joint -> ts_teleop_left_wrist_yaw_joint:joint_angular_position left_wrist_roll_joint -> ts_teleop_left_wrist_roll_joint:joint_angular_position left_wrist_pitch_joint -> ts_teleop_left_wrist_pitch_joint:joint_angular_position right_shoulder_pitch_joint -> ts_teleop_right_shoulder_pitch_joint:joint_angular_position right_shoulder_roll_joint -> ts_teleop_right_shoulder_roll_joint:joint_angular_position right_shoulder_yaw_joint -> ts_teleop_right_shoulder_yaw_joint:joint_angular_position right_elbow_pitch_joint -> ts_teleop_right_elbow_pitch_joint:joint_angular_position right_wrist_yaw_joint -> ts_teleop_right_wrist_yaw_joint:joint_angular_position right_wrist_roll_joint -> ts_teleop_right_wrist_roll_joint:joint_angular_position right_wrist_pitch_joint -> ts_teleop_right_wrist_pitch_joint:joint_angular_position ``` Mặc định, root pose của robot lấy từ pelvis trong CSV: ```text ts_teleop_pelvis:position_0 ts_teleop_pelvis:position_1 ts_teleop_pelvis:position_2 ts_teleop_pelvis:quaternion_0 ts_teleop_pelvis:quaternion_1 ts_teleop_pelvis:quaternion_2 ts_teleop_pelvis:quaternion_3 ``` 1. Lấy root position mỗi frame. 2. Trừ offset XY của frame đầu tiên để robot bắt đầu gần gốc tọa độ. 3. Giữ trục Z theo data để robot có độ cao pelvis thật. 4. Normalize quaternion để tránh lỗi orientation. 5. Nếu quaternion có `w < 0`, đổi dấu cả quaternion để biểu diễn nhất quán. Xử Lý Joint Limit Một số joint thân trên trong CSV có thể vượt joint limit của model full, đặc biệt: - shoulder roll - elbow pitch Để đảm bảo MuJoCo nhận pose hợp lệ, mỗi giá trị joint được clamp: ```python value = np.clip(raw_value, lower, upper) ``` Trong đó `lower` và `upper` lấy trực tiếp từ `model.jnt_range`.