1
This commit is contained in:
@@ -58,14 +58,14 @@ class MindRobotTeleopSceneCfg(InteractiveSceneCfg):
|
||||
spawn=GroundPlaneCfg(),
|
||||
)
|
||||
|
||||
# Table
|
||||
table = AssetBaseCfg(
|
||||
prim_path="{ENV_REGEX_NS}/Table",
|
||||
init_state=AssetBaseCfg.InitialStateCfg(pos=[0.5, 0, 0], rot=[0.707, 0, 0, 0.707]),
|
||||
spawn=sim_utils.UsdFileCfg(
|
||||
usd_path=f"{assets_utils.ISAAC_NUCLEUS_DIR}/Props/Mounts/SeattleLabTable/table_instanceable.usd"
|
||||
),
|
||||
)
|
||||
# # Table
|
||||
# table = AssetBaseCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Table",
|
||||
# init_state=AssetBaseCfg.InitialStateCfg(pos=[0.5, 0, 0], rot=[0.707, 0, 0, 0.707]),
|
||||
# spawn=sim_utils.UsdFileCfg(
|
||||
# usd_path=f"{assets_utils.ISAAC_NUCLEUS_DIR}/Props/Mounts/SeattleLabTable/table_instanceable.usd"
|
||||
# ),
|
||||
# )
|
||||
|
||||
# Optional: Single cube for testing (can be removed if not needed)
|
||||
cube = RigidObjectCfg(
|
||||
@@ -269,296 +269,3 @@ class MindRobotLeftArmIKEnvCfg(ManagerBasedRLEnvCfg):
|
||||
self.gripper_joint_names = ["left_hand_joint_left", "left_hand_joint_right"]
|
||||
self.gripper_open_val = 0.0
|
||||
self.gripper_threshold = 0.005
|
||||
# # Copyright (c) 2024, MindRobot Project
|
||||
# # SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# """MindRobot left arm IK-Rel environment config with custom gripper control."""
|
||||
|
||||
# from __future__ import annotations
|
||||
|
||||
# import math
|
||||
|
||||
# import isaaclab.sim as sim_utils
|
||||
# from isaaclab.assets import RigidObjectCfg, AssetBaseCfg
|
||||
# from isaaclab.sim.spawners.from_files.from_files_cfg import GroundPlaneCfg
|
||||
# from isaaclab.controllers.differential_ik_cfg import DifferentialIKControllerCfg
|
||||
# from isaaclab.devices import DevicesCfg
|
||||
# from isaaclab.devices.keyboard import Se3KeyboardCfg
|
||||
# from isaaclab.devices.spacemouse import Se3SpaceMouseCfg
|
||||
# from isaaclab.devices.gamepad import Se3GamepadCfg
|
||||
# from isaaclab.envs import ManagerBasedEnvCfg
|
||||
# from isaaclab.envs.mdp.actions.actions_cfg import (
|
||||
# BinaryJointPositionActionCfg,
|
||||
# DifferentialInverseKinematicsActionCfg,
|
||||
# )
|
||||
# from isaaclab.managers import ObservationGroupCfg as ObsGroup
|
||||
# from isaaclab.managers import ObservationTermCfg as ObsTerm
|
||||
# from isaaclab.managers import SceneEntityCfg
|
||||
# from isaaclab.managers import TerminationTermCfg as DoneTerm
|
||||
# from isaaclab.scene import InteractiveSceneCfg
|
||||
# from isaaclab.sensors.frame_transformer.frame_transformer_cfg import FrameTransformerCfg
|
||||
# from isaaclab.sensors.frame_transformer.frame_transformer_cfg import OffsetCfg
|
||||
# from isaaclab.sim.schemas.schemas_cfg import RigidBodyPropertiesCfg
|
||||
# from isaaclab.utils import configclass
|
||||
# from isaaclab.markers.config import FRAME_MARKER_CFG
|
||||
|
||||
# # 导入基础配置和MDP函数
|
||||
# from isaaclab_tasks.manager_based.manipulation.stack import mdp
|
||||
# from isaaclab_tasks.manager_based.manipulation.stack.stack_env_cfg import StackEnvCfg
|
||||
|
||||
# # 导入 MindRobot 资产
|
||||
# from .mindrobot_cfg import MINDBOT_CFG, MINDBOT_HIGH_PD_CFG
|
||||
|
||||
|
||||
# # =====================================================================
|
||||
# # Scene
|
||||
# # =====================================================================
|
||||
|
||||
# @configclass
|
||||
# class MindRobotSceneCfg(InteractiveSceneCfg):
|
||||
# """Scene: MindRobot + table + cube."""
|
||||
|
||||
# # Ground
|
||||
# plane = AssetBaseCfg(
|
||||
# prim_path="/World/GroundPlane",
|
||||
# init_state=AssetBaseCfg.InitialStateCfg(pos=[0, 0, -1.05]),
|
||||
# spawn=GroundPlaneCfg(),
|
||||
# )
|
||||
|
||||
# # Table
|
||||
# table = RigidObjectCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Table",
|
||||
# spawn=sim_utils.CuboidCfg(
|
||||
# size=(0.6, 0.8, 0.05),
|
||||
# rigid_props=RigidBodyPropertiesCfg(kinematic_enabled=True),
|
||||
# collision_props=sim_utils.CollisionPropertiesCfg(),
|
||||
# visual_material=sim_utils.PreviewSurfaceCfg(
|
||||
# diffuse_color=(0.6, 0.5, 0.4)
|
||||
# ),
|
||||
# ),
|
||||
# init_state=RigidObjectCfg.InitialStateCfg(pos=(0.4, 0.15, 0.4)),
|
||||
# )
|
||||
|
||||
# # Cube to manipulate
|
||||
# cube = RigidObjectCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Cube",
|
||||
# spawn=sim_utils.CuboidCfg(
|
||||
# size=(0.04, 0.04, 0.04),
|
||||
# rigid_props=RigidBodyPropertiesCfg(),
|
||||
# mass_props=sim_utils.MassPropertiesCfg(mass=0.1),
|
||||
# collision_props=sim_utils.CollisionPropertiesCfg(),
|
||||
# visual_material=sim_utils.PreviewSurfaceCfg(
|
||||
# diffuse_color=(1.0, 0.0, 0.0)
|
||||
# ),
|
||||
# ),
|
||||
# init_state=RigidObjectCfg.InitialStateCfg(pos=(0.4, 0.15, 0.45)),
|
||||
# )
|
||||
|
||||
# # MindRobot - 使用高PD配置以获得更好的IK跟踪性能
|
||||
# robot = MINDBOT_HIGH_PD_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
|
||||
|
||||
# # Lighting
|
||||
# dome_light = sim_utils.DomeLightCfg(
|
||||
# intensity=1500.0, color=(0.75, 0.75, 0.75)
|
||||
# )
|
||||
|
||||
# # End-effector frame transformer
|
||||
# # 注意:需要根据实际的USD文件中的body名称调整
|
||||
# # 常见的命名可能是 "left_hand", "left_gripper", "l_hand" 等
|
||||
# marker_cfg = FRAME_MARKER_CFG.copy()
|
||||
# marker_cfg.markers["frame"].scale = (0.1, 0.1, 0.1)
|
||||
# marker_cfg.prim_path = "/Visuals/FrameTransformer"
|
||||
# ee_frame = FrameTransformerCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Robot/rm_65_fb_left/base_link",
|
||||
# debug_vis=False,
|
||||
# visualizer_cfg=marker_cfg,
|
||||
# target_frames=[
|
||||
# FrameTransformerCfg.FrameCfg(
|
||||
# # 根据实际USD文件调整body名称
|
||||
# # 如果USD中没有明确的end effector body,可能需要使用最后一个link
|
||||
# prim_path="{ENV_REGEX_NS}/Robot/rm_65_fb_left/Link_6", # 需要根据实际调整
|
||||
# name="end_effector",
|
||||
# offset=OffsetCfg(
|
||||
# pos=[0.0, 0.0, 0.0], # 根据实际夹爪中心位置调整
|
||||
# ),
|
||||
# ),
|
||||
# ],
|
||||
# )
|
||||
|
||||
|
||||
# # =====================================================================
|
||||
# # Actions Configuration
|
||||
# # =====================================================================
|
||||
|
||||
# @configclass
|
||||
# class MindRobotLeftArmActionsCfg:
|
||||
# """Actions for MindRobot left arm IK control."""
|
||||
|
||||
# # 左臂IK控制动作
|
||||
# arm_action = DifferentialInverseKinematicsActionCfg(
|
||||
# asset_name="robot",
|
||||
# joint_names=["l_joint[1-6]"], # 左臂6个关节
|
||||
# body_name="Link_6", # 需要根据实际USD文件调整
|
||||
# controller=DifferentialIKControllerCfg(
|
||||
# command_type="pose",
|
||||
# use_relative_mode=True, # 相对模式,适合遥操作
|
||||
# ik_method="dls", # Damped Least Squares方法
|
||||
# ),
|
||||
# scale=0.5, # 动作缩放因子
|
||||
# body_offset=DifferentialInverseKinematicsActionCfg.OffsetCfg(
|
||||
# pos=[0.0, 0.0, 0.0] # 根据实际夹爪中心位置调整
|
||||
# ),
|
||||
# )
|
||||
|
||||
# # 左手夹爪控制动作(二进制控制:开/关)
|
||||
# gripper_action = BinaryJointPositionActionCfg(
|
||||
# asset_name="robot",
|
||||
# joint_names=["left_hand_joint_left", "left_hand_joint_right"],
|
||||
# open_command_expr={
|
||||
# "left_hand_joint_left": 0.0, # 打开位置
|
||||
# "left_hand_joint_right": 0.0, # 打开位置
|
||||
# },
|
||||
# close_command_expr={
|
||||
# "left_hand_joint_left": -0.03, # 闭合位置
|
||||
# "left_hand_joint_right": 0.03, # 闭合位置
|
||||
# },
|
||||
# )
|
||||
|
||||
|
||||
# # =====================================================================
|
||||
# # Observations Configuration
|
||||
# # =====================================================================
|
||||
|
||||
# @configclass
|
||||
# class MindRobotObsCfg:
|
||||
# """Observations for MindRobot left arm."""
|
||||
|
||||
# @configclass
|
||||
# class PolicyCfg(ObsGroup):
|
||||
# """Observations for policy group."""
|
||||
|
||||
# actions = ObsTerm(func=mdp.last_action)
|
||||
# joint_pos = ObsTerm(func=mdp.joint_pos_rel)
|
||||
# joint_vel = ObsTerm(func=mdp.joint_vel_rel)
|
||||
# # object = ObsTerm(func=mdp.object_obs)
|
||||
# eef_pos = ObsTerm(func=mdp.ee_frame_pos)
|
||||
# eef_quat = ObsTerm(func=mdp.ee_frame_quat)
|
||||
# gripper_pos = ObsTerm(func=mdp.gripper_pos)
|
||||
|
||||
# def __post_init__(self):
|
||||
# self.enable_corruption = False
|
||||
# self.concatenate_terms = False
|
||||
|
||||
# # observation groups
|
||||
# policy: PolicyCfg = PolicyCfg()
|
||||
|
||||
|
||||
# # =====================================================================
|
||||
# # Main Environment Configuration
|
||||
# # =====================================================================
|
||||
|
||||
# @configclass
|
||||
# class MindRobotLeftArmIKEnvCfg(StackEnvCfg):
|
||||
# """MindRobot 左臂 IK-Rel 遥操作环境配置。"""
|
||||
|
||||
# def __post_init__(self):
|
||||
# """后初始化,配置遥操作设备和机器人特定设置"""
|
||||
# super().__post_init__()
|
||||
|
||||
# # 基本参数
|
||||
# self.decimation = 2
|
||||
# self.episode_length_s = 50.0
|
||||
|
||||
# # 设置场景
|
||||
# self.scene.robot = MINDBOT_HIGH_PD_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
|
||||
# # self.scene = MindRobotSceneCfg(
|
||||
# # num_envs=1,
|
||||
# # env_spacing=2.5,
|
||||
# # )
|
||||
|
||||
# # 使用高PD配置的MindRobot
|
||||
# # self.scene.robot = MINDBOT_HIGH_PD_CFG.replace(prim_path="{ENV_REGEX_NS}/Robot")
|
||||
|
||||
# # 设置Actions
|
||||
# self.actions = MindRobotLeftArmActionsCfg()
|
||||
|
||||
# # 配置左臂IK动作
|
||||
# self.actions.arm_action = DifferentialInverseKinematicsActionCfg(
|
||||
# asset_name="robot",
|
||||
# joint_names=["l_joint[1-6]"],
|
||||
# body_name="Link_6", # ✅ 根据USD结构,应该是 l_hand_01
|
||||
# controller=DifferentialIKControllerCfg(
|
||||
# command_type="pose",
|
||||
# use_relative_mode=True,
|
||||
# ik_method="dls",
|
||||
# ),
|
||||
# scale=0.5,
|
||||
# body_offset=DifferentialInverseKinematicsActionCfg.OffsetCfg(
|
||||
# pos=[0.0, 0.0, 0.0] # 可能需要根据实际夹爪中心位置调整
|
||||
# ),
|
||||
# )
|
||||
# # 配置夹爪动作
|
||||
# self.actions.gripper_action = BinaryJointPositionActionCfg(
|
||||
# asset_name="robot",
|
||||
# joint_names=["left_hand_joint_left", "left_hand_joint_right"],
|
||||
# open_command_expr={
|
||||
# "left_hand_joint_left": 0.0,
|
||||
# "left_hand_joint_right": 0.0,
|
||||
# },
|
||||
# close_command_expr={
|
||||
# "left_hand_joint_left": -0.03,
|
||||
# "left_hand_joint_right": 0.03,
|
||||
# },
|
||||
# )
|
||||
|
||||
# # 设置Observations
|
||||
# self.observations = MindRobotObsCfg()
|
||||
|
||||
# # 配置终止条件(遥操作通常不需要超时)
|
||||
# # self.terminations.time_out = None
|
||||
|
||||
# # 配置遥操作设备
|
||||
# self.teleop_devices = DevicesCfg(
|
||||
# devices={
|
||||
# "keyboard": Se3KeyboardCfg(
|
||||
# pos_sensitivity=0.05,
|
||||
# rot_sensitivity=0.05,
|
||||
# sim_device=self.sim.device,
|
||||
# ),
|
||||
# "spacemouse": Se3SpaceMouseCfg(
|
||||
# pos_sensitivity=0.05,
|
||||
# rot_sensitivity=0.05,
|
||||
# sim_device=self.sim.device,
|
||||
# ),
|
||||
# "gamepad": Se3GamepadCfg(
|
||||
# pos_sensitivity=0.1,
|
||||
# rot_sensitivity=0.1,
|
||||
# sim_device=self.sim.device,
|
||||
# ),
|
||||
# }
|
||||
# )
|
||||
|
||||
# # 配置end-effector frame transformer
|
||||
# marker_cfg = FRAME_MARKER_CFG.copy()
|
||||
# marker_cfg.markers["frame"].scale = (0.1, 0.1, 0.1)
|
||||
# marker_cfg.prim_path = "/Visuals/FrameTransformer"
|
||||
# self.scene.ee_frame = FrameTransformerCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Robot/rm_65_fb_left/Link_6", # ✅ 使用左臂的base link
|
||||
# debug_vis=False,
|
||||
# visualizer_cfg=marker_cfg,
|
||||
# target_frames=[
|
||||
# FrameTransformerCfg.FrameCfg(
|
||||
# prim_path="{ENV_REGEX_NS}/Robot/rm_65_fb_left/Link_6", # ✅ 使用左手的body
|
||||
# name="end_effector",
|
||||
# offset=OffsetCfg(
|
||||
# pos=[0.0, 0.0, 0.0], # 可能需要根据实际调整
|
||||
# ),
|
||||
# ),
|
||||
# ],
|
||||
# )
|
||||
|
||||
|
||||
# # 设置夹爪相关参数(用于gripper状态检查)
|
||||
# self.gripper_joint_names = ["left_hand_joint_left", "left_hand_joint_right"]
|
||||
# self.gripper_open_val = 0.0
|
||||
# self.gripper_threshold = 0.005
|
||||
Reference in New Issue
Block a user