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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
"""
|
| 4 |
+
ROS2 Deployment Script for Right Arm + Gripper + 2 Cameras
|
| 5 |
+
Data: Right Arm (7 DOF) + Gripper (1 DOF) = 8 DOF total
|
| 6 |
+
Cameras: Head Camera (640x360) + Wrist Camera (320x240)
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import os
|
| 10 |
+
import rclpy
|
| 11 |
+
from rclpy.node import Node
|
| 12 |
+
from rclpy.executors import MultiThreadedExecutor
|
| 13 |
+
import cv2
|
| 14 |
+
from typing import Tuple
|
| 15 |
+
import time
|
| 16 |
+
import numpy as np
|
| 17 |
+
from cv_bridge import CvBridge
|
| 18 |
+
from sensor_msgs.msg import Image, JointState
|
| 19 |
+
from std_msgs.msg import Header, Int32
|
| 20 |
+
|
| 21 |
+
# Import message types
|
| 22 |
+
try:
|
| 23 |
+
from bodyctrl_msgs.msg import CmdSetMotorPosition, MotorStatusMsg, SetMotorPosition
|
| 24 |
+
BODYCTRL_AVAILABLE = True
|
| 25 |
+
except ImportError:
|
| 26 |
+
from std_msgs.msg import String as CmdSetMotorPosition
|
| 27 |
+
from std_msgs.msg import String as MotorStatusMsg
|
| 28 |
+
from std_msgs.msg import String as SetMotorPosition
|
| 29 |
+
BODYCTRL_AVAILABLE = False
|
| 30 |
+
print("Warning: bodyctrl_msgs package is not available, will use String message type as replacement")
|
| 31 |
+
|
| 32 |
+
# Use message_filters for message synchronization
|
| 33 |
+
from message_filters import ApproximateTimeSynchronizer, Subscriber
|
| 34 |
+
|
| 35 |
+
from action_policy import PolicyAgent
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class PolicyAgentNode(Node):
|
| 39 |
+
"""
|
| 40 |
+
Policy Agent Node for Right Arm + Gripper
|
| 41 |
+
|
| 42 |
+
Observation: 8 DOF (arm 7 + gripper 1) + 2 cameras
|
| 43 |
+
Action: 8 DOF (arm 7 + gripper 1)
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
def __init__(self):
|
| 47 |
+
super().__init__('policy_agent_node')
|
| 48 |
+
|
| 49 |
+
# DEBUG
|
| 50 |
+
self.cnt = 0
|
| 51 |
+
|
| 52 |
+
# Update this path to your trained model
|
| 53 |
+
model_path = "/home/ubuntu/bwr/imitation_learning_models/tienkung_xsens_act7_2/pretrained_model"
|
| 54 |
+
self.action_policy = PolicyAgent(model_path)
|
| 55 |
+
|
| 56 |
+
# ========== ARM STATUS ==========
|
| 57 |
+
self.joint_state_sub = self.create_subscription(
|
| 58 |
+
MotorStatusMsg,
|
| 59 |
+
'/arm/status',
|
| 60 |
+
self.arm_callback,
|
| 61 |
+
10)
|
| 62 |
+
|
| 63 |
+
self.left_jpos = None
|
| 64 |
+
self.right_jpos = None
|
| 65 |
+
|
| 66 |
+
# ========== GRIPPER STATE ==========
|
| 67 |
+
self.gripper_state = 0.0 # Default: open (0)
|
| 68 |
+
self.gripper_sub = self.create_subscription(
|
| 69 |
+
Int32,
|
| 70 |
+
'/gripper/right/grip',
|
| 71 |
+
self.gripper_callback,
|
| 72 |
+
10)
|
| 73 |
+
|
| 74 |
+
# ========== CAMERAS ==========
|
| 75 |
+
self.bridge = CvBridge()
|
| 76 |
+
self.head_image = None
|
| 77 |
+
self.wrist_image = None
|
| 78 |
+
|
| 79 |
+
# Head camera (640x360)
|
| 80 |
+
self.head_camera_sub = self.create_subscription(
|
| 81 |
+
Image,
|
| 82 |
+
'/camera/color/image_raw',
|
| 83 |
+
self.head_camera_callback,
|
| 84 |
+
10)
|
| 85 |
+
|
| 86 |
+
# Wrist camera (320x240)
|
| 87 |
+
self.wrist_camera_sub = self.create_subscription(
|
| 88 |
+
Image,
|
| 89 |
+
'/hand_camera/color/right/image_raw',
|
| 90 |
+
self.wrist_camera_callback,
|
| 91 |
+
10)
|
| 92 |
+
|
| 93 |
+
# ========== CONTROL PUBLISHERS ==========
|
| 94 |
+
# Arm control
|
| 95 |
+
self.dual_arm_controller = self.create_publisher(
|
| 96 |
+
CmdSetMotorPosition,
|
| 97 |
+
'/arm/cmd_pos',
|
| 98 |
+
10)
|
| 99 |
+
|
| 100 |
+
# Gripper control
|
| 101 |
+
self.gripper_publisher = self.create_publisher(
|
| 102 |
+
Int32,
|
| 103 |
+
'/gripper/right/cmd',
|
| 104 |
+
10)
|
| 105 |
+
|
| 106 |
+
self.get_logger().info('PolicyAgentNode initialization completed')
|
| 107 |
+
self.get_logger().info(' Data: Right Arm (7) + Gripper (1) + 2 Cameras')
|
| 108 |
+
|
| 109 |
+
def arm_callback(self, msg):
|
| 110 |
+
"""Callback for arm status"""
|
| 111 |
+
tmp_arms_status = []
|
| 112 |
+
for val in msg.status:
|
| 113 |
+
tmp_arms_status.append(val.pos)
|
| 114 |
+
self.left_jpos = np.array(tmp_arms_status[:7])
|
| 115 |
+
self.right_jpos = np.array(tmp_arms_status[7:])
|
| 116 |
+
|
| 117 |
+
def gripper_callback(self, msg: Int32):
|
| 118 |
+
"""Callback for gripper state (Int32: 0=open, 1=closed)"""
|
| 119 |
+
# Convert int to float: 0 -> 0.0 (open), 1 -> 1.0 (closed)
|
| 120 |
+
self.gripper_state = float(msg.data)
|
| 121 |
+
|
| 122 |
+
def head_camera_callback(self, msg: Image):
|
| 123 |
+
"""Callback for head camera"""
|
| 124 |
+
try:
|
| 125 |
+
self.head_image = self.bridge.imgmsg_to_cv2(msg, desired_encoding='rgb8')
|
| 126 |
+
# Resize to 640x360 if needed
|
| 127 |
+
if self.head_image.shape[1] != 640 or self.head_image.shape[0] != 360:
|
| 128 |
+
self.head_image = cv2.resize(self.head_image, (640, 360))
|
| 129 |
+
except Exception as e:
|
| 130 |
+
self.get_logger().error(f"Error converting head image: {e}")
|
| 131 |
+
|
| 132 |
+
def wrist_camera_callback(self, msg: Image):
|
| 133 |
+
"""Callback for wrist camera"""
|
| 134 |
+
try:
|
| 135 |
+
self.wrist_image = self.bridge.imgmsg_to_cv2(msg, desired_encoding='rgb8')
|
| 136 |
+
# Resize to 320x240 if needed
|
| 137 |
+
if self.wrist_image.shape[1] != 320 or self.wrist_image.shape[0] != 240:
|
| 138 |
+
self.wrist_image = cv2.resize(self.wrist_image, (320, 240))
|
| 139 |
+
except Exception as e:
|
| 140 |
+
self.get_logger().error(f"Error converting wrist image: {e}")
|
| 141 |
+
|
| 142 |
+
def get_current_arm_status(self):
|
| 143 |
+
"""Get current RIGHT arm status (7 DOF)"""
|
| 144 |
+
if self.right_jpos is None:
|
| 145 |
+
self.get_logger().warning('Right arm status not ready yet')
|
| 146 |
+
return np.zeros(7)
|
| 147 |
+
|
| 148 |
+
return np.array(self.right_jpos)
|
| 149 |
+
|
| 150 |
+
def get_current_state(self):
|
| 151 |
+
"""Get combined state: arm(7) + gripper(1) = 8 DOF"""
|
| 152 |
+
arm_state = self.get_current_arm_status()
|
| 153 |
+
gripper = np.array([self.gripper_state])
|
| 154 |
+
return np.concatenate([arm_state, gripper])
|
| 155 |
+
|
| 156 |
+
def _construct_right_arm_ctrl_msg(self, target_joint: np.ndarray):
|
| 157 |
+
"""Construct control message for right arm only (7 DOF)"""
|
| 158 |
+
msg = CmdSetMotorPosition()
|
| 159 |
+
msg.header = Header()
|
| 160 |
+
msg.header.stamp = self.get_clock().now().to_msg()
|
| 161 |
+
|
| 162 |
+
# Control right arm only (motor indices 21-27 for right arm)
|
| 163 |
+
# Matching ros2_deployment_inspire_head.py motor IDs
|
| 164 |
+
for idx, val in enumerate(target_joint):
|
| 165 |
+
cmd = SetMotorPosition()
|
| 166 |
+
cmd.name = 21 + idx # Right arm motors: 21, 22, 23, 24, 25, 26, 27
|
| 167 |
+
cmd.pos = float(val)
|
| 168 |
+
cmd.spd = 0.5
|
| 169 |
+
cmd.cur = 5.0
|
| 170 |
+
msg.cmds.append(cmd)
|
| 171 |
+
|
| 172 |
+
return msg
|
| 173 |
+
|
| 174 |
+
def _construct_dual_arm_ctrl_msg(self, target_joint: np.ndarray):
|
| 175 |
+
"""Construct control message for both arms (14 DOF)"""
|
| 176 |
+
msg = CmdSetMotorPosition()
|
| 177 |
+
msg.header = Header()
|
| 178 |
+
msg.header.stamp = self.get_clock().now().to_msg()
|
| 179 |
+
|
| 180 |
+
for idx, val in enumerate(target_joint):
|
| 181 |
+
cmd = SetMotorPosition()
|
| 182 |
+
if idx < 7:
|
| 183 |
+
# Left arm motors: 11-17
|
| 184 |
+
cmd.name = 11 + idx
|
| 185 |
+
else:
|
| 186 |
+
# Right arm motors: 21-27 (matching ros2_deployment_inspire_head.py)
|
| 187 |
+
cmd.name = 14 + idx
|
| 188 |
+
cmd.pos = float(val)
|
| 189 |
+
cmd.spd = 2.0
|
| 190 |
+
cmd.cur = 5.0
|
| 191 |
+
msg.cmds.append(cmd)
|
| 192 |
+
|
| 193 |
+
return msg
|
| 194 |
+
|
| 195 |
+
def publish_action(self, action: np.ndarray):
|
| 196 |
+
"""
|
| 197 |
+
Publish action to robot
|
| 198 |
+
|
| 199 |
+
Args:
|
| 200 |
+
action: [8d] = arm(7) + gripper(1)
|
| 201 |
+
"""
|
| 202 |
+
# Extract arm action (first 7 values)
|
| 203 |
+
arm_action = action[:7]
|
| 204 |
+
|
| 205 |
+
# Extract gripper action (last value)
|
| 206 |
+
gripper_action = action[7] if len(action) > 7 else 0.0
|
| 207 |
+
|
| 208 |
+
# Publish arm control
|
| 209 |
+
self.dual_arm_controller.publish(self._construct_right_arm_ctrl_msg(arm_action))
|
| 210 |
+
|
| 211 |
+
# Publish gripper control
|
| 212 |
+
gripper_msg = Int32()
|
| 213 |
+
gripper_msg.data = 1 if gripper_action > 0.5 else 0 # Threshold at 0.5
|
| 214 |
+
self.gripper_publisher.publish(gripper_msg)
|
| 215 |
+
|
| 216 |
+
def get_obs(self):
|
| 217 |
+
"""Get observations for policy inference"""
|
| 218 |
+
obs = {
|
| 219 |
+
'images': {
|
| 220 |
+
'camera_head': None,
|
| 221 |
+
'camera_wrist': None
|
| 222 |
+
},
|
| 223 |
+
'arm_gripper_joints': None
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
# Get state: arm(7) + gripper(1) = 8 DOF
|
| 227 |
+
state = self.get_current_state()
|
| 228 |
+
|
| 229 |
+
# Check images
|
| 230 |
+
if self.head_image is None or self.wrist_image is None:
|
| 231 |
+
self.get_logger().warning("Images not ready yet")
|
| 232 |
+
return None
|
| 233 |
+
|
| 234 |
+
obs['images']['camera_head'] = self.head_image
|
| 235 |
+
obs['images']['camera_wrist'] = self.wrist_image
|
| 236 |
+
obs['arm_gripper_joints'] = state
|
| 237 |
+
|
| 238 |
+
return obs
|
| 239 |
+
|
| 240 |
+
def reset_home(self):
|
| 241 |
+
"""Reset both arms to initial position"""
|
| 242 |
+
# Initial position for both arms (14 DOF)
|
| 243 |
+
# Adjust these values based on your robot's home position
|
| 244 |
+
state_home = [
|
| 245 |
+
-0.1525799448897199,
|
| 246 |
+
0.06799564128968774,
|
| 247 |
+
0.1352429110829423,
|
| 248 |
+
-0.1,
|
| 249 |
+
0.12439771977866568,
|
| 250 |
+
-0.36139144432253956,
|
| 251 |
+
-0.00591924481275605,
|
| 252 |
+
|
| 253 |
+
-0.6,
|
| 254 |
+
-0.003778287841052544,
|
| 255 |
+
-0.13665378849680831,
|
| 256 |
+
-0.8683540414019328,
|
| 257 |
+
-0.287210096964022,
|
| 258 |
+
-0.4483082608478825,
|
| 259 |
+
0.19435190805574742
|
| 260 |
+
]
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
self.get_logger().info("Resetting both arms to initial position...")
|
| 264 |
+
time.sleep(3)
|
| 265 |
+
|
| 266 |
+
# Get current status
|
| 267 |
+
if self.left_jpos is None or self.right_jpos is None:
|
| 268 |
+
self.get_logger().warning('Arm status not ready yet, using zeros')
|
| 269 |
+
current_status = np.zeros(14)
|
| 270 |
+
else:
|
| 271 |
+
current_status = np.concatenate([self.left_jpos, self.right_jpos])
|
| 272 |
+
|
| 273 |
+
# Debug: Log current and target positions
|
| 274 |
+
self.get_logger().info(f"Current left arm (7 DOF): {self.left_jpos}")
|
| 275 |
+
self.get_logger().info(f"Current right arm (7 DOF): {self.right_jpos}")
|
| 276 |
+
self.get_logger().info(f"Current combined (14 DOF): {current_status}")
|
| 277 |
+
self.get_logger().info(f"Target home (14 DOF): {state_home}")
|
| 278 |
+
|
| 279 |
+
# Calculate difference
|
| 280 |
+
diff = np.array(state_home) - current_status
|
| 281 |
+
self.get_logger().info(f"Difference (target - current): {diff}")
|
| 282 |
+
self.get_logger().info(f"Max difference: {np.max(np.abs(diff)):.4f} rad")
|
| 283 |
+
|
| 284 |
+
# Move to initial position
|
| 285 |
+
fine_step = 500
|
| 286 |
+
step_array = np.linspace(current_status, state_home, fine_step)
|
| 287 |
+
|
| 288 |
+
for stp in step_array:
|
| 289 |
+
self.dual_arm_controller.publish(self._construct_dual_arm_ctrl_msg(stp))
|
| 290 |
+
time.sleep(1.0/400.0)
|
| 291 |
+
|
| 292 |
+
# Open gripper
|
| 293 |
+
gripper_msg = Int32()
|
| 294 |
+
gripper_msg.data = 0 # Open
|
| 295 |
+
self.gripper_publisher.publish(gripper_msg)
|
| 296 |
+
|
| 297 |
+
self.get_logger().info("Reset to initial position completed")
|
| 298 |
+
self.get_logger().info("Note: During inference, only right arm + gripper will be controlled")
|
| 299 |
+
|
| 300 |
+
def warm_up(self):
|
| 301 |
+
"""Wait for subscribers to receive messages"""
|
| 302 |
+
time.sleep(3)
|
| 303 |
+
self.get_logger().info('System warm-up completed')
|
| 304 |
+
|
| 305 |
+
def run(self):
|
| 306 |
+
"""Run the main loop"""
|
| 307 |
+
self.warm_up()
|
| 308 |
+
self.get_logger().info("Starting reset home")
|
| 309 |
+
self.reset_home()
|
| 310 |
+
self.get_logger().info("Ending reset home")
|
| 311 |
+
|
| 312 |
+
self.get_logger().info("Starting main loop")
|
| 313 |
+
while rclpy.ok():
|
| 314 |
+
# Get observations
|
| 315 |
+
obs = self.get_obs()
|
| 316 |
+
|
| 317 |
+
if obs is None:
|
| 318 |
+
self.get_logger().warning("Observations not ready yet")
|
| 319 |
+
time.sleep(0.1)
|
| 320 |
+
continue
|
| 321 |
+
|
| 322 |
+
print(f"State (8 DOF): {obs['arm_gripper_joints']}")
|
| 323 |
+
|
| 324 |
+
# Run inference
|
| 325 |
+
action = self.action_policy.inference(obs)
|
| 326 |
+
action_np = action[0].numpy()
|
| 327 |
+
|
| 328 |
+
# Publish action
|
| 329 |
+
self.publish_action(action_np)
|
| 330 |
+
|
| 331 |
+
# Match data collection FPS (30Hz)
|
| 332 |
+
time.sleep(0.033)
|
| 333 |
+
|
| 334 |
+
|
| 335 |
+
def main(args=None):
|
| 336 |
+
rclpy.init(args=args)
|
| 337 |
+
|
| 338 |
+
try:
|
| 339 |
+
node = PolicyAgentNode()
|
| 340 |
+
|
| 341 |
+
executor = MultiThreadedExecutor(num_threads=3)
|
| 342 |
+
executor.add_node(node)
|
| 343 |
+
|
| 344 |
+
import threading
|
| 345 |
+
executor_thread = threading.Thread(target=executor.spin, daemon=True)
|
| 346 |
+
executor_thread.start()
|
| 347 |
+
|
| 348 |
+
node.run()
|
| 349 |
+
|
| 350 |
+
except KeyboardInterrupt:
|
| 351 |
+
pass
|
| 352 |
+
finally:
|
| 353 |
+
rclpy.shutdown()
|
| 354 |
+
|
| 355 |
+
|
| 356 |
+
if __name__ == '__main__':
|
| 357 |
+
main()
|
| 358 |
+
|
train_config_tienkung.json
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dataset": {
|
| 3 |
+
"repo_id": "tienkung_xsens_realtime",
|
| 4 |
+
"root": "/home/bigwaverobotics/bwrcode/ubitech-imitation-learning-data/lerobot7/tienkung_xsens_realtime",
|
| 5 |
+
"episodes": null,
|
| 6 |
+
"image_transforms": {
|
| 7 |
+
"enable": true,
|
| 8 |
+
"max_num_transforms": 3,
|
| 9 |
+
"random_order": false,
|
| 10 |
+
"tfs": {
|
| 11 |
+
"brightness": {
|
| 12 |
+
"weight": 1.0,
|
| 13 |
+
"type": "ColorJitter",
|
| 14 |
+
"kwargs": {
|
| 15 |
+
"brightness": [0.9, 1.1]
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"contrast": {
|
| 19 |
+
"weight": 1.0,
|
| 20 |
+
"type": "ColorJitter",
|
| 21 |
+
"kwargs": {
|
| 22 |
+
"contrast": [0.9, 1.1]
|
| 23 |
+
}
|
| 24 |
+
},
|
| 25 |
+
"saturation": {
|
| 26 |
+
"weight": 1.0,
|
| 27 |
+
"type": "ColorJitter",
|
| 28 |
+
"kwargs": {
|
| 29 |
+
"saturation": [0.8, 1.2]
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
"hue": {
|
| 33 |
+
"weight": 1.0,
|
| 34 |
+
"type": "ColorJitter",
|
| 35 |
+
"kwargs": {
|
| 36 |
+
"hue": [-0.02, 0.02]
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"sharpness": {
|
| 40 |
+
"weight": 1.0,
|
| 41 |
+
"type": "SharpnessJitter",
|
| 42 |
+
"kwargs": {
|
| 43 |
+
"sharpness": [0.8, 1.2]
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
"use_imagenet_stats": true,
|
| 49 |
+
"video_backend": "pyav"
|
| 50 |
+
},
|
| 51 |
+
"policy": {
|
| 52 |
+
"type": "act",
|
| 53 |
+
"n_obs_steps": 1,
|
| 54 |
+
"normalization_mapping": {
|
| 55 |
+
"VISUAL": "MEAN_STD",
|
| 56 |
+
"STATE": "MEAN_STD",
|
| 57 |
+
"ACTION": "MEAN_STD"
|
| 58 |
+
},
|
| 59 |
+
"input_features": {
|
| 60 |
+
"observation.images.camera_head": {
|
| 61 |
+
"type": "VISUAL",
|
| 62 |
+
"shape": [3, 360, 640]
|
| 63 |
+
},
|
| 64 |
+
"observation.images.camera_wrist": {
|
| 65 |
+
"type": "VISUAL",
|
| 66 |
+
"shape": [3, 240, 320]
|
| 67 |
+
},
|
| 68 |
+
"observation.state": {
|
| 69 |
+
"type": "STATE",
|
| 70 |
+
"shape": [8]
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
"output_features": {
|
| 74 |
+
"action": {
|
| 75 |
+
"type": "ACTION",
|
| 76 |
+
"shape": [8]
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"chunk_size": 100,
|
| 80 |
+
"n_action_steps": 100,
|
| 81 |
+
"vision_backbone": "resnet18",
|
| 82 |
+
"pretrained_backbone_weights": "ResNet18_Weights.IMAGENET1K_V1",
|
| 83 |
+
"replace_final_stride_with_dilation": false,
|
| 84 |
+
"pre_norm": false,
|
| 85 |
+
"dim_model": 512,
|
| 86 |
+
"n_heads": 8,
|
| 87 |
+
"dim_feedforward": 3200,
|
| 88 |
+
"feedforward_activation": "relu",
|
| 89 |
+
"n_encoder_layers": 4,
|
| 90 |
+
"n_decoder_layers": 1,
|
| 91 |
+
"use_vae": false,
|
| 92 |
+
"latent_dim": 16,
|
| 93 |
+
"n_vae_encoder_layers": 4,
|
| 94 |
+
"temporal_ensemble_coeff": null,
|
| 95 |
+
"dropout": 0.1,
|
| 96 |
+
"kl_weight": 5.0,
|
| 97 |
+
"optimizer_lr": 2e-05,
|
| 98 |
+
"optimizer_weight_decay": 0.0001,
|
| 99 |
+
"optimizer_lr_backbone": 2e-05,
|
| 100 |
+
"device": "cuda"
|
| 101 |
+
},
|
| 102 |
+
"output_dir": "outputs/train/tienkung_right_arm_act7",
|
| 103 |
+
"job_name": "tienkung_right_arm_act",
|
| 104 |
+
"resume": false,
|
| 105 |
+
"seed": 1000,
|
| 106 |
+
"num_workers": 8,
|
| 107 |
+
"batch_size": 32,
|
| 108 |
+
"steps": 100000,
|
| 109 |
+
"eval_freq": 5000,
|
| 110 |
+
"log_freq": 200,
|
| 111 |
+
"save_checkpoint": true,
|
| 112 |
+
"save_freq": 5000,
|
| 113 |
+
"use_policy_training_preset": true,
|
| 114 |
+
"optimizer": {
|
| 115 |
+
"type": "adamw",
|
| 116 |
+
"lr": 2e-05,
|
| 117 |
+
"betas": [0.9, 0.999],
|
| 118 |
+
"eps": 1e-08,
|
| 119 |
+
"weight_decay": 0.0001,
|
| 120 |
+
"grad_clip_norm": 10.0
|
| 121 |
+
},
|
| 122 |
+
"scheduler": null,
|
| 123 |
+
"eval": {
|
| 124 |
+
"n_episodes": 50,
|
| 125 |
+
"batch_size": 50,
|
| 126 |
+
"use_async_envs": false
|
| 127 |
+
},
|
| 128 |
+
"wandb": {
|
| 129 |
+
"enable": false,
|
| 130 |
+
"disable_artifact": true,
|
| 131 |
+
"project": "lerobot",
|
| 132 |
+
"entity": null,
|
| 133 |
+
"notes": null
|
| 134 |
+
}
|
| 135 |
+
}
|