Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions configs/data/KuavoRosbag2Lerobot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ hydra: # Hydra 配置文件保存目录,仅供参数检查使用

rosbag:
mode: normal # 可选: normal, resume, merge
rosbag_dir: /path/to/rosbags # rosbag文件存放的目录。normal / resume 模式需要
target_dir: /path/to/target_dir # 输出父目录;最终数据集会生成在 target_dir/lerobot
rosbag_dir: /home/zwl/merge8.4/kuavo-ros-opensource/src/data_challenge_simulator/examples/bags/run_2026-08-22_10-17-34
target_dir: /home/zwl/merge8.4/letools_opensource/LeTools-Learning/kuavo_data/6 # 输出父目录;最终数据集会生成在 target_dir/lerobot
lerobot_dir_resume: /path/to/lerobot_resume # resume 模式下,已有 lerobot 数据集的目录
lerobot_dir_merge:
["/path/to/lerobot1",
"/path/to/lerobot2"] # merge 模式下,要合并的多个 lerobot 数据集目录列表

dataset:
platform_type: "4pro" # 硬件平台类型,可选: "4pro", "5w" 或 "5",默认使用 configs/platform/platform_config.yaml 中的 default 值,比赛默认4pro
platform_type: "5w" # 硬件平台类型,可选: "4pro", "5w" 或 "5",默认使用 configs/platform/platform_config.yaml 中的 default 值,比赛默认4pro
eef_type: leju_claw # 末端执行器类型,仿真选择:rq2f85, 真机可选:leju_claw,(夹爪) qiangnao,(灵巧手)
which_arm: both # 需要哪一只手臂的关节 + 图像数据,可选: left, right, both,注意图像数据会同时包含头部相机图像

Expand All @@ -31,8 +31,8 @@ dataset:
train_hz: 10 # 训练数据的采样频率
main_timeline: head_cam_h # 将哪个相机设为主相机,默认主相机来自:head_cam_h, 可选:wrist_cam_l, wrist_cam_r
main_timeline_fps: 30 # 主相机的帧率,必须稳定,默认30帧
sample_drop: 10 # 丢弃episode前后的10帧
sample_drop: 1 # 丢弃episode前后的10帧

resize:
width: 848 # 图像缩放宽度,注意请先查看(推荐浏览器foxglove工具)rosbag中图像的原始尺寸,避免放大或缩小带来模糊或拉伸形变等问题
width: 640 # 图像缩放宽度,注意请先查看(推荐浏览器foxglove工具)rosbag中图像的原始尺寸,避免放大或缩小带来模糊或拉伸形变等问题
height: 480 # 图像缩放高度,注意请先查看(推荐浏览器foxglove工具)rosbag中图像的原始尺寸,避免放大或缩小带来模糊或拉伸形变等问题
14 changes: 7 additions & 7 deletions configs/deploy/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
env: # 推理环境设置
inference_env: real # 选仿真还是真机 option: sim/real
platform_type: "5w" # 机器人型号 option: "4pro"/"5"/"5w"
inference_env: sim # 选仿真还是真机 option: sim/real
platform_type: "5w" # 轮臂 5W/s60-s63 关节布局
which_arm: both # 控制左手、右手还是双手 option: both/left/right
eef_type: qiangnao # 夹爪或手型类型 option: leju_claw/qiangnao/rq2f85(仿真)
eef_type: leju_claw # 夹爪或手型类型 option: leju_claw/qiangnao/rq2f85(仿真)
ros_rate: 10 # 推理频率
direct_to_wbc: false # 是否使用direct to wbc模式。
enable_action_interpolation: true
control_rate: 100 # WBC插值后的实际控制指令频率
image_size: [848, 480] # 相机缩放尺寸 option: [640, 480](仿真)/[848, 480](真机)
image_size: [640, 480] # 相机缩放尺寸 option: [640, 480](仿真)/[848, 480](真机)


