This commit is contained in:
2025-04-07 22:03:32 +08:00
parent e034881507
commit aa3920dd28
5 changed files with 17 additions and 16 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
cobot_magic/ cobot_magic/
librealsense/ librealsense/
data*/ data*/
outputs/

View File

@@ -366,18 +366,18 @@ class AgilexRobot(Robot):
from_idx = to_idx from_idx = to_idx
# Apply safety checks if configured # Apply safety checks if configured
if 'max_relative_target' in self.config: # if 'max_relative_target' in self.config:
# Get current position from the queue # # Get current position from the queue
if len(self.sync_arm_queues[arm_name]) > 0: # if len(self.sync_arm_queues[arm_name]) > 0:
current_state = self.sync_arm_queues[arm_name][-1] # current_state = self.sync_arm_queues[arm_name][-1]
current_pos = np.array(current_state.position) # current_pos = np.array(current_state.position)
# Clip the action to stay within max relative target # # Clip the action to stay within max relative target
max_delta = self.config['max_relative_target'] # max_delta = self.config['max_relative_target']
clipped_action = np.clip(arm_action, # clipped_action = np.clip(arm_action,
current_pos - max_delta, # current_pos - max_delta,
current_pos + max_delta) # current_pos + max_delta)
arm_action = clipped_action # arm_action = clipped_action
action_sent.append(arm_action) action_sent.append(arm_action)

View File

@@ -2,7 +2,7 @@ import argparse
from common.rosrobot_factory import RobotFactory from common.rosrobot_factory import RobotFactory
from common.utils.data_utils import record from common.utils.data_utils import record
from common.utils.replay_utils import replay from common.utils.replay_utils import replay
import cv2
def get_arguments(): def get_arguments():
""" """

View File

@@ -2,7 +2,7 @@ from lerobot.common.policies.act.modeling_act import ACTPolicy
from lerobot.common.robot_devices.utils import busy_wait from lerobot.common.robot_devices.utils import busy_wait
import time import time
import argparse import argparse
from agilex_robot import AgilexRobot from common.agilex_robot import AgilexRobot
import torch import torch
def get_arguments(): def get_arguments():
@@ -29,12 +29,12 @@ def get_arguments():
cfg = get_arguments() cfg = get_arguments()
robot = AgilexRobot(config_file="/home/ubuntu/LYT/aloha_lerobot/collect_data/agilex.yaml", args=cfg) robot = AgilexRobot(config_file="/home/ubuntu/LYT/lerobot_aloha/lerobot_aloha/configs/agilex.yaml", args=cfg)
inference_time_s = 360 inference_time_s = 360
fps = 30 fps = 30
device = "cuda" # TODO: On Mac, use "mps" or "cpu" device = "cuda" # TODO: On Mac, use "mps" or "cpu"
ckpt_path = "/home/ubuntu/LYT/lerobot/outputs/train/act_move_tube_on_scale/checkpoints/last/pretrained_model" ckpt_path = "/home/ubuntu/LYT/lerobot_aloha/outputs/train/act_move_tube_on_scale/checkpoints/last/pretrained_model"
policy = ACTPolicy.from_pretrained(ckpt_path) policy = ACTPolicy.from_pretrained(ckpt_path)
policy.to(device) policy.to(device)