inference: # 推理和评测设置
go_bag_path: null # bag 回放路径
policy_type: client # 要加载的模型类型,外挂模式选择client, 选择client模式后下面的pretrained_path失去作用
pretrained_path: /path/to/checkpoint # 要加载的权重路径。
go_bag_path: /home/zwl/merge8.4/kuavo-ros-opensource/src/data_challenge_simulator/examples/bags/run_2026-08-22_10-17-34/grasp_part_001.bag # bag 回放路径
policy_type: act # 要加载的模型类型,外挂模式选择client, 选择client模式后下面的pretrained_path失去作用
pretrained_path: /home/zwl/merge8.4/letools_opensource/LeTools-Learning/outputs/train/act_7/lerobot_grasp_ring_20260822_115555/checkpoints/last
eval_episodes: 10 # 评测跑多少条
max_episode_steps: 200 # 每条最多跑多少步
task_prompt: "Pick and Place"
Expand Down
2 changes: 1 addition & 1 deletion configs/platform/platform_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# 定义不同硬件平台(4Pro、5W)的关节索引范围

# 默认硬件类型
default: "4pro"
default: "5w"

# 硬件平台定义
platforms:
Expand Down
16 changes: 8 additions & 8 deletions configs/train/lerobot/act.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# LeRobot ACT 简化配置。
dataset:
repo_id: "lerobot/your_dataset" # 数据集名字,用来做标识。
root: null # 数据地址
repo_id: "lerobot/grasp_ring" # 数据集名字,用来做标识。
root: /home/zwl/merge8.4/letools_opensource/LeTools-Learning/kuavo_data/6/lerobot

training:
resume: false # 是否从 output_dir 最新 checkpoint 继续训;续训改为 true,并修改 output_dir 为上阶段 run 的产物路径,如 outputs/train/act_YYYYMMDD_HHMMSS。
output_dir: "outputs/train/act" # 权重存储路径
job_name: "act" # 实验名。
batch_size: 32
steps: 100000 # 总训练步数
save_freq: 20000 # 每N步保存一次权重
output_dir: "outputs/train/act_7/lerobot_grasp_ring" # 权重存储路径
job_name: "act_3/lerobot_grasp_ring" # 实验名。
batch_size: 8
steps: 30000 # 总训练步数
save_freq: 10000 # 每N步保存一次权重
num_workers: 8
seed: 1000

wandb: # wandb的一些设置
enable: true # 是否启用 wandb。
enable: false # 是否启用 wandb。
project: "lerobot_act" # wandb 项目名。

policy:
Expand Down
13 changes: 11 additions & 2 deletions kuavo_data/CvtRosbag2Lerobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,18 @@ def get_array(key, dtype, default_empty=True):
# rq2f85_state = rq2f85_state / 0.8
# rq2f85_action = rq2f85_action / 255

if claw_action.size == 0 and qiangnao_action.size == 0:
# Prefer /gripper/state (rq2f85) over /leju_claw_state (claw) for state observation
# /leju_claw_state has dual-publisher conflict in simulation (percentage vs radians)
if rq2f85_state.size > 0:
if kuavo.IS_BINARY:
claw_state = rq2f85_state # binary: already 0 or 1
else:
# Convert rq2f85_state (normalized by /0.8) to claw scale (normalized by /100)
# rq2f85_norm = (ctrl+100)/200, claw_norm = 1-ctrl/255
# => claw_norm = (355 - 200 * rq2f85_norm) / 255
claw_state = (355.0 - 200.0 * rq2f85_state) / 255.0
if claw_action.size == 0 and rq2f85_action.size > 0:
claw_action = rq2f85_action
claw_state = rq2f85_state

# =========================
# 5. 构建最终 state / action
Expand Down
23 changes: 21 additions & 2 deletions kuavo_data/common/kuavo_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,25 @@ def process_kuavo_arm_traj(msg):
# radian
return {"data": np.deg2rad(msg.position), "timestamp": msg.header.stamp.to_sec()}

@staticmethod
def process_two_arm_hand_pose_cmd(msg):
"""Process /mm/two_arm_hand_pose_cmd message as arm trajectory.

当 frame=5(关节空间)时,从 left_pose.joint_angles 和 right_pose.joint_angles
提取14维手臂关节角(弧度),作为 action.kuavo_arm_traj 的替代数据源。

Args:
msg (kuavo_msgs/twoArmHandPoseCmd): 双臂手部位姿指令

Returns:
Dict: 14维手臂关节角(弧度)+ 时间戳
"""
left_ja = np.array(msg.hand_poses.left_pose.joint_angles, dtype=np.float64)
right_ja = np.array(msg.hand_poses.right_pose.joint_angles, dtype=np.float64)
arm_traj = np.concatenate([left_ja, right_ja])
ts = msg.hand_poses.header.stamp.to_sec()
return {"data": arm_traj, "timestamp": ts}

@staticmethod
def process_claw_state(msg):
"""
Expand Down Expand Up @@ -313,8 +332,8 @@ def __init__(self):
"msg_process_fn": self._msg_processer.process_joint_state,
},
"action.kuavo_arm_traj": {
"topic": "/kuavo_arm_traj",
"msg_process_fn": self._msg_processer.process_kuavo_arm_traj,
"topic": "/joint_cmd",
"msg_process_fn": self._msg_processer.process_joint_cmd_extract_arm,
},
"action": {
"topic": "/joint_cmd",
Expand Down
Binary file not shown.
Binary file not shown.
174 changes: 174 additions & 0 deletions kuavo_data/lerobot/meta/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"codebase_version": "v3.0",
"robot_type": "kuavo-5w",
"total_episodes": 30,
"total_frames": 3540,
"total_tasks": 1,
"chunks_size": 1000,
"data_files_size_in_mb": 100,
"video_files_size_in_mb": 200,
"fps": 10,
"splits": {
"train": "0:30"
},
"data_path": "data/chunk-{chunk_index:03d}/file-{file_index:03d}.parquet",
"video_path": "videos/{video_key}/chunk-{chunk_index:03d}/file-{file_index:03d}.mp4",
"features": {
"observation.state": {
"dtype": "float32",
"shape": [
16
],
"names": {
"state_names": [
"zarm_l1_link",
"zarm_l2_link",
"zarm_l3_link",
"zarm_l4_link",
"zarm_l5_link",
"zarm_l6_link",
"zarm_l7_link",
"left_claw",
"zarm_r1_link",
"zarm_r2_link",
"zarm_r3_link",
"zarm_r4_link",
"zarm_r5_link",
"zarm_r6_link",
"zarm_r7_link",
"right_claw"
]
}
},
"action": {
"dtype": "float32",
"shape": [
16
],
"names": {
"action_names": [
"zarm_l1_link",
"zarm_l2_link",
"zarm_l3_link",
"zarm_l4_link",
"zarm_l5_link",
"zarm_l6_link",
"zarm_l7_link",
"left_claw",
"zarm_r1_link",
"zarm_r2_link",
"zarm_r3_link",
"zarm_r4_link",
"zarm_r5_link",
"zarm_r6_link",
"zarm_r7_link",
"right_claw"
]
}
},
"observation.images.head_cam_h": {
"dtype": "video",
"shape": [
3,
480,
640
],
"names": [
"channels",
"height",
"width"
],
"info": {
"video.height": 480,
"video.width": 640,
"video.codec": "av1",
"video.pix_fmt": "yuv420p",
"video.is_depth_map": false,
"video.fps": 10,
"video.channels": 3,
"has_audio": false
}
},
"observation.images.wrist_cam_l": {
"dtype": "video",
"shape": [
3,
480,
640
],
"names": [
"channels",
"height",
"width"
],
"info": {
"video.height": 480,
"video.width": 640,
"video.codec": "av1",
"video.pix_fmt": "yuv420p",
"video.is_depth_map": false,
"video.fps": 10,
"video.channels": 3,
"has_audio": false
}
},
"observation.images.wrist_cam_r": {
"dtype": "video",
"shape": [
3,
480,
640
],
"names": [
"channels",
"height",
"width"
],
"info": {
"video.height": 480,
"video.width": 640,
"video.codec": "av1",
"video.pix_fmt": "yuv420p",
"video.is_depth_map": false,
"video.fps": 10,
"video.channels": 3,
"has_audio": false
}
},
"timestamp": {
"dtype": "float32",
"shape": [
1
],
"names": null
},
"frame_index": {
"dtype": "int64",
"shape": [
1
],
"names": null
},
"episode_index": {
"dtype": "int64",
"shape": [
1
],
"names": null
},
"index": {
"dtype": "int64",
"shape": [
1
],
"names": null
},
"task_index": {
"dtype": "int64",
"shape": [
1
],
"names": null
}
}
}
Loading